[network-manager-applet] applet: scale icons for HiDPI displays



commit dc9ee4e1129c87aa8a79d1783375877a5f522aee
Author: Victor Kareh <vkareh redhat com>
Date:   Mon Nov 11 10:09:45 2019 -0500

    applet: scale icons for HiDPI displays
    
    https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/71

 src/applet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/applet.c b/src/applet.c
index 42d44787..abf0c25c 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2992,6 +2992,7 @@ nma_icon_check_and_load (const char *name, NMApplet *applet)
 {
        GError *error = NULL;
        GdkPixbuf *icon;
+       int scale;
 
        g_assert (name != NULL);
        g_assert (applet != NULL);
@@ -3000,10 +3001,12 @@ nma_icon_check_and_load (const char *name, NMApplet *applet)
        if (g_hash_table_lookup_extended (applet->icon_cache, name, NULL, (gpointer) &icon))
                return icon;
 
+       scale = gtk_widget_get_scale_factor (applet->context_menu);
+
        /* Try to load the icon; if the load fails, log the problem, and set
         * the icon to the fallback icon if requested.
         */
-       if (!(icon = gtk_icon_theme_load_icon (applet->icon_theme, name, applet->icon_size, 
GTK_ICON_LOOKUP_FORCE_SIZE, &error))) {
+       if (!(icon = gtk_icon_theme_load_icon_for_scale (applet->icon_theme, name, applet->icon_size, scale, 
GTK_ICON_LOOKUP_FORCE_SIZE, &error))) {
                g_warning ("failed to load icon \"%s\": %s", name, error->message);
                g_clear_error (&error);
                icon = nm_g_object_ref (applet->fallback_icon);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]