Merge lp:~ted/libindicate/system-ectomy into lp:libindicate/0.6

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/libindicate/system-ectomy
Merge into: lp:libindicate/0.6
Diff against target: 114 lines
1 file modified
libindicate/listener.c (+3/-53)
To merge this branch: bzr merge lp:~ted/libindicate/system-ectomy
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+14422@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

This removes listening on the system bus. The DBus people hate it. No one uses it. It breaks distcheck on Hudson. And it adds some annoyance to the auth-log sometimes depending on DBus settings. It seems like it needs to go. I still think it's a good idea, perhaps ahead of it's time :)

Revision history for this message
Neil J. Patel (njpatel) wrote :

Definitely before it's time. Approved, with sadness :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicate/listener.c'
2--- libindicate/listener.c 2009-09-14 15:30:59 +0000
3+++ libindicate/listener.c 2009-11-04 15:00:27 +0000
4@@ -194,13 +194,6 @@
5 return;
6 }
7
8- priv->system_bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
9- if (error != NULL) {
10- g_error("Unable to get system bus: %s", error->message);
11- g_error_free(error);
12- return;
13- }
14-
15 /* Set up the DBUS service proxies */
16 priv->dbus_proxy_session = dbus_g_proxy_new_for_name_owner (priv->session_bus,
17 DBUS_SERVICE_DBUS,
18@@ -213,28 +206,12 @@
19 return;
20 }
21
22- priv->dbus_proxy_system = dbus_g_proxy_new_for_name_owner (priv->system_bus,
23- DBUS_SERVICE_DBUS,
24- DBUS_PATH_DBUS,
25- DBUS_INTERFACE_DBUS,
26- &error);
27- if (error != NULL) {
28- g_error("Unable to get dbus proxy on system bus: %s", error->message);
29- g_error_free(error);
30- return;
31- }
32-
33 /* Set up name change signals */
34 dbus_g_proxy_add_signal(priv->dbus_proxy_session, "NameOwnerChanged",
35 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
36 G_TYPE_INVALID);
37 dbus_g_proxy_connect_signal(priv->dbus_proxy_session, "NameOwnerChanged",
38 G_CALLBACK(dbus_owner_change), listener, NULL);
39- dbus_g_proxy_add_signal(priv->dbus_proxy_system, "NameOwnerChanged",
40- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
41- G_TYPE_INVALID);
42- dbus_g_proxy_connect_signal(priv->dbus_proxy_system, "NameOwnerChanged",
43- G_CALLBACK(dbus_owner_change), listener, NULL);
44
45 /* Initialize Data structures */
46 priv->proxies_working = NULL;
47@@ -252,7 +229,6 @@
48
49 /* Build todo list */
50 org_freedesktop_DBus_list_names_async (priv->dbus_proxy_session, build_todo_list_cb, listener);
51- org_freedesktop_DBus_list_names_async (priv->dbus_proxy_system, build_todo_list_cb, listener);
52
53 return;
54 }
55@@ -301,27 +277,12 @@
56 return default_indicate_listener;
57 }
58
59-/* Function to track when people get on and off the bus. It's the
60- same function for both system and session buses so it needs to
61- figure which one it's on. */
62+/* Function to track when people get on and off the bus. */
63 static void
64 dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateListener * listener)
65 {
66 IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
67
68- /* Figure out which bus we are. */
69- DBusGConnection * bus;
70- gchar * bus_name;
71- if (proxy == priv->dbus_proxy_system) {
72- bus = priv->system_bus;
73- bus_name = "system";
74- } else {
75- bus = priv->session_bus;
76- bus_name = "session";
77- }
78-
79- /* g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new); */
80-
81 /* If someone is getting on the bus we add them to the
82 todo list to see if they come up with something interesting */
83 if (prev != NULL && prev[0] == '\0') {
84@@ -333,7 +294,7 @@
85 appropriate lists. */
86 if (new != NULL && new[0] == '\0') {
87 proxy_t searchitem;
88- searchitem.connection = bus;
89+ searchitem.connection = priv->session_bus;
90 searchitem.name = (gchar *)name; /* Droping const, not that it isn't, but to remove the warning */
91
92 GList * proxyt_item;
93@@ -423,20 +384,9 @@
94
95 IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
96
97- DBusGConnection * bus;
98- gchar * bus_name;
99- if (proxy == priv->dbus_proxy_system) {
100- bus = priv->system_bus;
101- bus_name = "system";
102- } else {
103- bus = priv->session_bus;
104- bus_name = "session";
105- }
106- /* g_debug ("Adding on %s bus: %s", bus_name, name); */
107-
108 proxy_todo_t todo;
109 todo.name = g_strdup(name);
110- todo.bus = bus;
111+ todo.bus = priv->session_bus;
112 todo.startup = startup;
113
114 g_array_append_val(priv->proxy_todo, todo);

Subscribers

People subscribed via source and target branches

to all changes: