summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-05-23 19:42:38 +0200
committerPablo Barciela <[email protected]>2018-05-23 19:55:19 +0200
commita3195d0d4f421c39cdfb97bb44e44e98191b98d4 (patch)
treebe7d0c4596c2bc8280034fe54333994eea91aee2
parenteb65d2246ed81f1235d94cec51b0659ca655e169 (diff)
downloadcaja-a3195d0d4f421c39cdfb97bb44e44e98191b98d4.tar.bz2
caja-a3195d0d4f421c39cdfb97bb44e44e98191b98d4.tar.xz
caja-bookmark.c: Fix icons in bookmarks
Fixes https://github.com/mate-desktop/caja/pull/962#issuecomment-389114129
-rw-r--r--libcaja-private/caja-bookmark.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c
index f8a187c8..3e5bcc2e 100644
--- a/libcaja-private/caja-bookmark.c
+++ b/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;
}