changeset 2731:f4a5f8fa3836 trunk

[svn] Added stubs in audctrl.c for the unimplemented functions defined in audctrl.h. Fixed audtool by moving all the DBus methods defined in objects.xml to a common interface; this will be decentralized for MPRIS. Modified the Makefile so that libaudclient is built after audacious to eliminates a build warning.
author magma
date Fri, 11 May 2007 01:42:32 -0700
parents 596abc2be8f0
children 2227e8955391
files ChangeLog src/Makefile src/audacious/build_stamp.c src/audacious/objects.xml src/audtool/audtool.c src/audtool/audtool.h src/libaudclient/audctrl.c
diffstat 7 files changed, 320 insertions(+), 221 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 10 16:59:22 2007 -0700
+++ b/ChangeLog	Fri May 11 01:42:32 2007 -0700
@@ -1,3 +1,12 @@
+2007-05-10 23:59:22 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [4486]
+  - build fix.
+  
+  trunk/src/Makefile           |    2 +-
+  trunk/src/audacious/Makefile |    2 +-
+  2 files changed, 2 insertions(+), 2 deletions(-)
+
+
 2007-05-10 21:13:20 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4484]
   - fix ABI
--- a/src/Makefile	Thu May 10 16:59:22 2007 -0700
+++ b/src/Makefile	Fri May 11 01:42:32 2007 -0700
@@ -3,7 +3,7 @@
 include ../mk/rules.mk
 include ../mk/init.mk
 
-SUBDIRS = $(INTL_OBJECTIVE) $(SUBDIR_GUESS) $(LIBAUDCLIENT_OBJECTIVE) audacious libid3tag
+SUBDIRS = $(INTL_OBJECTIVE) $(SUBDIR_GUESS) audacious $(LIBAUDCLIENT_OBJECTIVE) libid3tag
 
 include ../mk/objective.mk
 
--- a/src/audacious/build_stamp.c	Thu May 10 16:59:22 2007 -0700
+++ b/src/audacious/build_stamp.c	Fri May 11 01:42:32 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070510-4484";
+const gchar *svn_stamp = "20070510-4486";
--- a/src/audacious/objects.xml	Thu May 10 16:59:22 2007 -0700
+++ b/src/audacious/objects.xml	Fri May 11 01:42:32 2007 -0700
@@ -92,15 +92,13 @@
 
 <node name="/">
     <!-- Audacious General Information -->
-    <interface name="org.atheme.audacious.general">
+    <interface name="org.atheme.audacious">
         <!-- Audacious version -->
         <method name="Version">
             <arg type="s" direction="out" name="version"/>
         </method>
-    </interface>
 
-    <!-- Playback Information/Manipulation -->
-    <interface name="org.atheme.audacious.playback">
+        <!-- Playback Information/Manipulation -->
         <!-- Begin or resume playback -->
         <method name="Play">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
@@ -179,10 +177,8 @@
             <!-- Balance between left and right channels -->
             <arg type="i" direction="out" name="balance"/>
         </method>
-    </interface>
 
-    <!-- Playlist Information/Manipulation -->
-    <interface name="org.atheme.audacious.playlist">
+        <!-- Playlist Information/Manipulation -->
         <!-- Playlist position -->
         <method name="Position">
             <!-- Return position of current song in current playlist -->
--- a/src/audtool/audtool.c	Thu May 10 16:59:22 2007 -0700
+++ b/src/audtool/audtool.c	Fri May 11 01:42:32 2007 -0700
@@ -95,29 +95,30 @@
 	{NULL, NULL, NULL}
 };
 
-DBusGProxy *audtool_connect(gchar *interface)
+static DBusGProxy *dbus_proxy = NULL;
+static DBusGConnection *connection = NULL;
+
+static void audtool_connect()
 {
 	GError *error = NULL;
-	DBusGConnection *connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+	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);
+		g_error_free(error);
 
 		exit(EXIT_FAILURE);
 	}
 
-	return dbus_g_proxy_new_for_name(connection,
-		"org.atheme.audacious", "/org/atheme/audacious", 
-		interface);
+	dbus_proxy = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,
+                                           AUDACIOUS_DBUS_PATH,
+                                           AUDACIOUS_DBUS_INTERFACE);
 }
 
 gint main(gint argc, gchar **argv)
 {
 	gint i;
-	DBusGProxy *session;
-	GError *error = NULL;
 
 	setlocale(LC_CTYPE, "");
 	g_type_init();
@@ -130,6 +131,8 @@
 		exit(-2);
 	}
 
+    audtool_connect();
+
 	for (i = 0; handlers[i].name != NULL; i++)
 	{
 		if ((!g_strcasecmp(handlers[i].name, argv[1]) ||
@@ -151,9 +154,8 @@
 
 void get_current_song(gint argc, gchar **argv)
 {
-	DBusGProxy *ses = audtool_connect("org.atheme.audacious.playlist");
-	gint playpos = audacious_remote_get_playlist_pos(ses);
-	gchar *song = audacious_remote_get_playlist_title(ses, playpos);
+	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
+	gchar *song = audacious_remote_get_playlist_title(dbus_proxy, playpos);
 
 	if (!song)
 	{
@@ -166,79 +168,65 @@
 
 void get_current_song_filename(gint argc, gchar **argv)
 {
-#if 0
-	gint playpos = audacious_remote_get_playlist_pos(session);
+	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
 
-	g_print("%s\n", audacious_remote_get_playlist_file(session, playpos));
-#endif
+	g_print("%s\n", audacious_remote_get_playlist_file(dbus_proxy, playpos));
 }
 
 void get_current_song_output_length(gint argc, gchar **argv)
 {
-#if 0
-	gint frames = audacious_remote_get_output_time(session);
+	gint frames = audacious_remote_get_output_time(dbus_proxy);
 	gint length = frames / 1000;
 
 	g_print("%d:%.2d\n", length / 60, length % 60);
-#endif
 }
 
 void get_current_song_output_length_seconds(gint argc, gchar **argv)
 {
-#if 0
-	gint frames = audacious_remote_get_output_time(session);
+	gint frames = audacious_remote_get_output_time(dbus_proxy);
 	gint length = frames / 1000;
 
 	g_print("%d\n", length);
-#endif
 }
 
 void get_current_song_output_length_frames(gint argc, gchar **argv)
 {
-#if 0
-	gint frames = audacious_remote_get_output_time(session);
+	gint frames = audacious_remote_get_output_time(dbus_proxy);
 
 	g_print("%d\n", frames);
-#endif
 }
 
 void get_current_song_length(gint argc, gchar **argv)
 {
-#if 0
-	gint playpos = audacious_remote_get_playlist_pos(session);
-	gint frames = audacious_remote_get_playlist_time(session, playpos);
+	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
+	gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos);
 	gint length = frames / 1000;
 
 	g_print("%d:%.2d\n", length / 60, length % 60);
-#endif
 }
 
 void get_current_song_length_seconds(gint argc, gchar **argv)
 {
-#if 0
-	gint playpos = audacious_remote_get_playlist_pos(session);
-	gint frames = audacious_remote_get_playlist_time(session, playpos);
+	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
+	gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos);
 	gint length = frames / 1000;
 
 	g_print("%d\n", length);
-#endif
 }
 
 void get_current_song_length_frames(gint argc, gchar **argv)
 {
-#if 0
-	gint playpos = audacious_remote_get_playlist_pos(session);
-	gint frames = audacious_remote_get_playlist_time(session, playpos);
+	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
+	gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos);
 
 	g_print("%d\n", frames);
-#endif
 }
 
 void get_current_song_bitrate(gint argc, gchar **argv)
 {
 	gint rate, freq, nch;
 
-//	audacious_remote_get_info(session, &rate, &freq, &nch);
+	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);
 
 	g_print("%d\n", rate);
 }
@@ -247,7 +235,7 @@
 {
 	gint rate, freq, nch;
 
-//	audacious_remote_get_info(session, &rate, &freq, &nch);
+	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);
 
 	g_print("%d\n", rate / 1000);
 }
@@ -256,7 +244,7 @@
 {
 	gint rate, freq, nch;
 
-//	audacious_remote_get_info(session, &rate, &freq, &nch);
+	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);
 
 	g_print("%d\n", freq);
 }
@@ -265,7 +253,7 @@
 {
 	gint rate, freq, nch;
 
-//	audacious_remote_get_info(session, &rate, &freq, &nch);
+	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);
 
 	g_print("%0.1f\n", (gfloat) freq / 1000);
 }
@@ -274,14 +262,13 @@
 {
 	gint rate, freq, nch;
 
-//	audacious_remote_get_info(session, &rate, &freq, &nch);
+	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);
 
 	g_print("%d\n", nch);
 }
 
 void get_current_song_tuple_field_data(gint argc, gchar **argv)
 {
-#if 0
 	gpointer data;
 
 	if (argc < 3)
@@ -295,7 +282,7 @@
 		return;
 	}
 
-	if (!(data = audacious_get_tuple_field_data(session, argv[2], audacious_remote_get_playlist_pos(session))))
+	if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[2], audacious_remote_get_playlist_pos(dbus_proxy))))
 	{
 		return;
 	}
@@ -310,61 +297,50 @@
 	}
 
 	g_print("%s\n", (gchar *)data);
-#endif
 }
 
 void playlist_reverse(gint argc, gchar **argv)
 {
-//	audacious_remote_playlist_prev(session);
+	audacious_remote_playlist_prev(dbus_proxy);
 }
 
 void playlist_advance(gint argc, gchar **argv)
 {
-//	audacious_remote_playlist_next(session);
+	audacious_remote_playlist_next(dbus_proxy);
 }
 
 void playback_play(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	audacious_remote_play(session);
+	audacious_remote_play(dbus_proxy);
 }
 
 void playback_pause(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	audacious_remote_pause(session);
+	audacious_remote_pause(dbus_proxy);
 }
 
 void playback_playpause(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	if (audacious_remote_is_playing(session))
+	if (audacious_remote_is_playing(dbus_proxy))
 	{
-		audacious_remote_pause(session);
+		audacious_remote_pause(dbus_proxy);
 	}
 	else
 	{
-		audacious_remote_play(session);
+		audacious_remote_play(dbus_proxy);
 	}
 }
 
 void playback_stop(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	audacious_remote_stop(session);
+	audacious_remote_stop(dbus_proxy);
 }
 
 void playback_playing(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	if (!audacious_remote_is_paused(session))
+	if (!audacious_remote_is_paused(dbus_proxy))
 	{
-		exit(!audacious_remote_is_playing(session));
+		exit(!audacious_remote_is_playing(dbus_proxy));
 	}
 	else
 	{
@@ -374,16 +350,12 @@
 
 void playback_paused(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	exit(!audacious_remote_is_paused(session));
+	exit(!audacious_remote_is_paused(dbus_proxy));
 }
 
 void playback_stopped(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	if (!audacious_remote_is_playing(session) && !audacious_remote_is_paused(session))
+	if (!audacious_remote_is_playing(dbus_proxy) && !audacious_remote_is_paused(dbus_proxy))
 	{
 		exit(0);
 	}
@@ -395,14 +367,12 @@
 
 void playback_status(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
-	if (audacious_remote_is_paused(session))
+	if (audacious_remote_is_paused(dbus_proxy))
 	{
 		g_print("paused\n");
 		return;
 	}
-	else if (audacious_remote_is_playing(session))
+	else if (audacious_remote_is_playing(dbus_proxy))
 	{
 		g_print("playing\n");
 		return;
@@ -416,8 +386,6 @@
 
 void playback_seek(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
-
 	if (argc < 3)
 	{
 		g_print("%s: invalid parameters for playback-seek.\n", argv[0]);
@@ -425,12 +393,11 @@
 		return;
 	}
 
-	audacious_remote_jump_to_time(session, atoi(argv[2]) * 1000);
+	audacious_remote_jump_to_time(dbus_proxy, atoi(argv[2]) * 1000);
 }
 
 void playback_seek_relative(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
 	gint oldtime, newtime, diff;
 
 	if (argc < 3)
@@ -440,17 +407,15 @@
 		return;
 	}
 
-	oldtime = audacious_remote_get_output_time(session);
+	oldtime = audacious_remote_get_output_time(dbus_proxy);
 	diff = atoi(argv[2]) * 1000;
 	newtime = oldtime + diff;
 
-	audacious_remote_jump_to_time(session, newtime);
+	audacious_remote_jump_to_time(dbus_proxy, newtime);
 }
 
 void playlist_add_url_string(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
-
 	if (argc < 3)
 	{
 		g_print("%s: invalid parameters for playlist-addurl.\n", argv[0]);
@@ -458,12 +423,11 @@
 		return;
 	}
 
-	audacious_remote_playlist_add_url_string(session, argv[2]);
+	audacious_remote_playlist_add_url_string(dbus_proxy, argv[2]);
 }
 
 void playlist_delete(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
 	gint playpos;
 
 	if (argc < 3)
@@ -475,28 +439,26 @@
 
 	playpos = atoi(argv[2]);
 
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session))
+	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], playpos);
 		return;
 	}
 
-	audacious_remote_playlist_delete(session, playpos - 1);
+	audacious_remote_playlist_delete(dbus_proxy, playpos - 1);
 }
 
 void playlist_length(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
 	gint i;
 
-	i = audacious_remote_get_playlist_length(session);
+	i = audacious_remote_get_playlist_length(dbus_proxy);
 
 	g_print("%d\n", i);
 }
 
 void playlist_song(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
 	gint playpos;
 	gchar *song;
 
@@ -509,13 +471,13 @@
 
 	playpos = atoi(argv[2]);
 
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session))
+	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], playpos);
 		return;
 	}
 
-//	song = audacious_remote_get_playlist_title(session, playpos - 1);
+	song = audacious_remote_get_playlist_title(dbus_proxy, playpos - 1);
 
 	g_print("%s\n", song);
 }
@@ -523,7 +485,6 @@
 
 void playlist_song_length(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
 	gint playpos, frames, length;
 
 	if (argc < 3)
@@ -535,21 +496,20 @@
 
 	playpos = atoi(argv[2]);
 
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session))
+	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], playpos);
 		return;
 	}
 
-//	frames = audacious_remote_get_playlist_time(session, playpos - 1);
-//	length = frames / 1000;
+	frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1);
+	length = frames / 1000;
 
 	g_print("%d:%.2d\n", length / 60, length % 60);
 }
 
 void playlist_song_length_seconds(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
 	gint playpos, frames, length;
 
 	if (argc < 3)
@@ -561,13 +521,13 @@
 
 	playpos = atoi(argv[2]);
 
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session))
+	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], playpos);
 		return;
 	}
 
-//	frames = audacious_remote_get_playlist_time(session, playpos - 1);
+	frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1);
 	length = frames / 1000;
 
 	g_print("%d\n", length);
@@ -575,7 +535,6 @@
 
 void playlist_song_length_frames(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playlist");
 	gint playpos, frames;
 
 	if (argc < 3)
@@ -587,26 +546,25 @@
 
 	playpos = atoi(argv[2]);
 
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(session))
+	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], playpos);
 		return;
 	}
 
-//	frames = audacious_remote_get_playlist_time(session, playpos - 1);
+	frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1);
 
 	g_print("%d\n", frames);
 }
 
 void playlist_display(gint argc, gchar **argv)
 {
-#if 0
 	gint i, ii, frames, length, total;
 	gchar *songname;
 	gchar *fmt = NULL, *p;
 	gint column;
 
-	i = audacious_remote_get_playlist_length(session);
+	i = audacious_remote_get_playlist_length(dbus_proxy);
 
 	g_print("%d tracks.\n", i);
 
@@ -614,8 +572,8 @@
 
 	for (ii = 0; ii < i; ii++)
 	{
-		songname = audacious_remote_get_playlist_title(session, ii);
-		frames = audacious_remote_get_playlist_time(session, ii);
+		songname = audacious_remote_get_playlist_title(dbus_proxy, ii);
+		frames = audacious_remote_get_playlist_time(dbus_proxy, ii);
 		length = frames / 1000;
 		total += length;
 
@@ -647,22 +605,19 @@
 	}
 
 	g_print("Total length: %d:%.2d\n", total / 60, total % 60);
-#endif
 }
 
 void playlist_position(gint argc, gchar **argv)
 {
-	DBusGProxy *ses = audtool_connect("org.atheme.audacious.playlist");
 	gint i;
 
-	i = audacious_remote_get_playlist_pos(ses);
+	i = audacious_remote_get_playlist_pos(dbus_proxy);
 
 	g_print("%d\n", i + 1);
 }
 
 void playlist_song_filename(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 
 	if (argc < 3)
@@ -674,19 +629,17 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	g_print("%s\n", audacious_remote_get_playlist_file(session, i - 1));
-#endif
+	g_print("%s\n", audacious_remote_get_playlist_file(dbus_proxy, i - 1));
 }
 
 void playlist_jump(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 
 	if (argc < 3)
@@ -698,25 +651,23 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	audacious_remote_set_playlist_pos(session, i - 1);
-#endif
+	audacious_remote_set_playlist_pos(dbus_proxy, i - 1);
 }
 
 void playlist_clear(gint argc, gchar **argv)
 {
-//	audacious_remote_playlist_clear(session);
+	audacious_remote_playlist_clear(dbus_proxy);
 }
 
 void playlist_repeat_status(gint argc, gchar **argv)
 {
-#if 0
-	if (audacious_remote_is_repeat(session))
+	if (audacious_remote_is_repeat(dbus_proxy))
 	{
 		g_print("on\n");
 		return;
@@ -726,18 +677,16 @@
 		g_print("off\n");
 		return;
 	}
-#endif
 }
 
 void playlist_repeat_toggle(gint argc, gchar **argv)
 {
-//	audacious_remote_toggle_repeat(session);
+	audacious_remote_toggle_repeat(dbus_proxy);
 }
 
 void playlist_shuffle_status(gint argc, gchar **argv)
 {
-#if 0
-	if (audacious_remote_is_shuffle(session))
+	if (audacious_remote_is_shuffle(dbus_proxy))
 	{
 		g_print("on\n");
 		return;
@@ -747,17 +696,15 @@
 		g_print("off\n");
 		return;
 	}
-#endif
 }
 
 void playlist_shuffle_toggle(gint argc, gchar **argv)
 {
-//	audacious_remote_toggle_shuffle(session);
+	audacious_remote_toggle_shuffle(dbus_proxy);
 }
 
 void playlist_tuple_field_data(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 	gpointer data;
 
@@ -774,13 +721,13 @@
 
 	i = atoi(argv[3]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	if (!(data = audacious_get_tuple_field_data(session, argv[2], i - 1)))
+	if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[2], i - 1)))
 	{
 		return;
 	}
@@ -795,12 +742,10 @@
 	}
 
 	g_print("%s\n", (gchar *)data);
-#endif
 }
 
 void playqueue_add(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 
 	if (argc < 3)
@@ -812,20 +757,18 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	if (!(audacious_remote_playqueue_is_queued(session, i - 1)))
-		audacious_remote_playqueue_add(session, i - 1);
-#endif
+	if (!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)))
+		audacious_remote_playqueue_add(dbus_proxy, i - 1);
 }
 
 void playqueue_remove(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 
 	if (argc < 3)
@@ -837,20 +780,18 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	if (audacious_remote_playqueue_is_queued(session, i - 1))
-		audacious_remote_playqueue_remove(session, i - 1);
-#endif
+	if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1))
+		audacious_remote_playqueue_remove(dbus_proxy, i - 1);
 }
 
 void playqueue_is_queued(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 
 	if (argc < 3)
@@ -862,19 +803,17 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	exit(!(audacious_remote_playqueue_is_queued(session, i - 1)));
-#endif
+	exit(!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)));
 }
 
 void playqueue_get_position(gint argc, gchar **argv)
 {
-#if 0
 	gint i, pos;
 
 	if (argc < 3)
@@ -886,24 +825,22 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playlist_length(session))
+	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	pos = audacious_remote_get_playqueue_position(session, i - 1) + 1;
+	pos = audacious_remote_get_playqueue_position(dbus_proxy, i - 1) + 1;
 
 	if (pos < 1)
 		return;
 
 	g_print("%d\n", pos);
-#endif
 }
 
 void playqueue_get_qposition(gint argc, gchar **argv)
 {
-#if 0
 	gint i, pos;
 
 	if (argc < 3)
@@ -915,30 +852,28 @@
 
 	i = atoi(argv[2]);
 
-	if (i < 1 || i > audacious_remote_get_playqueue_length(session))
+	if (i < 1 || i > audacious_remote_get_playqueue_length(dbus_proxy))
 	{
 		g_print("%s: invalid playlist position %d\n", argv[0], i);
 		return;
 	}
 
-	pos = audacious_remote_get_playqueue_queue_position(session, i - 1) + 1;
+	pos = audacious_remote_get_playqueue_queue_position(dbus_proxy, i - 1) + 1;
 
 	if (pos < 1)
 		return;
 
 	g_print("%d\n", pos);
-#endif
 }
 
 void playqueue_display(gint argc, gchar **argv)
 {
-#if 0
 	gint i, ii, position, frames, length, total;
 	gchar *songname;
 	gchar *fmt = NULL, *p;
 	gint column;
 	
-	i = audacious_remote_get_playqueue_length(session);
+	i = audacious_remote_get_playqueue_length(dbus_proxy);
 
 	g_print("%d queued tracks.\n", i);
 
@@ -946,9 +881,9 @@
 
 	for (ii = 0; ii < i; ii++)
 	{
-		position = audacious_remote_get_playqueue_queue_position(session, ii);
-		songname = audacious_remote_get_playlist_title(session, position);
-		frames = audacious_remote_get_playlist_time(session, position);
+		position = audacious_remote_get_playqueue_queue_position(dbus_proxy, ii);
+		songname = audacious_remote_get_playlist_title(dbus_proxy, position);
+		frames = audacious_remote_get_playlist_time(dbus_proxy, position);
 		length = frames / 1000;
 		total += length;
 
@@ -979,38 +914,33 @@
 	}
 
 	g_print("Total length: %d:%.2d\n", total / 60, total % 60);
-#endif
 }
 
 void playqueue_length(gint argc, gchar **argv)
 {
-#if 0
 	gint i;
 
-	i = audacious_remote_get_playqueue_length(session);
+	i = audacious_remote_get_playqueue_length(dbus_proxy);
 
 	g_print("%d\n", i);
-#endif
 }
 
 void playqueue_clear(gint argc, gchar **argv)
 {
-//	audacious_remote_playqueue_clear(session);
+	audacious_remote_playqueue_clear(dbus_proxy);
 }
 
 void get_volume(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
 	gint i;
 
-	i = audacious_remote_get_main_volume(session);
+	i = audacious_remote_get_main_volume(dbus_proxy);
 
 	g_print("%d\n", i);
 }
 
 void set_volume(gint argc, gchar **argv)
 {
-	DBusGProxy *session = audtool_connect("org.atheme.audacious.playback");
 	gint i, current_volume;
 
 	if (argc < 3)
@@ -1020,7 +950,7 @@
 		return;
 	}
 
-	current_volume = audacious_remote_get_main_volume(session);
+	current_volume = audacious_remote_get_main_volume(dbus_proxy);
 	switch (argv[2][0]) 
 	{
 		case '+':
@@ -1032,7 +962,7 @@
 			break;
 	}
 
-	audacious_remote_set_main_volume(session, i);
+	audacious_remote_set_main_volume(dbus_proxy, i);
 }
 
 void mainwin_show(gint argc, gchar **argv)
@@ -1040,11 +970,11 @@
 	if (argc > 2)
 	{
 		if (!strncmp(argv[2],"on",2)) {
-//			audacious_remote_main_win_toggle(session, TRUE);
+			audacious_remote_main_win_toggle(dbus_proxy, TRUE);
 			return;
 		}
 		else if (!strncmp(argv[2],"off",3)) {
-//			audacious_remote_main_win_toggle(session, FALSE);
+			audacious_remote_main_win_toggle(dbus_proxy, FALSE);
 			return;
 		}
 	}
@@ -1057,11 +987,11 @@
 	if (argc > 2)
 	{
 		if (!strncmp(argv[2],"on",2)) {
-//			audacious_remote_pl_win_toggle(session, TRUE);
+			audacious_remote_pl_win_toggle(dbus_proxy, TRUE);
 			return;
 		}
 		else if (!strncmp(argv[2],"off",3)) {
-//			audacious_remote_pl_win_toggle(session, FALSE);
+			audacious_remote_pl_win_toggle(dbus_proxy, FALSE);
 			return;
 		}
 	}
@@ -1074,11 +1004,11 @@
 	if (argc > 2)
 	{
 		if (!strncmp(argv[2],"on",2)) {
-//			audacious_remote_eq_win_toggle(session, TRUE);
+			audacious_remote_eq_win_toggle(dbus_proxy, TRUE);
 			return;
 		}
 		else if (!strncmp(argv[2],"off",3)) {
-//			audacious_remote_eq_win_toggle(session, FALSE);
+			audacious_remote_eq_win_toggle(dbus_proxy, FALSE);
 			return;
 		}
 	}
@@ -1088,17 +1018,17 @@
 
 void show_preferences_window(gint argc, gchar **argv)
 {
-//	audacious_remote_show_prefs_box(session);
+	audacious_remote_show_prefs_box(dbus_proxy);
 }
 
 void show_jtf_window(gint argc, gchar **argv)
 {
-//	audacious_remote_show_jtf_box(session);
+	audacious_remote_show_jtf_box(dbus_proxy);
 }
 
 void shutdown_audacious_server(gint argc, gchar **argv)
 {
-//	audacious_remote_quit(session);
+	audacious_remote_quit(dbus_proxy);
 }
 
 void get_handlers_list(gint argc, gchar **argv)
--- a/src/audtool/audtool.h	Thu May 10 16:59:22 2007 -0700
+++ b/src/audtool/audtool.h	Fri May 11 01:42:32 2007 -0700
@@ -19,6 +19,8 @@
 #ifndef AUDTOOL_H
 #define AUDTOOL_H
 
+#include <audacious/dbus.h>
+
 struct commandhandler {
 	gchar *name;
 	void (*handler)(gint argc, gchar **argv);
--- a/src/libaudclient/audctrl.c	Thu May 10 16:59:22 2007 -0700
+++ b/src/libaudclient/audctrl.c	Fri May 11 01:42:32 2007 -0700
@@ -45,38 +45,38 @@
 }
 
 void audacious_remote_play(DBusGProxy *proxy) {
-    org_atheme_audacious_playback_play(proxy, &error);
-    g_error_free(error);
+    org_atheme_audacious_play(proxy, &error);
+    g_clear_error(&error);
 }
 
 void audacious_remote_pause(DBusGProxy *proxy) {
-    org_atheme_audacious_playback_pause(proxy, &error);
-    g_error_free(error);
+    org_atheme_audacious_pause(proxy, &error);
+    g_clear_error(&error);
 }
 
 void audacious_remote_stop(DBusGProxy *proxy) {
-    org_atheme_audacious_playback_stop(proxy, &error);
-    g_error_free(error);
+    org_atheme_audacious_stop(proxy, &error);
+    g_clear_error(&error);
 }
 
 gboolean audacious_remote_is_playing(DBusGProxy *proxy) {
     gboolean is_playing;
-    org_atheme_audacious_playback_playing(proxy, &is_playing, &error);
-    g_error_free(error);
+    org_atheme_audacious_playing(proxy, &is_playing, &error);
+    g_clear_error(&error);
     return is_playing;
 }
 
 gboolean audacious_remote_is_paused(DBusGProxy *proxy) {
     gboolean is_paused;
-    org_atheme_audacious_playback_paused(proxy, &is_paused, &error);
-    g_error_free(error);
+    org_atheme_audacious_paused(proxy, &is_paused, &error);
+    g_clear_error(&error);
     return is_paused;
 }
 
 gint audacious_remote_get_playlist_pos(DBusGProxy *proxy) {
     gint pos;
-    org_atheme_audacious_playlist_position(proxy, &pos, &error);
-    g_error_free(error);
+    org_atheme_audacious_position(proxy, &pos, &error);
+    g_clear_error(&error);
     return pos;
 }
 
@@ -85,20 +85,20 @@
 
 gint audacious_remote_get_playlist_length(DBusGProxy *proxy) {
     gint len;
-    org_atheme_audacious_playlist_length(proxy, &len, &error);
-    g_error_free(error);
+    org_atheme_audacious_length(proxy, &len, &error);
+    g_clear_error(&error);
     return len;
 }
 
 void audacious_remote_playlist_clear(DBusGProxy *proxy) {
-    org_atheme_audacious_playlist_clear(proxy, &error);
-    g_error_free(error);
+    org_atheme_audacious_clear(proxy, &error);
+    g_clear_error(&error);
 }
 
 gint audacious_remote_get_output_time(DBusGProxy *proxy) {
     gint time;
-    org_atheme_audacious_playback_time(proxy, &time, &error);
-    g_error_free(error);
+    org_atheme_audacious_time(proxy, &time, &error);
+    g_clear_error(&error);
     return time;
 }
 
@@ -114,8 +114,8 @@
  * Queries audacious about the current volume.
  **/
 void audacious_remote_get_volume(DBusGProxy *proxy, gint * vl, gint * vr) {
-    org_atheme_audacious_playback_volume(proxy, vl, vr, &error);
-    g_error_free(error);
+    org_atheme_audacious_volume(proxy, vl, vr, &error);
+    g_clear_error(&error);
 }
 
 /**
@@ -135,6 +135,21 @@
 }
 
 /**
+ * audacious_remote_get_balance:
+ * @proxy: DBus proxy for audacious
+ *
+ * Queries audacious about the current balance.
+ *
+ * Return value: The current balance.
+ **/
+gint audacious_remote_get_balance(DBusGProxy *proxy) {
+    gint balance;
+    org_atheme_audacious_balance(proxy, &balance,  &error);
+    g_clear_error(&error);
+    return balance;
+}
+
+/**
  * audacious_remote_set_volume:
  * @proxy: DBus proxy for audacious
  * @vl: The volume for the left channel.
@@ -143,8 +158,8 @@
  * Sets the volume for the left and right channels in Audacious.
  **/
 void audacious_remote_set_volume(DBusGProxy *proxy, gint vl, gint vr) {
-    org_atheme_audacious_playback_set_volume(proxy, vl, vr,  &error);
-    g_error_free(error);
+    org_atheme_audacious_set_volume(proxy, vl, vr,  &error);
+    g_clear_error(&error);
 }
 
 
@@ -171,23 +186,170 @@
     audacious_remote_set_volume(proxy, vl, vr);
 }
 
-/**
- * audacious_remote_get_balance:
- * @proxy: DBus proxy for audacious
- *
- * Queries audacious about the current balance.
- *
- * Return value: The current balance.
- **/
-gint audacious_remote_get_balance(DBusGProxy *proxy) {
-    gint balance;
-    org_atheme_audacious_playback_balance(proxy, &balance,  &error);
-    g_error_free(error);
-    return balance;
+void audacious_remote_set_balance(DBusGProxy *proxy, gint b) {
+    gint v, vl, vr;
+
+    if (b < -100)
+        b = -100;
+    if (b > 100)
+        b = 100;
+
+    v = audacious_remote_get_main_volume(proxy);
+
+    if (b < 0) {
+        vl = v;
+        vr = (v * (100 - abs(b))) / 100;
+    } else if (b > 0) {
+        vl = (v * (100 - b)) / 100;
+        vr = v;
+    } else
+        vl = vr = v;
+    audacious_remote_set_volume(proxy, vl, vr);
+}
+
+gchar *audacious_remote_get_skin(DBusGProxy *proxy) {
+}
+
+void audacious_remote_set_skin(DBusGProxy *proxy, gchar *skinfile) {
+}
+
+gchar *audacious_remote_get_playlist_file(DBusGProxy *proxy, gint pos) {
+}
+
+gchar *audacious_remote_get_playlist_title(DBusGProxy *proxy, gint pos) {
+}
+
+gint audacious_remote_get_playlist_time(DBusGProxy *proxy, gint pos) {
 }
 
+void audacious_remote_get_info(DBusGProxy *proxy, gint *rate, gint *freq,
+                               gint *nch) {
+}
+
+void audacious_remote_main_win_toggle(DBusGProxy *proxy, gboolean show) {
+}
+
+void audacious_remote_pl_win_toggle(DBusGProxy *proxy, gboolean show) {
+}
+
+void audacious_remote_eq_win_toggle(DBusGProxy *proxy, gboolean show) {
+}
+
+gboolean audacious_remote_is_main_win(DBusGProxy *proxy) {
+}
+
+gboolean audacious_remote_is_pl_win(DBusGProxy *proxy) {
+}
+
+gboolean audacious_remote_is_eq_win(DBusGProxy *proxy) {
+}
+
+void audacious_remote_show_prefs_box(DBusGProxy *proxy) {
+}
+
+void audacious_remote_toggle_aot(DBusGProxy *proxy, gboolean ontop) {
+}
+
+void audacious_remote_eject(DBusGProxy *proxy) {
+}
+
+void audacious_remote_playlist_prev(DBusGProxy *proxy) {
+}
+
+void audacious_remote_playlist_next(DBusGProxy *proxy) {
+}
+
+
 void audacious_remote_playlist_add_url_string(DBusGProxy *proxy,
                                               gchar *string) {
-    org_atheme_audacious_playlist_add_url(proxy, string, &error);
-    g_error_free(error);
+    org_atheme_audacious_add_url(proxy, string, &error);
+    g_clear_error(&error);
+}
+
+gboolean audacious_remote_is_running(DBusGProxy *proxy) {
+}
+
+void audacious_remote_toggle_repeat(DBusGProxy *proxy) {
+}
+
+void audacious_remote_toggle_shuffle(DBusGProxy *proxy) {
+}
+
+gboolean audacious_remote_is_repeat(DBusGProxy *proxy) {
+}
+
+gboolean audacious_remote_is_shuffle(DBusGProxy *proxy) {
+}
+
+void audacious_remote_get_eq(DBusGProxy *proxy, gfloat *preamp,
+                             gfloat **bands) {
+}
+
+gfloat audacious_remote_get_eq_preamp(DBusGProxy *proxy) {
+}
+
+gfloat audacious_remote_get_eq_band(DBusGProxy *proxy, gint band) {
+}
+
+void audacious_remote_set_eq(DBusGProxy *proxy, gfloat preamp,
+                             gfloat *bands) {
+}
+
+void audacious_remote_set_eq_preamp(DBusGProxy *proxy, gfloat preamp) {
+}
+
+void audacious_remote_set_eq_band(DBusGProxy *proxy, gint band,
+                                  gfloat value) {
+}
+
+void audacious_remote_quit(DBusGProxy *proxy) {
+}
+
+void audacious_remote_play_pause(DBusGProxy *proxy) {
 }
+
+void audacious_remote_playlist_ins_url_string(DBusGProxy *proxy,
+                                              gchar *string, gint pos) {
+}
+
+void audacious_remote_playqueue_add(DBusGProxy *proxy, gint pos) {
+}
+
+void audacious_remote_playqueue_remove(DBusGProxy *proxy, gint pos) {
+}
+
+gint audacious_remote_get_playqueue_length(DBusGProxy *proxy) {
+}
+
+void audacious_remote_toggle_advance(DBusGProxy *proxy) {
+}
+
+gboolean audacious_remote_is_advance(DBusGProxy *proxy) {
+}
+
+void audacious_remote_activate(DBusGProxy *proxy) {
+}
+
+void audacious_remote_show_jtf_box(DBusGProxy *proxy) {
+}
+
+void audacious_remote_playqueue_clear(DBusGProxy *proxy) {
+}
+
+gboolean audacious_remote_playqueue_is_queued(DBusGProxy *proxy, gint pos) {
+}
+
+gint audacious_remote_get_playqueue_position(DBusGProxy *proxy, gint pos) {
+}
+
+gint audacious_remote_get_playqueue_queue_position(DBusGProxy *proxy,
+                                                   gint pos) {
+}
+
+void audacious_remote_playlist_enqueue_to_temp(DBusGProxy *proxy,
+                                               gchar *string) {
+}
+
+gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field,
+                                      gint pos) {
+}