glib r7698 - trunk/gio



Author: matthiasc
Date: Fri Nov 28 08:28:39 2008
New Revision: 7698
URL: http://svn.gnome.org/viewvc/glib?rev=7698&view=rev

Log:
2008-11-28  Matthias Clasen  <mclasen redhat com>

        Bug 559633 â gtk_image_new_from_gicon does not always work for
        .desktop files

        * gdesktopappinfo.c (g_desktop_app_info_new_from_keyfile): Ignore
        extensions on icon names.  Proposed by Axel von Bertoldi.



Modified:
   trunk/gio/ChangeLog
   trunk/gio/gdesktopappinfo.c

Modified: trunk/gio/gdesktopappinfo.c
==============================================================================
--- trunk/gio/gdesktopappinfo.c	(original)
+++ trunk/gio/gdesktopappinfo.c	Fri Nov 28 08:28:39 2008
@@ -267,7 +267,18 @@
 	  g_object_unref (file);
 	}
       else
-	info->icon = g_themed_icon_new (info->icon_name);
+        {
+          char *p;
+
+          /* Work around a common mistake in desktop files */    
+          if ((p = strrchr (info->icon_name, '.')) != NULL &&
+              (strcmp (p, ".png") == 0 ||
+               strcmp (p, ".xpm") == 0 ||
+               strcmp (p, ".svg") == 0)) 
+            *p = 0;
+
+	  info->icon = g_themed_icon_new (info->icon_name);
+        }
     }
   
   if (info->exec)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]