diff options
author | Ted Gould <ted@gould.cx> | 2010-02-10 10:38:13 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-10 10:38:13 -0600 |
commit | cc9f01437a15cee6d180a4cd2f6c5a32a210e3b8 (patch) | |
tree | 5a98a07f6d50029047166464d17ca47adabb76f9 | |
parent | 8418f3a96bd138f89e392b2604aabf9bbda3d88a (diff) | |
download | libayatana-appindicator-cc9f01437a15cee6d180a4cd2f6c5a32a210e3b8.tar.gz libayatana-appindicator-cc9f01437a15cee6d180a4cd2f6c5a32a210e3b8.tar.bz2 libayatana-appindicator-cc9f01437a15cee6d180a4cd2f6c5a32a210e3b8.zip |
Moving the clean_id code to get set when we set the ID and checking for it when building the menu.
-rw-r--r-- | src/libappindicator/app-indicator.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index cfc6377..0ca68d4 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -454,6 +454,14 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu priv->id = g_strdup (g_value_get_string (value)); + priv->clean_id = g_strdup(priv->id); + gchar * cleaner; + for (cleaner = priv->clean_id; *cleaner != '\0'; cleaner++) { + if (!g_ascii_isalnum(*cleaner)) { + *cleaner = '_'; + } + } + check_connect (self); break; @@ -585,14 +593,6 @@ check_connect (AppIndicator *self) if (priv->icon_name == NULL) return; if (priv->id == NULL) return; - priv->clean_id = g_strdup(priv->id); - gchar * cleaner; - for (cleaner = priv->clean_id; *cleaner != '\0'; cleaner++) { - if (!g_ascii_isalnum(*cleaner)) { - *cleaner = '_'; - } - } - gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s", priv->clean_id); dbus_g_connection_register_g_object(priv->connection, path, @@ -1262,6 +1262,7 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) g_return_if_fail (IS_APP_INDICATOR (self)); g_return_if_fail (GTK_IS_MENU (menu)); + g_return_if_fail (self->priv->clean_id != NULL); priv = self->priv; |