diff options
author | Ted Gould <ted@gould.cx> | 2011-04-06 11:24:05 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-04-06 11:24:05 -0500 |
commit | d45817a878e1aa80c439e8b46015db238f06abdf (patch) | |
tree | 4c25eabe64cf908d7262ebe79432e7a98d68d236 /src/app-menu-item.c | |
parent | de82ee23786da141cfea40a32a25722d09af24b1 (diff) | |
download | ayatana-indicator-messages-d45817a878e1aa80c439e8b46015db238f06abdf.tar.gz ayatana-indicator-messages-d45817a878e1aa80c439e8b46015db238f06abdf.tar.bz2 ayatana-indicator-messages-d45817a878e1aa80c439e8b46015db238f06abdf.zip |
Look for the override icon in the keyfile
Diffstat (limited to 'src/app-menu-item.c')
-rw-r--r-- | src/app-menu-item.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 575ac0a..ef3fbc0 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -347,8 +347,28 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, const const gchar * def_icon = get_default_icon(priv->desktop); if (def_icon == NULL) { - GIcon * icon = g_app_info_get_icon(priv->appinfo); - gchar * iconstr = g_icon_to_string(icon); + gchar * iconstr = NULL; + + /* Check for the over ride key and see if we should be using that + icon. If we can't get it, then go back to the app info */ + if (g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, ICON_KEY, NULL) && iconstr == NULL) { + GError * error = NULL; + + iconstr = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, ICON_KEY, &error); + + if (error != NULL) { + /* Can't figure out why this would happen, but sure, let's print something */ + g_warning("Error getting '" ICON_KEY "' from desktop file: %s", error->message); + g_error_free(error); + } + } + + /* For some reason that didn't work, let's try the app info */ + if (iconstr == NULL) { + GIcon * icon = g_app_info_get_icon(priv->appinfo); + iconstr = g_icon_to_string(icon); + } + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), APPLICATION_MENUITEM_PROP_ICON, iconstr); g_free(iconstr); } else { |