From abd499aaeb280ef2ab24f4e392484ecd4d8bb7a2 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Thu, 14 Jan 2010 20:27:28 -0600 Subject: Only add the Application if it doesn't already exist in the appstore. --- src/application-service-appstore.c | 12 ++++++++++-- src/libappindicator/app-indicator.c | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index fa1b9d2..c896beb 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -333,8 +333,6 @@ apply_status (Application * app, ApplicationStatus status) g_signal_emit(G_OBJECT(appstore), signals[APPLICATION_REMOVED], 0, position, TRUE); - - priv->applications = g_list_remove(priv->applications, app); } else { /* Figure out which icon we should be using */ gchar * newicon = app->icon; @@ -511,6 +509,16 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0'); ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + GList *l = NULL; + for (l = priv->applications; l != NULL; l = g_list_next (l)) { + Application *tmp_app = (Application *)l->data; + + if (g_strcmp0 (tmp_app->dbus_name, dbus_name) == 0 && + g_strcmp0 (tmp_app->dbus_object, dbus_object) == 0) { + return; + } + } + /* Build the application entry. This will be carried along until we're sure we've got everything. */ Application * app = g_new0(Application, 1); diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 6c969c2..7fabef9 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -370,6 +370,10 @@ app_indicator_dispose (GObject *object) priv->menu = NULL; } + if (priv->menuservice != NULL) { + g_object_unref (priv->menuservice); + } + if (priv->dbus_proxy != NULL) { g_object_unref(G_OBJECT(priv->dbus_proxy)); priv->dbus_proxy = NULL; -- cgit v1.2.3