[Xfce4-commits] [apps/xfce4-screenshooter] 35/38: Fix panel plugin icon

noreply at xfce.org noreply at xfce.org
Fri Apr 28 03:07:31 CEST 2017


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

andre pushed a commit to branch master
in repository apps/xfce4-screenshooter.

commit 09be8957b0175a29320069afb1cd09e8cace3cdc
Author: Andre Miranda <andre42m at gmail.com>
Date:   Mon Apr 17 23:55:04 2017 -0300

    Fix panel plugin icon
---
 panel-plugin/screenshooter-plugin.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/panel-plugin/screenshooter-plugin.c b/panel-plugin/screenshooter-plugin.c
index 0f16eec..9bfdb06 100644
--- a/panel-plugin/screenshooter-plugin.c
+++ b/panel-plugin/screenshooter-plugin.c
@@ -114,29 +114,17 @@ Returns TRUE if succesful.
 static gboolean
 cb_set_size (XfcePanelPlugin *plugin, int size, PluginData *pd)
 {
-  GdkPixbuf *pb;
-  int width;
+  gint icon_size;
 
   /* reduce the size of the plugin to a single row */
   size /= xfce_panel_plugin_get_nrows (plugin);
 
-  width = size - 2 - 2 * MAX (gtk_widget_get_style(pd->button)->xthickness,
-                              gtk_widget_get_style(pd->button)->ythickness);
-
-  TRACE ("Get the icon from the theme");
-  pb = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                 SCREENSHOT_ICON_NAME,
-                                 width,
-                                 GTK_ICON_LOOKUP_FORCE_SIZE,
-                                 NULL);
-
-  TRACE ("Set the new icon");
-  gtk_image_set_from_pixbuf (GTK_IMAGE (pd->image), pb);
-  g_object_unref (pb);
-
   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);
+  gtk_image_set_pixel_size (GTK_IMAGE (pd->image), icon_size);
+
   return TRUE;
 }
 
@@ -340,6 +328,7 @@ screenshooter_plugin_construct (XfcePanelPlugin *plugin)
   PluginData *pd = g_new0 (PluginData, 1);
   ScreenshotData *sd = g_new0 (ScreenshotData, 1);
   GFile *default_save_dir;
+  gint icon_size;
 
   pd->sd = sd;
   pd->plugin = plugin;
@@ -376,7 +365,8 @@ screenshooter_plugin_construct (XfcePanelPlugin *plugin)
   TRACE ("Create the panel button");
   pd->button = xfce_create_panel_button ();
 
-  pd->image = gtk_image_new ();
+  icon_size = xfce_panel_plugin_get_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