[Xfce4-commits] [apps/xfce4-screenshooter] 01/01: Downgrade xfce4-panel dependency to 4.12

noreply at xfce.org noreply at xfce.org
Sat Jun 24 19:24:34 CEST 2017


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

a   n   d   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 apps/xfce4-screenshooter.

commit adee03109ae6b0120513c919c7b0f790134b4031
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sat Jun 24 14:23:15 2017 -0300

    Downgrade xfce4-panel dependency to 4.12
    
    Using xfce_panel_plugin_get_icon_size own code as fallback
---
 configure.ac.in                     |  2 +-
 panel-plugin/screenshooter-plugin.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 9012783..40b8806 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -45,7 +45,7 @@ AC_HEADER_STDC
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.13.0])
+XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.12.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.10.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0])
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.16.0])
diff --git a/panel-plugin/screenshooter-plugin.c b/panel-plugin/screenshooter-plugin.c
index d3a4fad..209437d 100644
--- a/panel-plugin/screenshooter-plugin.c
+++ b/panel-plugin/screenshooter-plugin.c
@@ -106,6 +106,30 @@ set_panel_button_tooltip             (PluginData           *pd);
 
 /* Internal functions */
 
+/* Returns a preferred icon size */
+static gint
+get_preferred_icon_size (XfcePanelPlugin *plugin)
+{
+#if LIBXFCE4PANEL_CHECK_VERSION (4,13,0)
+  g_printf ("using 4.13\n");
+  return xfce_panel_plugin_get_icon_size (plugin);
+#else
+  /* fall-back for older panel versions */
+  g_printf ("using 4.12\n");
+  gint width;
+  width = xfce_panel_plugin_get_size (plugin) / xfce_panel_plugin_get_nrows (plugin);
+
+  if (width <= 27)
+    return 16;
+  if (width < 34)
+    return 24;
+  if (width < 40)
+    return 32;
+
+  return width;
+#endif
+}
+
 
 
 /* Modify the size of the panel button
@@ -122,7 +146,7 @@ cb_set_size (XfcePanelPlugin *plugin, int size, PluginData *pd)
   TRACE ("Request size for the plugin");
   gtk_widget_set_size_request (GTK_WIDGET (plugin), size, size);
 
-  icon_size = xfce_panel_plugin_get_icon_size (plugin);
+  icon_size = get_preferred_icon_size (plugin);
   gtk_image_set_pixel_size (GTK_IMAGE (pd->image), icon_size);
 
   return TRUE;
@@ -367,7 +391,7 @@ screenshooter_plugin_construct (XfcePanelPlugin *plugin)
   TRACE ("Create the panel button");
   pd->button = xfce_create_panel_button ();
 
-  icon_size = xfce_panel_plugin_get_icon_size (plugin);
+  icon_size = get_preferred_icon_size (plugin);
   pd->image = gtk_image_new_from_icon_name (SCREENSHOT_ICON_NAME, icon_size);
 
   gtk_container_add (GTK_CONTAINER (pd->button), GTK_WIDGET (pd->image));

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


More information about the Xfce4-commits mailing list