summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-ui-utilities.c
diff options
context:
space:
mode:
authorCosimo Cecchi <[email protected]>2013-08-02 14:37:13 +0200
committerlukefromdc <[email protected]>2018-04-04 21:53:21 -0400
commitbc1405c9f54e19e74f973581130229ef1053ff9c (patch)
tree8ae544cad7a3b815ff6c48304ced204f37dd4947 /libcaja-private/caja-ui-utilities.c
parent779e0af4042b6572d729190067cfee6a876d73e5 (diff)
downloadcaja-bc1405c9f54e19e74f973581130229ef1053ff9c.tar.bz2
caja-bc1405c9f54e19e74f973581130229ef1053ff9c.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.c22
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",