summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2019-01-02 17:55:23 -0500
committerlukefromdc <[email protected]>2019-01-03 19:42:58 +0000
commit9935eeb51c6fef98573246421ff7e834ff385638 (patch)
treecd17d32e547c73c63c8bbf15be1a4927facdec53 /applets
parent8d0f753559918251d5ba3a841803e5369a90bb17 (diff)
downloadmate-panel-9935eeb51c6fef98573246421ff7e834ff385638.tar.bz2
mate-panel-9935eeb51c6fef98573246421ff7e834ff385638.tar.xz
Clock: Fix weather icon size selection for panel height
Diffstat (limited to 'applets')
-rw-r--r--applets/clock/clock.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index e739c57a..f84bd8bf 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -1988,9 +1988,22 @@ weather_icon_updated_cb (MatePanelApplet *applet,
icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (cd->applet));
icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (cd->applet));
+ /*Iterate through the icon sizes so they can be kept sharp*/
+ if (icon_size < 22)
+ icon_size = 16;
+ else if (icon_size < 24)
+ icon_size = 22;
+ else if (icon_size < 32)
+ icon_size = 24;
+ else if (icon_size < 48)
+ icon_size = 32;
+ else
+ icon_size = 48;
surface = gtk_icon_theme_load_surface (theme, cd->weather_icon_name, icon_size, icon_scale,
- NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
+ NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK |
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ NULL);
gtk_image_set_from_surface (GTK_IMAGE (cd->panel_weather_icon), surface);
@@ -2023,8 +2036,22 @@ location_weather_updated_cb (ClockLocation *location,
icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (cd->applet));
icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (cd->applet));
+ /*Iterate through the icon sizes so they can be kept sharp*/
+ if (icon_size < 22)
+ icon_size = 16;
+ else if (icon_size < 24)
+ icon_size = 22;
+ else if (icon_size < 32)
+ icon_size = 24;
+ else if (icon_size < 48)
+ icon_size = 32;
+ else
+ icon_size = 48;
+
surface = gtk_icon_theme_load_surface (theme, cd->weather_icon_name, icon_size, icon_scale,
- NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
+ NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK |
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ NULL);
temp = weather_info_get_temp_summary (info);