summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-bookmark.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-04-02 22:02:39 -0400
committerraveit65 <[email protected]>2018-04-05 09:09:50 +0200
commitdade92d4f1edb6f47933e77229801971cb458ef1 (patch)
treedb2545721a093328979a305a2c92e428ad65e230 /libcaja-private/caja-bookmark.c
parent556663ac4b8eb03b86fa70eeb6b959e1d27281e2 (diff)
downloadcaja-dade92d4f1edb6f47933e77229801971cb458ef1.tar.bz2
caja-dade92d4f1edb6f47933e77229801971cb458ef1.tar.xz
HiDPI: Convert Pixbufs to Cairo Surfaces
This allows icons in most places to scale up properly for HiDPI displays.
Diffstat (limited to 'libcaja-private/caja-bookmark.c')
-rw-r--r--libcaja-private/caja-bookmark.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c
index d4c25939..572d7a68 100644
--- a/libcaja-private/caja-bookmark.c
+++ b/libcaja-private/caja-bookmark.c
@@ -212,17 +212,15 @@ caja_bookmark_get_has_custom_name (CajaBookmark *bookmark)
return (bookmark->details->has_custom_name);
}
-
-GdkPixbuf *
-caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
- GtkIconSize stock_size)
+cairo_surface_t *
+caja_bookmark_get_surface (CajaBookmark *bookmark,
+ GtkIconSize stock_size)
{
- GdkPixbuf *result;
+ cairo_surface_t *result;
GIcon *icon;
CajaIconInfo *info;
int pixel_size, pixel_scale;
-
g_return_val_if_fail (CAJA_IS_BOOKMARK (bookmark), NULL);
icon = caja_bookmark_get_icon (bookmark);
@@ -234,7 +232,7 @@ caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
pixel_size = caja_get_icon_size_for_stock_size (stock_size);
pixel_scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
info = caja_icon_info_lookup (icon, pixel_size, pixel_scale);
- result = caja_icon_info_get_pixbuf_at_size (info, pixel_size);
+ result = caja_icon_info_get_surface_at_size (info, pixel_size);
g_object_unref (info);
g_object_unref (icon);
@@ -590,18 +588,18 @@ caja_bookmark_new (GFile *location, const char *name, gboolean has_custom_name,
static GtkWidget *
create_image_widget_for_bookmark (CajaBookmark *bookmark)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
GtkWidget *widget;
- pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
- if (pixbuf == NULL)
+ surface = caja_bookmark_get_surface (bookmark, GTK_ICON_SIZE_MENU);
+ if (surface == NULL)
{
return NULL;
}
- widget = gtk_image_new_from_pixbuf (pixbuf);
+ widget = gtk_image_new_from_surface (surface);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
return widget;
}