Skip to content

Commit 9935eeb

Browse files
committed
Clock: Fix weather icon size selection for panel height
1 parent 8d0f753 commit 9935eeb

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

applets/clock/clock.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,9 +1988,22 @@ weather_icon_updated_cb (MatePanelApplet *applet,
19881988

19891989
icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (cd->applet));
19901990
icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (cd->applet));
1991+
/*Iterate through the icon sizes so they can be kept sharp*/
1992+
if (icon_size < 22)
1993+
icon_size = 16;
1994+
else if (icon_size < 24)
1995+
icon_size = 22;
1996+
else if (icon_size < 32)
1997+
icon_size = 24;
1998+
else if (icon_size < 48)
1999+
icon_size = 32;
2000+
else
2001+
icon_size = 48;
19912002

19922003
surface = gtk_icon_theme_load_surface (theme, cd->weather_icon_name, icon_size, icon_scale,
1993-
NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
2004+
NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK |
2005+
GTK_ICON_LOOKUP_FORCE_SIZE,
2006+
NULL);
19942007

19952008
gtk_image_set_from_surface (GTK_IMAGE (cd->panel_weather_icon), surface);
19962009

@@ -2023,8 +2036,22 @@ location_weather_updated_cb (ClockLocation *location,
20232036
icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (cd->applet));
20242037
icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (cd->applet));
20252038

2039+
/*Iterate through the icon sizes so they can be kept sharp*/
2040+
if (icon_size < 22)
2041+
icon_size = 16;
2042+
else if (icon_size < 24)
2043+
icon_size = 22;
2044+
else if (icon_size < 32)
2045+
icon_size = 24;
2046+
else if (icon_size < 48)
2047+
icon_size = 32;
2048+
else
2049+
icon_size = 48;
2050+
20262051
surface = gtk_icon_theme_load_surface (theme, cd->weather_icon_name, icon_size, icon_scale,
2027-
NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
2052+
NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK |
2053+
GTK_ICON_LOOKUP_FORCE_SIZE,
2054+
NULL);
20282055

20292056
temp = weather_info_get_temp_summary (info);
20302057

0 commit comments

Comments
 (0)