diff options
author | Victor Kareh <[email protected]> | 2018-04-02 22:02:39 -0400 |
---|---|---|
committer | lukefromdc <[email protected]> | 2018-04-04 21:53:21 -0400 |
commit | 554a036710b18d2573810265c69be6e83033af63 (patch) | |
tree | 8e0b03a463952ad43f356301e91d0c1ced4fabad /libcaja-private/caja-ui-utilities.c | |
parent | 280ef8294b0e50394b5118cb298b0f9e5920f795 (diff) | |
download | caja-554a036710b18d2573810265c69be6e83033af63.tar.bz2 caja-554a036710b18d2573810265c69be6e83033af63.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-ui-utilities.c')
-rw-r--r-- | libcaja-private/caja-ui-utilities.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/libcaja-private/caja-ui-utilities.c b/libcaja-private/caja-ui-utilities.c index 0bd096e1..3ae1225b 100644 --- a/libcaja-private/caja-ui-utilities.c +++ b/libcaja-private/caja-ui-utilities.c @@ -137,13 +137,13 @@ extension_action_sensitive_callback (CajaMenuItem *item, gtk_action_set_sensitive (GTK_ACTION (user_data), value); } -static GdkPixbuf * +static cairo_surface_t * get_action_icon (const char *icon_name, int size, GtkWidget *parent_widget) { CajaIconInfo *info; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; int scale; scale = gtk_widget_get_scale_factor (parent_widget); @@ -156,10 +156,10 @@ get_action_icon (const char *icon_name, { info = caja_icon_info_lookup_from_name (icon_name, size, scale); } - pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size); + surface = caja_icon_info_get_surface_nodefault_at_size (info, size); g_object_unref (info); - return pixbuf; + return surface; } GtkAction * @@ -169,7 +169,7 @@ caja_action_from_menu_item (CajaMenuItem *item, char *name, *label, *tip, *icon_name; gboolean sensitive, priority; GtkAction *action; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; g_object_get (G_OBJECT (item), "name", &name, "label", &label, @@ -185,14 +185,14 @@ caja_action_from_menu_item (CajaMenuItem *item, if (icon_name != NULL) { - pixbuf = get_action_icon (icon_name, - caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), - parent_widget); - if (pixbuf != NULL) + surface = get_action_icon (icon_name, + caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), + parent_widget); + if (surface != NULL) { g_object_set_data_full (G_OBJECT (action), "menu-icon", - pixbuf, - g_object_unref); + surface, + cairo_surface_destroy); } } @@ -218,7 +218,7 @@ caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget char *name, *label, *tip, *icon_name; gboolean sensitive, priority; GtkAction *action; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; g_object_get (G_OBJECT (item), "name", &name, "label", &label, @@ -234,14 +234,14 @@ caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget if (icon_name != NULL) { - pixbuf = get_action_icon (icon_name, - caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR), - parent_widget); - if (pixbuf != NULL) + surface = get_action_icon (icon_name, + caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR), + parent_widget); + if (surface != NULL) { g_object_set_data_full (G_OBJECT (action), "toolbar-icon", - pixbuf, - g_object_unref); + surface, + cairo_surface_destroy); } } |