[Xfce4-commits] [panel-plugins/xfce4-statusnotifier-plugin] 04/08: Inspect icon_theme_path to obtain icon

noreply at xfce.org noreply at xfce.org
Sun Jul 16 23:24:44 CEST 2017


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

n   i   n   e   t   l   s       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-statusnotifier-plugin.

commit 414537a2ca2bd73f555ea7dc7680aaae718f8c87
Author: Viktor Odintsev <ninetls at xfce.org>
Date:   Thu Jul 13 02:17:13 2017 +0300

    Inspect icon_theme_path to obtain icon
---
 panel-plugin/sn-icon-box.c | 25 ++++++++++++++++++++++---
 panel-plugin/sn-item.c     |  4 ++++
 panel-plugin/sn-item.h     |  1 +
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/sn-icon-box.c b/panel-plugin/sn-icon-box.c
index ef41f42..0423cb7 100644
--- a/panel-plugin/sn-icon-box.c
+++ b/panel-plugin/sn-icon-box.c
@@ -227,6 +227,7 @@ sn_icon_box_finalize (GObject *object)
 static void
 sn_icon_box_apply_icon (GtkWidget    *image,
                         GtkIconTheme *icon_theme,
+                        GtkIconTheme *icon_theme_from_path,
                         const gchar  *icon_name,
                         GdkPixbuf    *icon_pixbuf,
                         gint          icon_size)
@@ -264,6 +265,13 @@ sn_icon_box_apply_icon (GtkWidget    *image,
             }
         }
 
+      if (work_pixbuf == NULL && icon_theme_from_path != NULL)
+        {
+          work_pixbuf = gtk_icon_theme_load_icon (icon_theme_from_path,
+                                                  sn_preferred_name (),
+                                                  icon_size, 0, NULL);
+        }
+
       if (work_pixbuf == NULL)
         {
           icon_info = gtk_icon_theme_lookup_icon (icon_theme,
@@ -331,21 +339,32 @@ sn_icon_box_icon_changed (GtkWidget *widget)
   GdkPixbuf    *icon_pixbuf;
   const gchar  *overlay_icon_name;
   GdkPixbuf    *overlay_icon_pixbuf;
+  const gchar  *theme_path;
   GtkIconTheme *icon_theme;
+  GtkIconTheme *icon_theme_from_path = NULL;
   gint          icon_size;
 
   box = XFCE_SN_ICON_BOX (widget);
   icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (widget)));
   icon_size = sn_config_get_icon_size (box->config);
 
-  sn_item_get_icon (box->item,
+  sn_item_get_icon (box->item, &theme_path,
                     &icon_name, &icon_pixbuf,
                     &overlay_icon_name, &overlay_icon_pixbuf);
 
-  sn_icon_box_apply_icon (box->icon, icon_theme,
+  if (theme_path != NULL)
+    {
+      icon_theme_from_path = gtk_icon_theme_new ();
+      gtk_icon_theme_prepend_search_path (icon_theme_from_path, theme_path);
+    }
+
+  sn_icon_box_apply_icon (box->icon, icon_theme, icon_theme_from_path,
                           icon_name, icon_pixbuf, icon_size);
-  sn_icon_box_apply_icon (box->overlay, icon_theme,
+  sn_icon_box_apply_icon (box->overlay, icon_theme, icon_theme_from_path,
                           overlay_icon_name, overlay_icon_pixbuf, icon_size);
+
+  if (icon_theme_from_path != NULL)
+    g_object_unref (icon_theme_from_path);
 }
 
 
diff --git a/panel-plugin/sn-item.c b/panel-plugin/sn-item.c
index 7aae308..294d950 100644
--- a/panel-plugin/sn-item.c
+++ b/panel-plugin/sn-item.c
@@ -879,6 +879,7 @@ sn_item_get_name (SnItem *item)
 
 void
 sn_item_get_icon (SnItem       *item,
+                  const gchar **theme_path,
                   const gchar **icon_name,
                   GdkPixbuf   **icon_pixbuf,
                   const gchar **overlay_icon_name,
@@ -906,6 +907,9 @@ sn_item_get_icon (SnItem       *item,
 
   if (overlay_icon_pixbuf != NULL)
     *overlay_icon_pixbuf = item->overlay_icon_pixbuf;
+
+  if (theme_path != NULL)
+    *theme_path = item->icon_theme_path;
 }
 
 
diff --git a/panel-plugin/sn-item.h b/panel-plugin/sn-item.h
index 76ee3dd..3f099e7 100644
--- a/panel-plugin/sn-item.h
+++ b/panel-plugin/sn-item.h
@@ -42,6 +42,7 @@ void                   sn_item_invalidate                      (SnItem
 const gchar           *sn_item_get_name                        (SnItem                  *item);
 
 void                   sn_item_get_icon                        (SnItem                  *item,
+                                                                const gchar            **theme_path,
                                                                 const gchar            **icon_name,
                                                                 GdkPixbuf              **icon_pixbuf,
                                                                 const gchar            **overlay_icon_name,

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


More information about the Xfce4-commits mailing list