Merge lp:~ted/indicator-application/every-indicator-is-important into lp:indicator-application/0.4

Proposed by Ted Gould
Status: Merged
Merged at revision: 157
Proposed branch: lp:~ted/indicator-application/every-indicator-is-important
Merge into: lp:indicator-application/0.4
Diff against target: 75 lines (+19/-1)
1 file modified
src/application-service-appstore.c (+19/-1)
To merge this branch: bzr merge lp:~ted/indicator-application/every-indicator-is-important
Reviewer Review Type Date Requested Status
Cody Russell (community) Approve
Review via email: mp+34827@code.launchpad.net

Description of the change

Patch to make it so when an app indicator registers, we see if we have it. The PK one registers each time, but keeps the old one around as well. Which means we get multiple structures representing it.

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/application-service-appstore.c'
2--- src/application-service-appstore.c 2010-08-20 16:54:25 +0000
3+++ src/application-service-appstore.c 2010-09-08 00:41:38 +0000
4@@ -72,6 +72,8 @@
5 VISIBLE_STATE_SHOWN
6 } visible_state_t;
7
8+#define STATE2STRING(x) ((x) == VISIBLE_STATE_HIDDEN ? "hidden" : "visible")
9+
10 typedef struct _Approver Approver;
11 struct _Approver {
12 DBusGProxy * proxy;
13@@ -129,6 +131,7 @@
14 static void approver_free (gpointer papprover, gpointer user_data);
15 static void check_with_new_approver (gpointer papp, gpointer papprove);
16 static void check_with_old_approver (gpointer papprove, gpointer papp);
17+static Application * find_application (ApplicationServiceAppstore * appstore, const gchar * address, const gchar * object);
18
19 G_DEFINE_TYPE (ApplicationServiceAppstore, application_service_appstore, G_TYPE_OBJECT);
20
21@@ -485,6 +488,7 @@
22 }
23
24 if (lapp == NULL) {
25+ g_warning("Unable to find position for app '%s'", app->id);
26 return -1;
27 }
28
29@@ -497,6 +501,7 @@
30 application_free (Application * app)
31 {
32 if (app == NULL) return;
33+ g_debug("Application free '%s'", app->id);
34
35 /* Handle the case where this could be called by unref'ing one of
36 the proxy objects. */
37@@ -554,6 +559,7 @@
38 application_removed_cb (DBusGProxy * proxy, gpointer userdata)
39 {
40 Application * app = (Application *)userdata;
41+ g_debug("Application proxy destroyed '%s'", app->id);
42
43 /* Remove from the panel */
44 app->status = APP_INDICATOR_STATUS_PASSIVE;
45@@ -600,6 +606,8 @@
46 return;
47 }
48
49+ g_debug("Changing app '%s' state from %s to %s", app->id, STATE2STRING(app->visible_state), STATE2STRING(goal_state));
50+
51 /* This means we're going off line */
52 if (goal_state == VISIBLE_STATE_HIDDEN) {
53 gint position = get_position(app);
54@@ -848,10 +856,20 @@
55 g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0');
56 g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0');
57 ApplicationServiceAppstorePrivate * priv = appstore->priv;
58+ Application * app = find_application(appstore, dbus_name, dbus_object);
59+
60+ if (app != NULL) {
61+ g_warning("Application already exists! Rerequesting properties.");
62+ org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,
63+ NOTIFICATION_ITEM_DBUS_IFACE,
64+ get_all_properties_cb,
65+ app);
66+ return;
67+ }
68
69 /* Build the application entry. This will be carried
70 along until we're sure we've got everything. */
71- Application * app = g_new0(Application, 1);
72+ app = g_new0(Application, 1);
73
74 app->validated = FALSE;
75 app->dbus_name = g_strdup(dbus_name);

Subscribers

People subscribed via source and target branches