[vlc-commits] commit: Fix loading of the VLC icon (Christophe Mutricy )

git at videolan.org git at videolan.org
Thu Aug 26 19:01:13 CEST 2010


vlc/vlc-1.1 | branch: master | Christophe Mutricy <xtophe at videolan.org> | Wed Aug 25 23:27:19 2010 +0100| [670f4c16aa0b08d5fa157cfc96fc1b22e48f374d] | committer: Christophe Mutricy 

Fix loading of the VLC icon

Both in installed and non-installed mode
(cherry picked from commit b58531219e04935846243955e8d6a448e809739a)

Signed-off-by: Christophe Mutricy <xtophe at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=670f4c16aa0b08d5fa157cfc96fc1b22e48f374d
---

 modules/misc/notify/notify.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/misc/notify/notify.c b/modules/misc/notify/notify.c
index c3862b0..f2d049a 100644
--- a/modules/misc/notify/notify.c
+++ b/modules/misc/notify/notify.c
@@ -34,6 +34,7 @@
 #include <vlc_playlist.h>
 #include <vlc_url.h>
 
+#include <gtk/gtk.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libnotify/notify.h>
 
@@ -224,15 +225,23 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     }
     else /* else we show state-of-the art logo */
     {
-        GError *p_error = NULL;
-        char *psz_pixbuf;
-        char *psz_data = config_GetDataDir( p_this );
-        if( asprintf( &psz_pixbuf, "%s/vlc48x48.png", psz_data ) >= 0 )
+        /* First try to get an icon from the current theme. */
+        GtkIconTheme* p_theme = gtk_icon_theme_get_default();
+        pix = gtk_icon_theme_load_icon( p_theme, "vlc", 72, 0, NULL);
+
+        if( !pix )
         {
-            pix = gdk_pixbuf_new_from_file( psz_pixbuf, &p_error );
-            free( psz_pixbuf );
+        /* Load icon from share/ */
+            GError *p_error = NULL;
+            char *psz_pixbuf;
+            char *psz_data = config_GetDataDir( p_this );
+            if( asprintf( &psz_pixbuf, "%s/icons/48x48/vlc.png", psz_data ) >= 0 )
+            {
+                pix = gdk_pixbuf_new_from_file( psz_pixbuf, &p_error );
+                free( psz_pixbuf );
+            }
+            free( psz_data );
         }
-        free( psz_data );
     }
 
     free( psz_arturl );



More information about the vlc-commits mailing list