diff options
author | Evgeni Golov <evgeni@debian.org> | 2011-06-05 13:15:29 +0200 |
---|---|---|
committer | Evgeni Golov <evgeni@debian.org> | 2011-06-05 13:15:29 +0200 |
commit | 1198366a16181e1c209bac3c636ec78ccf94e4da (patch) | |
tree | 805f9598f43971a579dd344f891adc11759f3a67 | |
parent | 798de71d59e1e6c129fc6f1429302b400924a983 (diff) | |
parent | 5a4afec94f47844126d4642b99acdaee37a14d4a (diff) | |
download | ayatana-indicator-messages-1198366a16181e1c209bac3c636ec78ccf94e4da.tar.gz ayatana-indicator-messages-1198366a16181e1c209bac3c636ec78ccf94e4da.tar.bz2 ayatana-indicator-messages-1198366a16181e1c209bac3c636ec78ccf94e4da.zip |
* Merge new upstream from Ubuntu.
* New upstream release.
∘ Set the type before other variables to get default handling more
reliable (LP: #723873)
∘ Add support for overriding the default icon with a specific one
for the messaging menu (LP: #741068)
-rw-r--r-- | ChangeLog | 40 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | debian/changelog | 17 | ||||
-rw-r--r-- | src/app-menu-item.c | 47 | ||||
-rw-r--r-- | src/default-applications.h | 4 | ||||
-rw-r--r-- | src/launcher-menu-item.c | 36 |
7 files changed, 133 insertions, 15 deletions
@@ -1,5 +1,45 @@ # Generated by Makefile. Do not edit. +2011-04-07 Ted Gould <ted@gould.cx> + + 0.4.0 + +2011-04-06 Ted Gould <ted@gould.cx> + + Add support for a specific icon on the menu + +2011-04-06 Ted Gould <ted@gould.cx> + + Attaching bug + +2011-04-06 Ted Gould <ted@gould.cx> + + Look for the override icon in the keyfile + +2011-04-06 Ted Gould <ted@gould.cx> + + move ICON_KEY + +2011-04-06 Ted Gould <ted@gould.cx> + + Create the keyfile for the application icon as well + +2011-04-06 Ted Gould <ted@gould.cx> + + Checking for the ayatana override in the keyfile + +2011-04-06 Ted Gould <ted@gould.cx> + + Making it so that we store the keyfile as well. Sad we need to do this. + +2011-02-24 Ted Gould <ted@gould.cx> + + Set the type before the other variables + +2011-02-23 Ted Gould <ted@gould.cx> + + Make sure to set the type of the item before all the values. + 2011-02-17 Ted Gould <ted@gould.cx> 0.3.92 @@ -2845,7 +2845,7 @@ fi # Define the identity of the package. PACKAGE=indicator-messages - VERSION=0.3.92 + VERSION=0.4.0 cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index 962b6f0..5518610 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-messages.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-messages, 0.3.92) +AM_INIT_AUTOMAKE(indicator-messages, 0.4.0) AM_MAINTAINER_MODE diff --git a/debian/changelog b/debian/changelog index d945404..5d922a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +indicator-messages (0.4.0-1) unstable; urgency=low + + * Merge new upstream from Ubuntu. + + -- Evgeni Golov <evgeni@debian.org> Sun, 05 Jun 2011 13:13:40 +0200 + +indicator-messages (0.4.0-0ubuntu1) natty; urgency=low + + * New upstream release. + ∘ Set the type before other variables to get default handling more + reliable (LP: #723873) + ∘ Add support for overriding the default icon with a specific one + for the messaging menu (LP: #741068) + + -- Ted Gould <ted@ubuntu.com> Thu, 07 Apr 2011 12:35:36 -0500 + indicator-messages (0.3.92-1) unstable; urgency=low * Merge new upstream from Ubuntu. @@ -22,7 +38,6 @@ indicator-messages (0.3.92-0ubuntu2) natty; urgency=low * src/launcher-menu-item.c - Make sure menu entries are displayed for launchers that aren't running (LP: #723873) - -- Ken VanDine <ken.vandine@canonical.com> Wed, 23 Feb 2011 16:06:37 -0500 diff --git a/src/app-menu-item.c b/src/app-menu-item.c index e846914..ef3fbc0 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -52,6 +52,7 @@ struct _AppMenuItemPrivate gchar * type; GAppInfo * appinfo; + GKeyFile * keyfile; gchar * desktop; guint unreadcount; @@ -129,6 +130,7 @@ app_menu_item_init (AppMenuItem *self) priv->server = NULL; priv->type = NULL; priv->appinfo = NULL; + priv->keyfile = NULL; priv->desktop = NULL; priv->unreadcount = 0; @@ -179,6 +181,16 @@ app_menu_item_dispose (GObject *object) priv->client = NULL; } + if (priv->appinfo != NULL) { + g_object_unref(priv->appinfo); + priv->appinfo = NULL; + } + + if (priv->keyfile != NULL) { + g_object_unref(priv->keyfile); + priv->keyfile = NULL; + } + G_OBJECT_CLASS (app_menu_item_parent_class)->dispose (object); } @@ -192,14 +204,12 @@ app_menu_item_finalize (GObject *object) if (priv->type != NULL) { g_free(priv->type); + priv->type = NULL; } if (priv->desktop != NULL) { g_free(priv->desktop); - } - - if (priv->appinfo != NULL) { - g_object_unref(priv->appinfo); + priv->desktop = NULL; } G_OBJECT_CLASS (app_menu_item_parent_class)->finalize (object); @@ -298,7 +308,7 @@ count_cb (IndicateListener * listener, IndicateListenerServer * server, guint va /* Callback for when we ask the server for the path to it's desktop file. We then turn it into an app structure and start sucking data out of it. - Mostly the name. */ + Mostly the name. And the icon. */ static void desktop_cb (IndicateListener * listener, IndicateListenerServer * server, const gchar * value, gpointer data) { @@ -325,6 +335,9 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, const priv->appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(value)); g_return_if_fail(priv->appinfo != NULL); + priv->keyfile = g_key_file_new(); + g_key_file_load_from_file(priv->keyfile, value, G_KEY_FILE_NONE, NULL); + priv->desktop = g_strdup(value); dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); @@ -334,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 { diff --git a/src/default-applications.h b/src/default-applications.h index 0a32e7c..df52b38 100644 --- a/src/default-applications.h +++ b/src/default-applications.h @@ -22,6 +22,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef DEFAULT_APPLICATIONS_H__ #define DEFAULT_APPLICATIONS_H__ 1 +/* Used for override icons in the normal case, but didn't + have a better place to put it. */ +#define ICON_KEY "X-Ayatana-Messaging-Menu-Icon" + const gchar * get_default_name (const gchar * desktop_path); const gchar * get_default_setup (const gchar * desktop_path); const gchar * get_default_icon (const gchar * desktop_path); diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 60880ad..e01806e 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -44,6 +44,7 @@ typedef struct _LauncherMenuItemPrivate LauncherMenuItemPrivate; struct _LauncherMenuItemPrivate { GAppInfo * appinfo; + GKeyFile * keyfile; gchar * desktop; IndicatorDesktopShortcuts * ids; GList * shortcuts; @@ -93,6 +94,7 @@ launcher_menu_item_init (LauncherMenuItem *self) priv->appinfo = NULL; priv->desktop = NULL; + priv->keyfile = NULL; priv->ids = NULL; priv->shortcuts = NULL; @@ -120,6 +122,11 @@ launcher_menu_item_dispose (GObject *object) priv->appinfo = NULL; } + if (priv->keyfile != NULL) { + g_object_unref(priv->keyfile); + priv->keyfile = NULL; + } + if (priv->ids != NULL) { g_object_unref(priv->ids); priv->ids = NULL; @@ -160,6 +167,8 @@ launcher_menu_item_new (const gchar * desktop_file) /* Parse the desktop file we've been given. */ priv->appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(desktop_file)); + priv->keyfile = g_key_file_new(); + g_key_file_load_from_file(priv->keyfile, desktop_file, G_KEY_FILE_NONE, NULL); priv->desktop = g_strdup(desktop_file); /* Set the appropriate values on this menu item based on the @@ -250,18 +259,35 @@ nick_activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data) return; } +/* Figure out the appropriate icon for this launcher */ gchar * launcher_menu_item_get_icon (LauncherMenuItem * appitem) { LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(appitem); + gchar * retval = NULL; - if (priv->appinfo == NULL) { - return NULL; - } else { + /* Check to see if there is a specific icon for the messaging + menu first. */ + if (g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, ICON_KEY, NULL) && retval == NULL) { + GError * error = NULL; + + retval = 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); + } + } + + /* If there's not, or there is an error, we'll use the one + from the application info */ + if (priv->appinfo != NULL && retval == NULL) { GIcon * icon = g_app_info_get_icon(priv->appinfo); - gchar * iconstr = g_icon_to_string(icon); - return iconstr; + retval = g_icon_to_string(icon); } + + return retval; } /* When the menu item is clicked on it tries to launch |