[Xfce4-commits] [panel-plugins/xfce4-weather-plugin] 01/01: Use xfce_panel_plugin_get_icon_size so the weather icon respects the panel's fixed icon size

noreply at xfce.org noreply at xfce.org
Sat Mar 23 01:36:36 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-weather-plugin.

commit b6a7edf7be7a1cf354e457b56e73c27a164356ed
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Fri Mar 22 20:36:29 2019 -0400

    Use xfce_panel_plugin_get_icon_size so the weather icon respects the panel's fixed icon size
---
 panel-plugin/weather.c | 27 +++++++++++++++++----------
 panel-plugin/weather.h |  1 +
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 710bd88..337b76d 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -289,16 +289,8 @@ update_icon(plugin_data *data)
     gchar *str;
     gint size;
 
-    size = data->panel_size;
-#if LIBXFCE4PANEL_CHECK_VERSION(4,9,0)
-    /* make icon smaller when not single-row in multi-row panels */
-    if (!data->single_row && data->panel_rows > 2)
-        size *= 0.80;
-#endif
-    /* take into account the border of the toggle button */
-    size -= 2;
-
     /* set panel icon according to current weather conditions */
+    size = data->icon_size;
     conditions = get_current_conditions(data->weatherdata);
     str = get_data(conditions, data->units, SYMBOL,
                    data->round, data->night_time);
@@ -2049,12 +2041,13 @@ xfceweather_free(XfcePanelPlugin *plugin,
     g_slice_free(plugin_data, data);
 }
 
-
 static gboolean
 xfceweather_set_size(XfcePanelPlugin *panel,
                      gint size,
                      plugin_data *data)
 {
+    gint icon_size;
+
 #if LIBXFCE4PANEL_CHECK_VERSION(4,9,0)
     data->panel_rows = xfce_panel_plugin_get_nrows(panel);
     if (data->single_row)
@@ -2062,6 +2055,20 @@ xfceweather_set_size(XfcePanelPlugin *panel,
 #endif
     data->panel_size = size;
 
+#if LIBXFCE4PANEL_CHECK_VERSION(4, 13, 0)
+    icon_size = xfce_panel_plugin_get_icon_size (panel);
+#else
+    icon_size = data->panel_size;
+
+    /* make icon smaller when not single-row in multi-row panels */
+    if (!data->single_row && data->panel_rows > 2)
+        icon_size *= 0.80;
+
+    /* take into account the border of the toggle button */
+    icon_size -= 2;
+#endif
+    data->icon_size = icon_size;
+
     update_icon(data);
     update_scrollbox(data, FALSE);
 
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 31ab9fb..682fcfa 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -85,6 +85,7 @@ typedef struct {
     guint summary_remember_tab;
 
     gint panel_size;
+    gint icon_size;
     guint panel_rows;
     XfcePanelPluginMode panel_orientation;
     gboolean single_row;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list