[Xfce4-commits] [xfce/xfce4-panel] 01/01: showdesktop: Replace xfce_panel_image with plain Gtk+

noreply at xfce.org noreply at xfce.org
Sat Mar 18 13:20:07 CET 2017


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

ochosi pushed a commit to branch master
in repository xfce/xfce4-panel.

commit e3a14be802f576fe80b0041de6c1109f5ec58281
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sat Mar 18 13:20:02 2017 +0100

    showdesktop: Replace xfce_panel_image with plain Gtk+
---
 plugins/showdesktop/showdesktop.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/plugins/showdesktop/showdesktop.c b/plugins/showdesktop/showdesktop.c
index 656c422..0e262e7 100644
--- a/plugins/showdesktop/showdesktop.c
+++ b/plugins/showdesktop/showdesktop.c
@@ -56,6 +56,7 @@ struct _ShowDesktopPlugin
 
   /* the toggle button */
   GtkWidget  *button;
+  GtkWidget  *icon;
 
   /* the wnck screen */
   WnckScreen *wnck_screen;
@@ -84,7 +85,7 @@ show_desktop_plugin_class_init (ShowDesktopPluginClass *klass)
 static void
 show_desktop_plugin_init (ShowDesktopPlugin *plugin)
 {
-  GtkWidget *button, *image;
+  GtkWidget *button;
 
   plugin->wnck_screen = NULL;
 
@@ -104,9 +105,9 @@ show_desktop_plugin_init (ShowDesktopPlugin *plugin)
   xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), button);
   gtk_widget_show (button);
 
-  image = xfce_panel_image_new_from_source ("user-desktop");
-  gtk_container_add (GTK_CONTAINER (button), image);
-  gtk_widget_show (image);
+  plugin->icon = gtk_image_new_from_icon_name ("user-desktop", GTK_ICON_SIZE_MENU);
+  gtk_container_add (GTK_CONTAINER (button), plugin->icon);
+  gtk_widget_show (plugin->icon);
 }
 
 
@@ -179,11 +180,16 @@ static gboolean
 show_desktop_plugin_size_changed (XfcePanelPlugin *panel_plugin,
                                   gint             size)
 {
+  ShowDesktopPlugin *plugin = XFCE_SHOW_DESKTOP_PLUGIN (panel_plugin);
+  gint  icon_size;
+
   panel_return_val_if_fail (XFCE_IS_SHOW_DESKTOP_PLUGIN (panel_plugin), FALSE);
 
   /* keep the button squared */
   size /= xfce_panel_plugin_get_nrows (panel_plugin);
   gtk_widget_set_size_request (GTK_WIDGET (panel_plugin), size, size);
+  icon_size = xfce_panel_plugin_get_icon_size (panel_plugin, GTK_WIDGET (plugin->button));
+  gtk_image_set_pixel_size (GTK_IMAGE (plugin->icon), 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