aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application-service-appstore.c57
-rw-r--r--src/indicator-application.c4
-rw-r--r--src/libappindicator/app-indicator.c4
3 files changed, 48 insertions, 17 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index bc99855..d95007c 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -311,6 +311,28 @@ application_removed_cb (DBusGProxy * proxy, gpointer userdata)
return;
}
+static gboolean
+can_add_application (GList *applications, Application *app)
+{
+ if (applications)
+ {
+ GList *l = NULL;
+
+ for (l = applications; l != NULL; l = g_list_next (l))
+ {
+ Application *tmp_app = (Application *)l->data;
+
+ if (g_strcmp0 (tmp_app->dbus_name, app->dbus_name) == 0 &&
+ g_strcmp0 (tmp_app->dbus_object, app->dbus_object) == 0)
+ {
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
/* Change the status of the application. If we're going passive
it removes it from the panel. If we're coming online, then
it add it to the panel. Otherwise it changes the icon. */
@@ -333,8 +355,7 @@ 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);
+ priv->applications = g_list_remove(priv->applications, app);
} else {
/* Figure out which icon we should be using */
gchar * newicon = app->icon;
@@ -344,21 +365,23 @@ apply_status (Application * app, ApplicationStatus status)
/* Determine whether we're already shown or not */
if (app->status == APP_STATUS_PASSIVE) {
- /* Put on panel */
- priv->applications = g_list_prepend(priv->applications, app);
-
- /* TODO: We need to have the position determined better. This
- would involve looking at the name and category and sorting
- it with the other entries. */
-
- g_signal_emit(G_OBJECT(app->appstore),
- signals[APPLICATION_ADDED], 0,
- newicon,
- 0, /* Position */
- app->dbus_name,
- app->menu,
- app->icon_path,
- TRUE);
+ if (can_add_application (priv->applications, app)) {
+ /* Put on panel */
+ priv->applications = g_list_prepend (priv->applications, app);
+
+ /* TODO: We need to have the position determined better. This
+ would involve looking at the name and category and sorting
+ it with the other entries. */
+
+ g_signal_emit(G_OBJECT(app->appstore),
+ signals[APPLICATION_ADDED], 0,
+ newicon,
+ 0, /* Position */
+ app->dbus_name,
+ app->menu,
+ app->icon_path,
+ TRUE);
+ }
} else {
/* Icon update */
gint position = get_position(app);
diff --git a/src/indicator-application.c b/src/indicator-application.c
index c8f3024..ef11179 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -304,6 +304,10 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co
app->entry.label = NULL;
app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject));
+ /* Keep copies of these for ourself, just in case. */
+ g_object_ref(app->entry.image);
+ g_object_ref(app->entry.menu);
+
gtk_widget_show(GTK_WIDGET(app->entry.image));
priv->applications = g_list_insert(priv->applications, app, position);
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;