Skip to content

Commit a3195d0

Browse files
committed
caja-bookmark.c: Fix icons in bookmarks
Fixes #962 (comment)
1 parent eb65d22 commit a3195d0

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

libcaja-private/caja-bookmark.c

+10-16
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ caja_bookmark_new (GFile *location, const char *name, gboolean has_custom_name,
585585
return new_bookmark;
586586
}
587587

588-
static GtkWidget *
589-
create_image_widget_for_bookmark (CajaBookmark *bookmark)
588+
static cairo_surface_t *
589+
create_image_cairo_for_bookmark (CajaBookmark *bookmark)
590590
{
591591
cairo_surface_t *surface;
592592
GtkWidget *widget;
@@ -597,23 +597,20 @@ create_image_widget_for_bookmark (CajaBookmark *bookmark)
597597
return NULL;
598598
}
599599

600-
widget = gtk_image_new_from_surface (surface);
601-
602-
cairo_surface_destroy (surface);
603-
return widget;
600+
return surface;
604601
}
605602

606603
static GtkWidget *
607-
bookmark_image_menu_item_new_from_pixbuf (GdkPixbuf *icon_pixbuf,
608-
const gchar *label_name)
604+
bookmark_image_menu_item_new_from_surface (cairo_surface_t *icon_surface,
605+
const gchar *label_name)
609606
{
610607
GtkWidget *icon;
611608
GtkLabel *label;
612609

613610
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
614611

615-
if (icon_pixbuf)
616-
icon = gtk_image_new_from_pixbuf (icon_pixbuf);
612+
if (icon_surface)
613+
icon = gtk_image_new_from_surface (icon_surface);
617614
else
618615
icon = gtk_image_new ();
619616

@@ -645,15 +642,12 @@ bookmark_image_menu_item_new_from_pixbuf (GdkPixbuf *icon_pixbuf,
645642
GtkWidget *
646643
caja_bookmark_menu_item_new (CajaBookmark *bookmark)
647644
{
648-
GdkPixbuf *icon;
649645
GtkWidget *menu_item;
650-
GtkWidget *image_widget;
651-
652-
image_widget = create_image_widget_for_bookmark (bookmark);
646+
cairo_surface_t *image_cairo;
653647

654-
icon = gtk_image_get_pixbuf (GTK_IMAGE (image_widget));
648+
image_cairo = create_image_cairo_for_bookmark (bookmark);
655649

656-
menu_item = bookmark_image_menu_item_new_from_pixbuf (icon, bookmark->details->name);
650+
menu_item = bookmark_image_menu_item_new_from_surface (image_cairo, bookmark->details->name);
657651

658652
return menu_item;
659653
}

0 commit comments

Comments
 (0)