glib r7699 - branches/glib-2-18/gio



Author: matthiasc
Date: Fri Nov 28 08:30:24 2008
New Revision: 7699
URL: http://svn.gnome.org/viewvc/glib?rev=7699&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:
   branches/glib-2-18/gio/ChangeLog
   branches/glib-2-18/gio/gdesktopappinfo.c

Modified: branches/glib-2-18/gio/gdesktopappinfo.c
==============================================================================
--- branches/glib-2-18/gio/gdesktopappinfo.c	(original)
+++ branches/glib-2-18/gio/gdesktopappinfo.c	Fri Nov 28 08:30:24 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]