From 5e6aea1b2f1946b0f65a781627224bb89029b6ac Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 28 Nov 2008 08:28:39 +0000 Subject: [PATCH] =?utf8?q?Bug=20559633=20=E2=80=93=20gtk=5Fimage=5Fnew=5Ff?= =?utf8?q?rom=5Fgicon=20does=20not=20always=20work=20for=20.desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2008-11-28 Matthias Clasen 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. svn path=/trunk/; revision=7698 --- gio/ChangeLog | 8 ++++++++ gio/gdesktopappinfo.c | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index bbb87a0..8b10920 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,5 +1,13 @@ 2008-11-28 Matthias Clasen + 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. + +2008-11-28 Matthias Clasen + Bug 548163 – Nautilus displays wrong error message for too long file names diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index ec85744..c9dadc2 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -267,7 +267,18 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file) 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) -- 2.7.4