summaryrefslogtreecommitdiff
path: root/src/file-manager/fm-properties-window.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 /src/file-manager/fm-properties-window.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 'src/file-manager/fm-properties-window.c')
-rw-r--r--src/file-manager/fm-properties-window.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 56af2094..6de9f98a 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -363,17 +363,24 @@ get_image_for_properties_window (FMPropertiesWindow *window,
{
CajaIconInfo *icon, *new_icon;
GList *l;
+ gint icon_scale;
icon = NULL;
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (window->details->notebook));
+
for (l = window->details->original_files; l != NULL; l = l->next) {
CajaFile *file;
file = CAJA_FILE (l->data);
if (!icon) {
- icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS | CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
+ icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, icon_scale,
+ CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS |
+ CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
} else {
- new_icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS | CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
+ new_icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, icon_scale,
+ CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS |
+ CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
if (!new_icon || new_icon != icon) {
g_object_unref (icon);
g_object_unref (new_icon);
@@ -385,7 +392,9 @@ get_image_for_properties_window (FMPropertiesWindow *window,
}
if (!icon) {
- icon = caja_icon_info_lookup_from_name ("text-x-generic", CAJA_ICON_SIZE_STANDARD);
+ icon = caja_icon_info_lookup_from_name ("text-x-generic",
+ CAJA_ICON_SIZE_STANDARD,
+ icon_scale);
}
if (icon_name != NULL) {
@@ -3412,6 +3421,7 @@ create_emblems_page (FMPropertiesWindow *window)
char *label;
GList *icons, *l;
CajaIconInfo *info;
+ gint scale;
/* The emblems wrapped table */
scroller = eel_scrolled_wrap_table_new (TRUE, GTK_SHADOW_NONE, &emblems_table);
@@ -3427,6 +3437,7 @@ create_emblems_page (FMPropertiesWindow *window)
scroller, gtk_label_new (_("Emblems")));
icons = caja_emblem_list_available ();
+ scale = gtk_widget_get_scale_factor (scroller);
window->details->initial_emblems = get_initial_emblems (window->details->original_files);
@@ -3439,7 +3450,7 @@ create_emblems_page (FMPropertiesWindow *window)
continue;
}
- info = caja_icon_info_lookup_from_name (emblem_name, CAJA_ICON_SIZE_SMALL);
+ info = caja_icon_info_lookup_from_name (emblem_name, CAJA_ICON_SIZE_SMALL, scale);
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, CAJA_ICON_SIZE_SMALL);
if (pixbuf == NULL) {
@@ -3454,8 +3465,8 @@ create_emblems_page (FMPropertiesWindow *window)
}
button = eel_labeled_image_check_button_new (label, pixbuf);
- eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), STANDARD_EMBLEM_HEIGHT);
- eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), EMBLEM_LABEL_SPACING);
+ eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), STANDARD_EMBLEM_HEIGHT * scale);
+ eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), EMBLEM_LABEL_SPACING * scale);
g_free (label);
g_object_unref (pixbuf);