diff options
author | Cosimo Cecchi <[email protected]> | 2013-08-02 14:37:13 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-04-05 09:07:22 +0200 |
commit | 4bf67ac8fff8555bf784d8cd7e1611829a9fca44 (patch) | |
tree | 343275a74d64866035b0850d5583c83eb20fe486 /libcaja-private/caja-ui-utilities.c | |
parent | 35c4dc6021f36a5fc7df94b0332c7e5d6fa00d0a (diff) | |
download | caja-4bf67ac8fff8555bf784d8cd7e1611829a9fca44.tar.bz2 caja-4bf67ac8fff8555bf784d8cd7e1611829a9fca44.tar.xz |
Support HiDpi icons
Port the rendering of icons to cairo surfaces, so that we can apply the
GDK scale factor when rendering icons.
origin commit:
https://gitlab.gnome.org/GNOME/nautilus/commit/0d4555d7
Diffstat (limited to 'libcaja-private/caja-ui-utilities.c')
-rw-r--r-- | libcaja-private/caja-ui-utilities.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libcaja-private/caja-ui-utilities.c b/libcaja-private/caja-ui-utilities.c index 8077e975..0bd096e1 100644 --- a/libcaja-private/caja-ui-utilities.c +++ b/libcaja-private/caja-ui-utilities.c @@ -138,18 +138,23 @@ extension_action_sensitive_callback (CajaMenuItem *item, } static GdkPixbuf * -get_action_icon (const char *icon_name, int size) +get_action_icon (const char *icon_name, + int size, + GtkWidget *parent_widget) { CajaIconInfo *info; GdkPixbuf *pixbuf; + int scale; + + scale = gtk_widget_get_scale_factor (parent_widget); if (g_path_is_absolute (icon_name)) { - info = caja_icon_info_lookup_from_path (icon_name, size); + info = caja_icon_info_lookup_from_path (icon_name, size, scale); } else { - info = caja_icon_info_lookup_from_name (icon_name, size); + info = caja_icon_info_lookup_from_name (icon_name, size, scale); } pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size); g_object_unref (info); @@ -158,7 +163,8 @@ get_action_icon (const char *icon_name, int size) } GtkAction * -caja_action_from_menu_item (CajaMenuItem *item) +caja_action_from_menu_item (CajaMenuItem *item, + GtkWidget *parent_widget) { char *name, *label, *tip, *icon_name; gboolean sensitive, priority; @@ -180,7 +186,8 @@ 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)); + caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU), + parent_widget); if (pixbuf != NULL) { g_object_set_data_full (G_OBJECT (action), "menu-icon", @@ -206,7 +213,7 @@ caja_action_from_menu_item (CajaMenuItem *item) } GtkAction * -caja_toolbar_action_from_menu_item (CajaMenuItem *item) +caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget) { char *name, *label, *tip, *icon_name; gboolean sensitive, priority; @@ -228,7 +235,8 @@ caja_toolbar_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_LARGE_TOOLBAR)); + caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR), + parent_widget); if (pixbuf != NULL) { g_object_set_data_full (G_OBJECT (action), "toolbar-icon", |