changeset 3270:30ed2878807f trunk

merged with master
author Ben Tucker <ben.tucker@gmail.com>
date Tue, 07 Aug 2007 18:07:37 -0700
parents 91dd21cce4a5 (diff) b26dc3482ce7 (current diff)
children 5f40f7d2887f
files src/audacious/Makefile src/audacious/dbus.h src/audacious/widgets/Makefile src/audacious/widgets/skin.c src/audacious/widgets/skin.h src/audacious/widgets/widgetcore.h
diffstat 6 files changed, 82 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Mon Aug 06 12:45:46 2007 +0200
+++ b/src/audacious/Makefile	Tue Aug 07 18:07:37 2007 -0700
@@ -144,7 +144,7 @@
 CFLAGS += -I../libaudclient
 DBUS_BINDINGS = dbus-server-bindings.h dbus-client-bindings.h
 OBJECTIVE_LIBS_NOINST += $(DBUS_BINDINGS)
-LIBDEP += ../libaudclient/libaudclient.so
+LIBDEP += ../libaudclient/libaudclient$(SHARED_SUFFIX)
 LDADD += -L../libaudclient -laudclient
 endif
 
--- a/src/audacious/dbus-service.h	Mon Aug 06 12:45:46 2007 +0200
+++ b/src/audacious/dbus-service.h	Tue Aug 07 18:07:37 2007 -0700
@@ -28,6 +28,7 @@
 
 typedef struct {
     GObject parent;
+	DBusGProxy *proxy;
 } RemoteObject, MprisRoot, MprisPlayer, MprisTrackList;
 
 typedef struct {
@@ -50,10 +51,13 @@
 gboolean mpris_player_pause(MprisPlayer *obj, GError **error);
 gboolean mpris_player_stop(MprisPlayer *obj, GError **error);
 gboolean mpris_player_play(MprisPlayer *obj, GError **error);
+gboolean mpris_player_repeat(MprisPlayer *obj, gboolean rpt, GError **error);
 gboolean mpris_player_quit(MprisPlayer *obj, GError **error);
-gboolean mpris_player_repeat(MprisPlayer *obj, gboolean rpt, GError **error);
+gboolean mpris_player_disconnect(MprisPlayer *obj, GError **error);
 gboolean mpris_player_get_status(MprisPlayer *obj, gint *status,
                                  GError **error);
+gboolean mpris_player_get_metadata(MprisTrackList *obj, gint pos,
+                                   GHashTable *metadata, GError **error);
 gboolean mpris_player_get_caps(MprisPlayer *obj, gint *capabilities,
                                  GError **error);
 gboolean mpris_player_volume_set(MprisPlayer *obj, gint vol, GError **error);
@@ -63,21 +67,23 @@
 gboolean mpris_player_position_get(MprisPlayer *obj, gint *pos,
                                    GError **error);
 enum {
-    CAPS_CHANGE_SIG,
     TRACK_CHANGE_SIG,
     STATUS_CHANGE_SIG,
+    CAPS_CHANGE_SIG,
+    DISCONNECTED,
     LAST_SIG
 };
-gboolean mpris_player_emit_caps_change(MprisPlayer *obj, GError **error);
 gboolean mpris_player_emit_track_change(MprisPlayer *obj, GError **error);
 gboolean mpris_player_emit_status_change(MprisPlayer *obj, GError **error);
+gboolean mpris_player_emit_caps_change(MprisPlayer *obj, GError **error);
+gboolean mpris_player_emit_disconnected(MprisPlayer *obj, GError **error);
 
 // MPRIS /TrackList
 gboolean mpris_tracklist_get_metadata(MprisTrackList *obj, gint pos,
                                       GHashTable *metadata, GError **error);
 gboolean mpris_tracklist_get_current_track(MprisTrackList *obj, gint *pos,
                                            GError **error);
-gboolean mpris_tracklist_get_length(MprisTrackList *obj, gint *pos,
+gboolean mpris_tracklist_get_length(MprisTrackList *obj, gint *length,
                                     GError **error);
 gboolean mpris_tracklist_add_track(MprisTrackList *obj, gchar *uri,
                                    gboolean play, GError **error);
--- a/src/audacious/dbus.c	Mon Aug 06 12:45:46 2007 +0200
+++ b/src/audacious/dbus.c	Tue Aug 07 18:07:37 2007 -0700
@@ -175,32 +175,54 @@
 
 // MPRIS /Player
 gboolean mpris_player_next(MprisPlayer *obj, GError **error) {
-    return audacious_rc_advance(obj, error);
+	playlist_next(playlist_get_active());
+    return TRUE;
 }
 gboolean mpris_player_prev(MprisPlayer *obj, GError **error) {
-    return audacious_rc_reverse(obj, error);
+	playlist_prev(playlist_get_active());
+    return TRUE;
 }
 gboolean mpris_player_pause(MprisPlayer *obj, GError **error) {
-    return audacious_rc_pause(obj, error);
+	playback_pause();
+    return TRUE;
 }
 gboolean mpris_player_stop(MprisPlayer *obj, GError **error) {
-    return audacious_rc_stop(obj, error);
+	ip_data.stop = TRUE;
+    playback_stop();
+    ip_data.stop = FALSE;
+    mainwin_clear_song_info();
+    return TRUE;
 }
 gboolean mpris_player_play(MprisPlayer *obj, GError **error) {
-    return audacious_rc_play(obj, error);
-}
-gboolean mpris_player_quit(MprisPlayer *obj, GError **error) {
-    return audacious_rc_quit(obj, error);
+	if (playback_get_paused())
+        playback_pause();
+    else if (playlist_get_length(playlist_get_active()))
+        playback_initiate();
+    else
+        mainwin_eject_pushed();
+    return TRUE;
 }
 gboolean mpris_player_repeat(MprisPlayer *obj, gboolean rpt, GError **error) {
     mainwin_repeat_pushed(rpt);
     mainwin_set_noplaylistadvance(rpt);
     return TRUE;
 }
+gboolean mpris_player_quit(MprisPlayer *obj, GError **error) {
+	// TODO: emit disconnected signal
+	mainwin_quit_cb();
+    return TRUE;
+}
+gboolean mpris_player_disconnect(MprisPlayer *obj, GError **error) {
+	return FALSE;
+}
 gboolean mpris_player_get_status(MprisPlayer *obj, gint *status,
                                  GError **error) {
     return FALSE;
 }
+gboolean mpris_player_get_metadata(MprisTrackList *obj, gint pos,
+                                   GHashTable *metadata, GError **error) {
+	return FALSE;
+}
 gboolean mpris_player_get_caps(MprisPlayer *obj, gint *capabilities,
                                  GError **error) {
     return FALSE;
@@ -236,6 +258,11 @@
     return TRUE;
 }
 
+gboolean mpris_player_emit_disconnected(MprisPlayer *obj, GError **error) {
+	g_signal_emit(obj, signals[DISCONNECTED], 0, NULL);
+	return TRUE;
+}
+
 // MPRIS /TrackList
 gboolean mpris_tracklist_get_metadata(MprisTrackList *obj, gint pos,
                                       GHashTable *metadata, GError **error) {
@@ -243,11 +270,13 @@
 }
 gboolean mpris_tracklist_get_current_track(MprisTrackList *obj, gint *pos,
                                            GError **error) {
-    return audacious_rc_position(obj, pos, error);
+	*pos = playlist_get_position(playlist_get_active());
+    return TRUE;
 }
-gboolean mpris_tracklist_get_length(MprisTrackList *obj, gint *pos,
+gboolean mpris_tracklist_get_length(MprisTrackList *obj, gint *length,
                                     GError **error) {
-    return FALSE;
+	*length = playlist_get_length(playlist_get_active());
+    return TRUE;
 }
 gboolean mpris_tracklist_add_track(MprisTrackList *obj, gchar *uri,
                                    gboolean play, GError **error) {
@@ -261,7 +290,8 @@
 }
 gboolean mpris_tracklist_del_track(MprisTrackList *obj, gint pos,
                                    GError **error) {
-    return FALSE;
+	playlist_delete_index(playlist_get_active(), pos);
+    return TRUE;
 }
 gboolean mpris_tracklist_loop(MprisTrackList *obj, gboolean loop,
                               GError **error) {
@@ -269,7 +299,8 @@
 }
 gboolean mpris_tracklist_random(MprisTrackList *obj, gboolean random,
                                 GError **error) {
-    return FALSE;
+	mainwin_shuffle_pushed(!cfg.shuffle);
+    return TRUE;
 }
 
 // Audacious General Information
--- a/src/audacious/dbus.h	Mon Aug 06 12:45:46 2007 +0200
+++ b/src/audacious/dbus.h	Tue Aug 07 18:07:37 2007 -0700
@@ -25,8 +25,20 @@
 #define AUDACIOUS_DBUS_PATH         "/org/atheme/audacious"
 #define AUDACIOUS_DBUS_INTERFACE    "org.atheme.audacious"
 #define AUDACIOUS_DBUS_SERVICE_MPRIS    "org.mpris.audacious"
+#define AUDACIOUS_DBUS_INTERFACE_MPRIS 	"org.freedesktop.MediaPlayer"
 #define AUDACIOUS_DBUS_PATH_MPRIS_ROOT      "/"
 #define AUDACIOUS_DBUS_PATH_MPRIS_PLAYER    "/Player"
 #define AUDACIOUS_DBUS_PATH_MPRIS_TRACKLIST "/TrackList"
 
+#define NONE                  = 0
+#define CAN_GO_NEXT           = 1 << 0
+#define CAN_GO_PREV           = 1 << 1
+#define CAN_PAUSE             = 1 << 2
+#define CAN_PLAY              = 1 << 3
+#define CAN_SEEK              = 1 << 4
+#define CAN_RESTORE_CONTEXT   = 1 << 5
+#define CAN_PROVIDE_METADATA  = 1 << 6
+#define PROVIDES_TIMING       = 1 << 7
+
+
 #endif // !_AUDDBUS_H
--- a/src/audacious/mpris_player.xml	Mon Aug 06 12:45:46 2007 +0200
+++ b/src/audacious/mpris_player.xml	Tue Aug 07 18:07:37 2007 -0700
@@ -3,6 +3,7 @@
 <!--
  - Audacious: A cross-platform multimedia player
  - Copyright (c) 2007 William Pitcock
+ - Copyright (c) 2007 Ben Tucker
  -
  - This program is free software; you can redistribute it and/or modify
  - it under the terms of the GNU General Public License as published by
@@ -34,51 +35,49 @@
         <method name="Play">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
         </method>
-        <method name="Quit">
-            <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
-        </method>
-
         <method name="Repeat">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
             <arg type="b" direction="in" />
         </method>
-
+        <method name="Quit">
+            <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
+        </method>
+        <method name="Disconnect">
+            <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
+        </method>
         <method name="GetStatus">
             <arg type="i" direction="out" />
         </method>
-
+        <method name="GetMetadata">
+            <arg type="a{sv}" direction="out" />
+        </method>
         <method name="GetCaps">
             <arg type="i" direction="out" />
         </method>
-
         <method name="VolumeSet">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
             <arg type="i" direction="in" />
         </method>
-
         <method name="VolumeGet">
             <arg type="i" direction="out" />
         </method>
-
         <method name="PositionSet">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
             <arg type="i" direction="in" />
         </method>
-
         <method name="PositionGet">
             <arg type="i" direction="out" />
         </method>
 
-        <signal name="CapsChange">
-            <arg type="i" />
-        </signal>
-
         <signal name="TrackChange">
             <arg type="a{sv}" />
         </signal>
-
         <signal name="StatusChange">
             <arg type="i" />
         </signal>
+        <signal name="CapsChange">
+            <arg type="i" />
+        </signal>
+		<signal name="Disconnected" />
     </interface>
 </node>
--- a/src/audacious/mpris_tracklist.xml	Mon Aug 06 12:45:46 2007 +0200
+++ b/src/audacious/mpris_tracklist.xml	Tue Aug 07 18:07:37 2007 -0700
@@ -3,6 +3,7 @@
 <!--
  - Audacious: A cross-platform multimedia player
  - Copyright (c) 2007 William Pitcock
+ - Copyright (c) 2007 Ben Tucker
  -
  - This program is free software; you can redistribute it and/or modify
  - it under the terms of the GNU General Public License as published by