summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <vkareh@redhat.com>2019-11-11 10:09:45 -0500
committerLubomir Rintel <lkundrak@v3.sk>2019-11-19 11:15:54 +0100
commitdc9ee4e1129c87aa8a79d1783375877a5f522aee (patch)
treec13cddf89b4f93aba263077490e0372cb47f2138
parente740301fbbde9fefe35b298d03877745842eabfc (diff)
downloadnetwork-manager-applet-dc9ee4e1129c87aa8a79d1783375877a5f522aee.tar.gz
applet: scale icons for HiDPI displays
https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/71
-rw-r--r--src/applet.c5
1 files changed, 4 insertions, 1 deletions
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);