[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 01/01: Switch to xfce_panel_plugin_get_icon_size
noreply at xfce.org
noreply at xfce.org
Sat Oct 27 00:08:42 CEST 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i 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-clipman-plugin.
commit ba9714212384528978b84c111c9156f7d43ca02a
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sat Oct 27 00:08:22 2018 +0200
Switch to xfce_panel_plugin_get_icon_size
This works only with the xfce4-panel >=4.13 and ensures consistent
plugin icon sizing.
---
panel-plugin/main-panel-plugin.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/panel-plugin/main-panel-plugin.c b/panel-plugin/main-panel-plugin.c
index eeb10c6..e1d4ccb 100644
--- a/panel-plugin/main-panel-plugin.c
+++ b/panel-plugin/main-panel-plugin.c
@@ -136,16 +136,20 @@ static gboolean
plugin_set_size (MyPlugin *plugin,
gint size)
{
+#if !LIBXFCE4PANEL_CHECK_VERSION (4,13,0)
GtkStyleContext *context;
GtkBorder padding, border;
- gint width, icon_width;
+ gint width;
gint xthickness;
gint ythickness;
+#endif
+ gint icon_size;
size /= xfce_panel_plugin_get_nrows (plugin->panel_plugin);
- gtk_widget_set_size_request(GTK_WIDGET(plugin->button), size, size);
-
-
+ gtk_widget_set_size_request (GTK_WIDGET (plugin->button), size, size);
+#if LIBXFCE4PANEL_CHECK_VERSION (4,13,0)
+ icon_size = xfce_panel_plugin_get_icon_size (XFCE_PANEL_PLUGIN (plugin->panel_plugin));
+#else
/* Calculate the size of the widget because the theme can override it */
context = gtk_widget_get_style_context (GTK_WIDGET (plugin->button));
gtk_style_context_get_padding (context, gtk_widget_get_state_flags (GTK_WIDGET (plugin->button)), &padding);
@@ -157,17 +161,18 @@ plugin_set_size (MyPlugin *plugin,
width = size - 2 * MAX (xthickness, ythickness);
/* Since symbolic icons are usually only provided in 16px we
- * try to be clever and use size steps */
+ * try to be clever and use size steps */
if (width <= 21)
- icon_width = 16;
+ icon_size = 16;
else if (width >=22 && width <= 29)
- icon_width = 24;
+ icon_size = 24;
else if (width >= 30 && width <= 40)
- icon_width = 32;
+ icon_size = 32;
else
- icon_width = width;
- /* Adjust icon-size to panel size */
- gtk_image_set_pixel_size (GTK_IMAGE (plugin->image), icon_width);
+ icon_size = width;
+#endif
+
+ gtk_image_set_pixel_size (GTK_IMAGE (plugin->image), icon_size);
return TRUE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list