[Xfce4-commits] [xfce/thunar] 02/02: Switch from XfcePanelImage to GtkImage

noreply at xfce.org noreply at xfce.org
Sat Mar 18 15:16:11 CET 2017


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

andrzejr pushed a commit to branch master
in repository xfce/thunar.

commit ffcbbc86b42a508133a3209d472812cc69c22a7a
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Sat Mar 18 14:15:36 2017 +0000

    Switch from XfcePanelImage to GtkImage
---
 plugins/thunar-tpa/thunar-tpa.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/plugins/thunar-tpa/thunar-tpa.c b/plugins/thunar-tpa/thunar-tpa.c
index fe6a2ab..aabf8cb 100644
--- a/plugins/thunar-tpa/thunar-tpa.c
+++ b/plugins/thunar-tpa/thunar-tpa.c
@@ -170,7 +170,7 @@ thunar_tpa_init (ThunarTpa *plugin)
   gtk_widget_show (plugin->button);
 
   /* setup the image for the trash plugin */
-  plugin->image = xfce_panel_image_new_from_source ("user-trash");
+  plugin->image = gtk_image_new_from_icon_name ("user-trash", GTK_ICON_SIZE_BUTTON);
   gtk_container_add (GTK_CONTAINER (plugin->button), plugin->image);
   gtk_widget_show (plugin->image);
 
@@ -249,12 +249,20 @@ static gboolean
 thunar_tpa_size_changed (XfcePanelPlugin *panel_plugin,
                          gint             size)
 {
-  g_return_val_if_fail (panel_plugin != NULL, FALSE);
+  ThunarTpa *plugin = THUNAR_TPA (panel_plugin);
+  gint       image_size;
 
   /* make the plugin fit a single row */
   size /= xfce_panel_plugin_get_nrows (panel_plugin);
   gtk_widget_set_size_request (GTK_WIDGET (panel_plugin), size, size);
 
+#if LIBXFCE4PANEL_CHECK_VERSION (4,13,0)
+  image_size = xfce_panel_plugin_get_icon_size (panel_plugin, GTK_WIDGET (plugin->button));
+#else
+  image_size = size - 2; // fall-back for older panel versions
+#endif
+  gtk_image_set_pixel_size (GTK_IMAGE (plugin->image), image_size);
+
   return TRUE;
 }
 
@@ -278,7 +286,7 @@ thunar_tpa_error (ThunarTpa *plugin,
   g_free (tooltip);
 
   /* setup an error plugin */
-  xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (plugin->image), "stock_dialog-error");
+  gtk_image_set_from_icon_name (GTK_IMAGE (plugin->image), "stock_dialog-error", GTK_ICON_SIZE_BUTTON);
 }
 
 
@@ -291,7 +299,7 @@ thunar_tpa_state (ThunarTpa *plugin,
   gtk_widget_set_tooltip_text (plugin->button, full ? _("Trash contains files") : _("Trash is empty"));
 
   /* setup the appropriate plugin */
-  xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (plugin->image), full ? "user-trash-full" : "user-trash");
+  gtk_image_set_from_icon_name (GTK_IMAGE (plugin->image), full ? "user-trash-full" : "user-trash", GTK_ICON_SIZE_BUTTON);
 
   /* sensitivity of the menu item */
   gtk_widget_set_sensitive (plugin->mi, full);

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


More information about the Xfce4-commits mailing list