diff options
author | Dan Williams <dcbw@redhat.com> | 2014-12-05 16:52:31 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-12-11 09:23:18 -0600 |
commit | 5814648e6e3a7e825d85e1955736ffa284af541a (patch) | |
tree | 060ffb39834fc586d0f72639f8606e1b901a151c | |
parent | c2bc610f92f31ac4631cfbd8c27aa0ff878607c4 (diff) | |
download | network-manager-applet-5814648e6e3a7e825d85e1955736ffa284af541a.tar.gz |
applet: hardcode AP strength icons to 24x24 (bgo #741184)
The icon size in the menu is currently the same as the size of the
status icon. That means if the status icon size is larger than
24x24 the menu looks awful.
We should be using GTK_ICON_SIZE_MENU here, but that's actually
a bit too small. Since GTK hardcodes GTK_ICON_SIZE_MENU to 16x16
anyway, we might as well hardcode the size we want to use too.
https://bugzilla.gnome.org/show_bug.cgi?id=741184
-rw-r--r-- | src/ap-menu-item.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c index ca94c327..02386a80 100644 --- a/src/ap-menu-item.c +++ b/src/ap-menu-item.c @@ -181,6 +181,15 @@ nm_network_menu_item_best_strength (NMNetworkMenuItem * item, GDK_INTERP_NEAREST, 255); } + /* Scale to menu size if larger so the menu doesn't look awful */ + if (gdk_pixbuf_get_height (pixbuf) > 24 || gdk_pixbuf_get_width (pixbuf) > 24) { + GdkPixbuf *scaled; + + scaled = gdk_pixbuf_scale_simple (pixbuf, 24, 24, GDK_INTERP_BILINEAR); + g_object_unref (pixbuf); + pixbuf = scaled; + } + gtk_image_set_from_pixbuf (GTK_IMAGE (item->strength), pixbuf); g_object_unref (pixbuf); } @@ -214,8 +223,16 @@ nm_network_menu_item_set_detail (NMNetworkMenuItem *item, item->is_encrypted = TRUE; if (nm_access_point_get_mode (ap) == NM_802_11_MODE_ADHOC) { + GdkPixbuf *scaled = NULL; + item->is_adhoc = is_adhoc = TRUE; - gtk_image_set_from_pixbuf (GTK_IMAGE (item->detail), adhoc_icon); + + if (gdk_pixbuf_get_height (adhoc_icon) > 24 || gdk_pixbuf_get_width (adhoc_icon) > 24) + scaled = gdk_pixbuf_scale_simple (adhoc_icon, 24, 24, GDK_INTERP_BILINEAR); + + gtk_image_set_from_pixbuf (GTK_IMAGE (item->detail), scaled ? scaled : adhoc_icon); + + g_clear_object (&scaled); } else gtk_image_set_from_stock (GTK_IMAGE (item->detail), NULL, GTK_ICON_SIZE_MENU); |