Skip to content
Permalink
Browse files

caja-bookmark.c: Fix icons in bookmarks

  • Loading branch information...
sc0w committed May 23, 2018
1 parent eb65d22 commit a3195d0d4f421c39cdfb97bb44e44e98191b98d4
Showing with 10 additions and 16 deletions.
  1. +10 −16 libcaja-private/caja-bookmark.c
@@ -585,8 +585,8 @@ caja_bookmark_new (GFile *location, const char *name, gboolean has_custom_name,
return new_bookmark;
}

static GtkWidget *
create_image_widget_for_bookmark (CajaBookmark *bookmark)
static cairo_surface_t *
create_image_cairo_for_bookmark (CajaBookmark *bookmark)
{
cairo_surface_t *surface;
GtkWidget *widget;
@@ -597,23 +597,20 @@ create_image_widget_for_bookmark (CajaBookmark *bookmark)
return NULL;
}

widget = gtk_image_new_from_surface (surface);

cairo_surface_destroy (surface);
return widget;
return surface;
}

static GtkWidget *
bookmark_image_menu_item_new_from_pixbuf (GdkPixbuf *icon_pixbuf,
const gchar *label_name)
bookmark_image_menu_item_new_from_surface (cairo_surface_t *icon_surface,
const gchar *label_name)
{
GtkWidget *icon;
GtkLabel *label;

GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);

if (icon_pixbuf)
icon = gtk_image_new_from_pixbuf (icon_pixbuf);
if (icon_surface)
icon = gtk_image_new_from_surface (icon_surface);
else
icon = gtk_image_new ();

@@ -645,15 +642,12 @@ bookmark_image_menu_item_new_from_pixbuf (GdkPixbuf *icon_pixbuf,
GtkWidget *
caja_bookmark_menu_item_new (CajaBookmark *bookmark)
{
GdkPixbuf *icon;
GtkWidget *menu_item;
GtkWidget *image_widget;

image_widget = create_image_widget_for_bookmark (bookmark);
cairo_surface_t *image_cairo;

icon = gtk_image_get_pixbuf (GTK_IMAGE (image_widget));
image_cairo = create_image_cairo_for_bookmark (bookmark);

menu_item = bookmark_image_menu_item_new_from_pixbuf (icon, bookmark->details->name);
menu_item = bookmark_image_menu_item_new_from_surface (image_cairo, bookmark->details->name);

return menu_item;
}

0 comments on commit a3195d0

Please sign in to comment.
You can’t perform that action at this time.