changeset 2785:182aa34ae6c4 trunk

[svn] - implement some audacious-remote functions. - implement some audacious-drct functions. - make some command line options work. (this may incur very slow startup.) - suppress warnings.
author yaz
date Tue, 22 May 2007 15:17:15 -0700
parents 0a982aad6e07
children c539e972b514
files ChangeLog src/audacious/Makefile src/audacious/auddrct.c src/audacious/auddrct.h src/audacious/build_stamp.c src/audacious/dbus.c src/audacious/main.c src/audacious/signals.c src/audacious/ui_equalizer.c src/libaudclient/audctrl.c
diffstat 10 files changed, 116 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat May 19 16:59:48 2007 -0700
+++ b/ChangeLog	Tue May 22 15:17:15 2007 -0700
@@ -1,3 +1,10 @@
+2007-05-19 23:59:48 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [4594]
+  Rework the curved border a little.
+  
+  0 files changed
+
+
 2007-05-19 23:51:17 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4592]
   Fix the colon in the main texture.
--- a/src/audacious/Makefile	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/Makefile	Tue May 22 15:17:15 2007 -0700
@@ -115,11 +115,16 @@
 	visualization.c \
 	xconvert.c
 
+LIBDEP = widgets/libwidgets.a ../libguess/libguess.a ../librcd/librcd.a
+
 ifdef USE_DBUS
 SOURCES += dbus.c
+CFLAGS += -I../libaudclient
 DBUS_BINDINGS = dbus-server-bindings.h dbus-client-bindings.h
 depend-prehook: $(DBUS_BINDINGS)
 OBJECTIVE_LIBS_NOINST += $(DBUS_BINDINGS)
+LIBDEP += ../libaudclient/libaudclient.so
+LDADD += -L../libaudclient -laudclient
 endif
 
 DBUS_BINDINGS_SOURCES = \
@@ -130,8 +135,6 @@
 
 OBJECTS = ${SOURCES:.c=.o}
 
-LIBDEP = widgets/libwidgets.a ../libguess/libguess.a ../librcd/librcd.a
-
 desktop_DATA = audacious.desktop
 desktopdir = $(datadir)/applications
 
--- a/src/audacious/auddrct.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/auddrct.c	Tue May 22 15:17:15 2007 -0700
@@ -103,6 +103,23 @@
   return;
 }
 
+void audacious_drct_set_skin(gchar *skinfile)
+{
+    if (has_x11_connection)
+        bmp_active_skin_load(skinfile);
+}
+
+void audacious_drct_show_jtf_box(void)
+{
+    if (!has_x11_connection)
+        return;
+    ui_jump_to_track();
+}
+
+void audacious_drct_activate(void)
+{
+    gtk_window_present(GTK_WINDOW(mainwin));
+}
 
 /* playback */
 
@@ -450,3 +467,4 @@
 {
     return playlist_get_queue_position_number(playlist_get_active(), pos);
 }
+
--- a/src/audacious/auddrct.h	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/auddrct.h	Tue May 22 15:17:15 2007 -0700
@@ -35,6 +35,9 @@
 void audacious_drct_eq_win_toggle ( gboolean );
 gboolean audacious_drct_pl_win_is_visible ( void );
 void audacious_drct_pl_win_toggle ( gboolean );
+void audacious_drct_set_skin(gchar *skinfile);
+void audacious_drct_show_jtf_box(void);
+void audacious_drct_activate(void);
 
 /* playback */
 void audacious_drct_play ( void );
@@ -69,7 +72,6 @@
 gint audacious_drct_pl_get_length( void );
 void audacious_drct_pl_delete ( gint pos );
 void audacious_drct_pl_set_pos( gint pos );
-gint audacious_drct_pl_get_length( void );
 void audacious_drct_pl_ins_url_string( gchar * string, gint pos );
 void audacious_drct_pl_add_url_string( gchar * string );
 void audacious_drct_pl_enqueue_to_temp( gchar * string );
--- a/src/audacious/build_stamp.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/build_stamp.c	Tue May 22 15:17:15 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070519-4592";
+const gchar *svn_stamp = "20070519-4594";
--- a/src/audacious/dbus.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/dbus.c	Tue May 22 15:17:15 2007 -0700
@@ -604,3 +604,14 @@
     mainwin_shuffle_pushed(!cfg.shuffle);
     return TRUE;
 }
+
+DBusGProxy *audacious_get_dbus_proxy(void)
+{
+    DBusGConnection *connection = NULL;
+    GError *error = NULL;
+    connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+    g_clear_error(&error);
+    return dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,
+                                     AUDACIOUS_DBUS_PATH,
+                                     AUDACIOUS_DBUS_INTERFACE);
+}
--- a/src/audacious/main.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/main.c	Tue May 22 15:17:15 2007 -0700
@@ -50,6 +50,7 @@
 
 #ifdef USE_DBUS
 #  include "dbus-service.h"
+#  include "audctrl.h"
 #endif
 
 #include "dnd.h"
@@ -896,8 +897,9 @@
                         gboolean remote)
 {
     gchar **filenames = options->filenames;
-#ifdef HAVE_DBUS
-    // DBusGProxy *session = audacious_get_dbus_proxy();
+#ifdef USE_DBUS
+    DBusGProxy *session = audacious_get_dbus_proxy();
+    printf("session = %p\n", session);
 #endif
 
     if (options->version)
@@ -906,7 +908,7 @@
         exit(EXIT_SUCCESS);
     }
 
-#if 0
+#if 1
     if (filenames != NULL)
     {
         gint pos = 0;
@@ -995,6 +997,14 @@
 
     if (options->playcd)
         play_medium();
+
+    printf("remote = %d\n", remote);
+    {
+        gboolean is_running = audacious_remote_is_running(session);
+        printf("is_running %d\n", is_running);
+        if (is_running)
+            exit(EXIT_SUCCESS);
+    }
 }
 
 static void
--- a/src/audacious/signals.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/signals.c	Tue May 22 15:17:15 2007 -0700
@@ -68,7 +68,7 @@
         g_printerr("Stacktrace (%zd frames):\n", size);
 
         for (i = 0; i < size; i++)
-           g_printerr("   %d. %s\n", i + 1, strings[i]);
+            g_printerr("   %ld. %s\n", (long)i + 1, strings[i]);
 
         g_free(strings);
     }
--- a/src/audacious/ui_equalizer.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/audacious/ui_equalizer.c	Tue May 22 15:17:15 2007 -0700
@@ -999,9 +999,9 @@
 
         gtk_tree_model_get(model, &iter, 0, &text, -1);
 
-        if (filename == "eq.preset")
+        if (!strcmp(filename, "eq.preset"))
             equalizer_presets = equalizerwin_delete_preset(equalizer_presets, text, filename);
-        else if (filename == "eq.auto_preset")
+        else if (!strcmp(filename, "eq.auto_preset"))
             equalizer_auto_presets = equalizerwin_delete_preset(equalizer_auto_presets, text, filename);
 
         gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
--- a/src/libaudclient/audctrl.c	Sat May 19 16:59:48 2007 -0700
+++ b/src/libaudclient/audctrl.c	Tue May 22 15:17:15 2007 -0700
@@ -41,6 +41,7 @@
  **/
 void audacious_remote_playlist(DBusGProxy *proxy, gchar **list, gint num,
                                gboolean enqueue) {
+//XXX
 }
 
 /**
@@ -52,6 +53,7 @@
  * Return value: The protocol version used by Audacious.
  **/
 gint audacious_remote_get_version(DBusGProxy *proxy) {
+//XXX
     return 0;
 }
 
@@ -63,6 +65,7 @@
  * Sends a list of URIs to Audacious to add to the playlist.
  **/
 void audacious_remote_playlist_add(DBusGProxy *proxy, GList *list) {
+//XXX
 }
 
 /**
@@ -73,6 +76,7 @@
  * Deletes a playlist entry.
  **/
 void audacious_remote_playlist_delete(DBusGProxy *proxy, guint pos) {
+//XXX
 }
 
 /**
@@ -161,6 +165,8 @@
  * Tells audacious to jump to a different playlist position.
  **/
 void audacious_remote_set_playlist_pos(DBusGProxy *proxy, guint pos) {
+    org_atheme_audacious_jump (proxy, pos, &error);
+    g_clear_error(&error);
 }
 
 /**
@@ -212,6 +218,8 @@
  * Tells audacious to seek to a new time position.
  **/
 void audacious_remote_jump_to_time(DBusGProxy *proxy, guint pos) {
+    org_atheme_audacious_seek (proxy, pos, &error);
+    g_clear_error(&error);    
 }
 
 /**
@@ -332,6 +340,7 @@
  * Return value: A path to the currently selected skin.
  **/
 gchar *audacious_remote_get_skin(DBusGProxy *proxy) {
+//XXX
     return NULL;
 }
 
@@ -343,6 +352,7 @@
  * Tells audacious to start using the skinfile provided.
  **/
 void audacious_remote_set_skin(DBusGProxy *proxy, gchar *skinfile) {
+//XXX
 }
 
 /**
@@ -404,6 +414,8 @@
  **/
 void audacious_remote_get_info(DBusGProxy *proxy, gint *rate, gint *freq,
                                gint *nch) {
+    org_atheme_audacious_info(proxy, rate, freq, nch, &error);
+    g_clear_error(&error);
 }
 
 /**
@@ -496,6 +508,7 @@
  * Tells audacious to show the preferences pane.
  **/
 void audacious_remote_show_prefs_box(DBusGProxy *proxy) {
+//XXX
 }
 
 /**
@@ -506,6 +519,7 @@
  * Tells audacious to toggle the always-on-top feature.
  **/
 void audacious_remote_toggle_aot(DBusGProxy *proxy, gboolean ontop) {
+//XXX
 }
 
 /**
@@ -526,6 +540,8 @@
  * Tells audacious to move backwards in the playlist.
  **/
 void audacious_remote_playlist_prev(DBusGProxy *proxy) {
+    org_atheme_audacious_reverse(proxy, &error);
+    g_clear_error(&error);
 }
 
 /**
@@ -535,6 +551,8 @@
  * Tells audacious to move forward in the playlist.
  **/
 void audacious_remote_playlist_next(DBusGProxy *proxy) {
+    org_atheme_audacious_advance(proxy, &error);
+    g_clear_error(&error);
 }
 
 /**
@@ -559,7 +577,15 @@
  * Return value: TRUE if yes, otherwise FALSE.
  **/
 gboolean audacious_remote_is_running(DBusGProxy *proxy) {
-    return FALSE;
+    char *string = NULL;
+    org_atheme_audacious_version(proxy, &string, &error);
+    g_clear_error(&error);
+    if(string) {
+        g_free(string);
+        return TRUE;
+    }
+    else
+        return FALSE;
 }
 
 /**
@@ -569,6 +595,8 @@
  * Tells audacious to toggle the repeat feature.
  **/
 void audacious_remote_toggle_repeat(DBusGProxy *proxy) {
+    org_atheme_audacious_toggle_repeat(proxy, &error);
+    g_clear_error(&error);
 }
 
 /**
@@ -578,6 +606,8 @@
  * Tells audacious to toggle the shuffle feature.
  **/
 void audacious_remote_toggle_shuffle(DBusGProxy *proxy) {
+    org_atheme_audacious_toggle_shuffle (proxy, &error);
+    g_clear_error(&error);    
 }
 
 /**
@@ -620,6 +650,7 @@
  **/
 void audacious_remote_get_eq(DBusGProxy *proxy, gfloat *preamp,
                              gfloat **bands) {
+//XXX
 }
 
 /**
@@ -631,6 +662,8 @@
  * Return value: The equalizer preamp's setting.
  **/
 gfloat audacious_remote_get_eq_preamp(DBusGProxy *proxy) {
+//XXX
+    return 0.0;
 }
 
 /**
@@ -643,6 +676,8 @@
  * Return value: The equalizer band's value.
  **/
 gfloat audacious_remote_get_eq_band(DBusGProxy *proxy, gint band) {
+//XXX
+    return 0.0;
 }
 
 /**
@@ -655,6 +690,7 @@
  **/
 void audacious_remote_set_eq(DBusGProxy *proxy, gfloat preamp,
                              gfloat *bands) {
+//XXX
 }
 
 /**
@@ -665,6 +701,7 @@
  * Tells audacious to set the equalizer's preamp setting.
  **/
 void audacious_remote_set_eq_preamp(DBusGProxy *proxy, gfloat preamp) {
+//XXX
 }
 
 /**
@@ -677,6 +714,7 @@
  **/
 void audacious_remote_set_eq_band(DBusGProxy *proxy, gint band,
                                   gfloat value) {
+//XXX
 }
 
 /**
@@ -697,6 +735,7 @@
  * Tells audacious to either play or pause.
  **/
 void audacious_remote_play_pause(DBusGProxy *proxy) {
+//XXX
 }
 
 /**
@@ -709,6 +748,7 @@
  **/
 void audacious_remote_playlist_ins_url_string(DBusGProxy *proxy,
                                               gchar *string, guint pos) {
+//XXX
 }
 
 /**
@@ -719,6 +759,7 @@
  * Tells audacious to add a playlist entry to the playqueue.
  **/
 void audacious_remote_playqueue_add(DBusGProxy *proxy, guint pos) {
+//XXX
 }
 
 /**
@@ -729,6 +770,7 @@
  * Tells audacious to remove a playlist entry from the playqueue.
  **/
 void audacious_remote_playqueue_remove(DBusGProxy *proxy, guint pos) {
+//XXX
 }
 
 /**
@@ -780,6 +822,7 @@
  * Tells audacious to display the main window and become the selected window.
  **/
 void audacious_remote_activate(DBusGProxy *proxy) {
+//XXX
 }
 
 /**
@@ -789,6 +832,7 @@
  * Tells audacious to show the Jump-to-File pane.
  **/
 void audacious_remote_show_jtf_box(DBusGProxy *proxy) {
+//XXX
 }
 
 /**
@@ -798,6 +842,7 @@
  * Tells audacious to clear the playqueue.
  **/
 void audacious_remote_playqueue_clear(DBusGProxy *proxy) {
+//XXX
 }
 
 /**
@@ -810,6 +855,8 @@
  * Return value: TRUE if yes, FALSE otherwise.
  **/
 gboolean audacious_remote_playqueue_is_queued(DBusGProxy *proxy, guint pos) {
+//XXX
+    return FALSE;
 }
 
 /**
@@ -822,6 +869,8 @@
  * Return value: TRUE if yes, FALSE otherwise.
  **/
 gint audacious_remote_get_playqueue_position(DBusGProxy *proxy, guint pos) {
+//XXX
+    return 0;
 }
 
 /**
@@ -835,6 +884,8 @@
  **/
 gint audacious_remote_get_playqueue_queue_position(DBusGProxy *proxy,
                                                    guint pos) {
+//XXX
+    return 0;
 }
 
 /**
@@ -846,6 +897,7 @@
  **/
 void audacious_remote_playlist_enqueue_to_temp(DBusGProxy *proxy,
                                                gchar *string) {
+//XXX
 }
 
 /**
@@ -860,4 +912,6 @@
  **/
 gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field,
                                       guint pos) {
+//XXX
+    return NULL;
 }