summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <[email protected]>2013-08-04 02:41:54 +0200
committerlukefromdc <[email protected]>2018-04-04 21:53:21 -0400
commitc0d60fcba6497e349b4b45f38e61a5c619eb6f14 (patch)
tree6b4b0d5fe5de59a58fbae987f1a4acfa1b3c934f
parentbc1405c9f54e19e74f973581130229ef1053ff9c (diff)
downloadcaja-c0d60fcba6497e349b4b45f38e61a5c619eb6f14.tar.bz2
caja-c0d60fcba6497e349b4b45f38e61a5c619eb6f14.tar.xz
properties-window: support HiDpi for the properties window icon
This was missing from the last commit. origin commit: https://gitlab.gnome.org/GNOME/nautilus/commit/3a6053f1
-rw-r--r--src/file-manager/fm-properties-window.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 6de9f98a..3476aa50 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -410,14 +410,12 @@ get_image_for_properties_window (FMPropertiesWindow *window,
static void
-update_properties_window_icon (GtkImage *image)
+update_properties_window_icon (FMPropertiesWindow *window)
{
- FMPropertiesWindow *window;
GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
char *name;
- window = g_object_get_data (G_OBJECT (image), "properties_window");
-
get_image_for_properties_window (window, &name, &pixbuf);
if (name != NULL) {
@@ -426,10 +424,13 @@ update_properties_window_icon (GtkImage *image)
gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
}
- gtk_image_set_from_pixbuf (image, pixbuf);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, gtk_widget_get_scale_factor (GTK_WIDGET (window)),
+ gtk_widget_get_window (GTK_WIDGET (window)));
+ gtk_image_set_from_surface (GTK_IMAGE (window->details->icon_image), surface);
g_free (name);
g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
/* utility to test if a uri refers to a local image */
@@ -535,11 +536,11 @@ create_image_widget (FMPropertiesWindow *window,
{
GtkWidget *button;
GtkWidget *image;
- GdkPixbuf *pixbuf;
-
- get_image_for_properties_window (window, NULL, &pixbuf);
image = gtk_image_new ();
+ window->details->icon_image = image;
+
+ update_properties_window_icon (window);
gtk_widget_show (image);
button = NULL;
@@ -559,13 +560,6 @@ create_image_widget (FMPropertiesWindow *window,
G_CALLBACK (select_image_button_callback), window);
}
- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
-
- g_object_unref (pixbuf);
-
- g_object_set_data (G_OBJECT (image), "properties_window", window);
-
- window->details->icon_image = image;
window->details->icon_button = button;
return button != NULL ? button : image;
@@ -1163,8 +1157,7 @@ properties_window_update (FMPropertiesWindow *window,
if (dirty_original) {
update_properties_window_title (window);
- update_properties_window_icon (GTK_IMAGE (window->details->icon_image));
-
+ update_properties_window_icon (window);
update_name_field (window);
for (l = window->details->emblem_buttons; l != NULL; l = l->next) {