diff src/audacious/pluginenum.c @ 2733:cf080b11c3fa trunk

[svn] Implemented more of the stubs in audctrl; Added more methods to objects.xml with implementations in dbus.c. I'm still trying to get plugins working with libaudclient.
author magma
date Fri, 11 May 2007 11:52:56 -0700
parents c35913222440
children 637359219e10
line wrap: on
line diff
--- a/src/audacious/pluginenum.c	Fri May 11 08:59:22 2007 -0700
+++ b/src/audacious/pluginenum.c	Fri May 11 11:52:56 2007 -0700
@@ -38,6 +38,7 @@
 
 
 #ifdef USE_DBUS
+#include "dbus.h"
 #include "dbus-service.h"
 #endif
 
@@ -62,6 +63,11 @@
 GHashTable *plugin_matrix = NULL;
 GList *lowlevel_list = NULL;
 
+#ifdef USE_DBUS
+static DBusGProxy *dbus_proxy = NULL;
+static DBusGConnection *connection = NULL;
+#endif
+
 extern GList *vfs_transports;
 
 static gint
@@ -179,7 +185,7 @@
     GeneralPlugin *p = GENERAL_PLUGIN(plugin);
     p->xmms_session = -1;
 #ifdef USE_DBUS
-    p->dbus_proxy = audacious_get_dbus_proxy();
+    p->dbus_proxy = dbus_proxy;
 #endif
     gp_data.general_list = g_list_append(gp_data.general_list, p);
 }
@@ -190,7 +196,7 @@
     VisPlugin *p = VIS_PLUGIN(plugin);
     p->xmms_session = -1;
 #ifdef USE_DBUS
-    p->dbus_proxy = audacious_get_dbus_proxy();
+    p->dbus_proxy = dbus_proxy;
 #endif
     p->disable_plugin = vis_disable_plugin;
     vp_data.vis_list = g_list_append(vp_data.vis_list, p);
@@ -286,6 +292,23 @@
     LowlevelPlugin *lp;
     gint dirsel = 0, i = 0;
 
+#ifdef USE_DBUS
+	GError *error = NULL;
+	connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+
+	if (connection == NULL)
+	{
+		g_printerr("audtool: D-Bus error: %s", error->message);
+		g_error_free(error);
+
+		exit(EXIT_FAILURE);
+	}
+
+	dbus_proxy = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,
+                                           AUDACIOUS_DBUS_PATH,
+                                           AUDACIOUS_DBUS_INTERFACE);
+#endif
+
     if (!g_module_supported()) {
         report_error("Module loading not supported! Plugins will not be loaded.\n");
         return;