← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/libindicate/system-ectomy into lp:libindicate

 

Ted Gould has proposed merging lp:~ted/libindicate/system-ectomy into lp:libindicate.

    Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)


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 :)
-- 
https://code.launchpad.net/~ted/libindicate/system-ectomy/+merge/14422
Your team ayatana-commits is subscribed to branch lp:libindicate.
=== modified file 'libindicate/listener.c'
--- libindicate/listener.c	2009-09-14 15:30:59 +0000
+++ libindicate/listener.c	2009-11-04 15:00:27 +0000
@@ -194,13 +194,6 @@
 		return;
 	}
 
-	priv->system_bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
-	if (error != NULL) {
-		g_error("Unable to get system bus: %s", error->message);
-		g_error_free(error);
-		return;
-	}
-
 	/* Set up the DBUS service proxies */
 	priv->dbus_proxy_session = dbus_g_proxy_new_for_name_owner (priv->session_bus,
 	                                                                DBUS_SERVICE_DBUS,
@@ -213,28 +206,12 @@
 		return;
 	}
 
-	priv->dbus_proxy_system = dbus_g_proxy_new_for_name_owner (priv->system_bus,
-	                                                               DBUS_SERVICE_DBUS,
-	                                                               DBUS_PATH_DBUS,
-	                                                               DBUS_INTERFACE_DBUS,
-	                                                               &error);
-	if (error != NULL) {
-		g_error("Unable to get dbus proxy on system bus: %s", error->message);
-		g_error_free(error);
-		return;
-	}
-
 	/* Set up name change signals */
 	dbus_g_proxy_add_signal(priv->dbus_proxy_session, "NameOwnerChanged",
 	                        G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
 	                        G_TYPE_INVALID);
 	dbus_g_proxy_connect_signal(priv->dbus_proxy_session, "NameOwnerChanged",
 	                            G_CALLBACK(dbus_owner_change), listener, NULL);
-	dbus_g_proxy_add_signal(priv->dbus_proxy_system, "NameOwnerChanged",
-	                        G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
-	                        G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal(priv->dbus_proxy_system, "NameOwnerChanged",
-	                            G_CALLBACK(dbus_owner_change), listener, NULL);
 
 	/* Initialize Data structures */
 	priv->proxies_working = NULL;
@@ -252,7 +229,6 @@
 
 	/* Build todo list */
 	org_freedesktop_DBus_list_names_async (priv->dbus_proxy_session, build_todo_list_cb, listener);
-	org_freedesktop_DBus_list_names_async (priv->dbus_proxy_system, build_todo_list_cb, listener);
 
 	return;
 }
@@ -301,27 +277,12 @@
 	return default_indicate_listener;
 }
 
-/* Function to track when people get on and off the bus.  It's the
-   same function for both system and session buses so it needs to
-   figure which one it's on. */
+/* Function to track when people get on and off the bus. */
 static void
 dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateListener * listener)
 {
 	IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
 
-	/* Figure out which bus we are. */
-	DBusGConnection * bus;
-	gchar * bus_name;
-	if (proxy == priv->dbus_proxy_system) {
-		bus = priv->system_bus;
-		bus_name = "system";
-	} else {
-		bus = priv->session_bus;
-		bus_name = "session";
-	}
-
-	/* g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new); */
-
 	/* If someone is getting on the bus we add them to the
 	   todo list to see if they come up with something interesting */
 	if (prev != NULL && prev[0] == '\0') {
@@ -333,7 +294,7 @@
 	   appropriate lists. */
 	if (new != NULL && new[0] == '\0') {
 		proxy_t searchitem;
-		searchitem.connection = bus;
+		searchitem.connection = priv->session_bus;
 		searchitem.name = (gchar *)name; /* Droping const, not that it isn't, but to remove the warning */
 
 		GList * proxyt_item;
@@ -423,20 +384,9 @@
 
 	IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
 
-	DBusGConnection * bus;
-	gchar * bus_name;
-	if (proxy == priv->dbus_proxy_system) {
-		bus = priv->system_bus;
-		bus_name = "system";
-	} else {
-		bus = priv->session_bus;
-		bus_name = "session";
-	}
-	/* g_debug ("Adding on %s bus: %s", bus_name, name); */
-
 	proxy_todo_t todo;
 	todo.name = g_strdup(name);
-	todo.bus  = bus;
+	todo.bus  = priv->session_bus;
 	todo.startup = startup;
 
 	g_array_append_val(priv->proxy_todo, todo);


Follow ups