annotate src/audacious/dbus.c @ 3968:f1ed63913f1c

Add MPRIS codec and quality fields.
author William Pitcock <nenolod@atheme.org>
date Sat, 17 Nov 2007 23:55:36 -0600
parents 37963a32f627
children dfe5d686749e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
1 /*
2696
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
2 * Audacious: A cross-platform multimedia player
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
3 * Copyright (c) 2007 Ben Tucker
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
4 *
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
5 * This program is free software; you can redistribute it and/or modify
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
6 * it under the terms of the GNU General Public License as published by
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 2814
diff changeset
7 * the Free Software Foundation; under version 3 of the License.
2696
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
8 *
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
9 * This program is distributed in the hope that it will be useful,
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
12 * GNU General Public License for more details.
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
13 *
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
14 * You should have received a copy of the GNU General Public License
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 2814
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses>.
3123
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
16 *
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
17 * The Audacious team does not consider modular code linking to
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
18 * Audacious or using our public API to be a derived work.
2696
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
19 */
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
20
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
21 #ifdef HAVE_CONFIG_H
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
22 # include "config.h"
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
23 #endif
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
24
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
25 #include <glib.h>
3888
edd7da52849f unbreak build
William Pitcock <nenolod@atheme.org>
parents: 3886
diff changeset
26 #include <dbus/dbus.h>
edd7da52849f unbreak build
William Pitcock <nenolod@atheme.org>
parents: 3886
diff changeset
27 #include <dbus/dbus-glib.h>
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
28 #include <dbus/dbus-glib-bindings.h>
3888
edd7da52849f unbreak build
William Pitcock <nenolod@atheme.org>
parents: 3886
diff changeset
29 #include <dbus/dbus-glib-lowlevel.h>
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
30 #include "dbus.h"
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
31 #include "dbus-service.h"
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
32 #include "dbus-server-bindings.h"
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
33
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
34 #include <math.h>
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
35 #include "main.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
36 #include "ui_equalizer.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
37 #include "ui_main.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
38 #include "input.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
39 #include "playback.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
40 #include "playlist.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
41 #include "ui_playlist.h"
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
42 #include "ui_preferences.h"
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
43 #include "tuple.h"
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
44 #include "ui_jumptotrack.h"
2814
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
45 #include "strings.h"
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
46 #include "ui_credits.h"
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
47 #include "skin.h"
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
48 #include "ui_fileopener.h"
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
49
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
50 static DBusGConnection *dbus_conn = NULL;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
51 static guint signals[LAST_SIG] = { 0 };
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
52
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
53 G_DEFINE_TYPE(RemoteObject, audacious_rc, G_TYPE_OBJECT);
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
54 G_DEFINE_TYPE(MprisRoot, mpris_root, G_TYPE_OBJECT);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
55 G_DEFINE_TYPE(MprisPlayer, mpris_player, G_TYPE_OBJECT);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
56 G_DEFINE_TYPE(MprisTrackList, mpris_tracklist, G_TYPE_OBJECT);
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
57
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
58 #define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
59
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
60 void audacious_rc_class_init(RemoteObjectClass *klass) {}
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
61 void mpris_root_class_init(MprisRootClass *klass) {}
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
62
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
63 void mpris_player_class_init(MprisPlayerClass *klass) {
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
64 signals[CAPS_CHANGE_SIG] =
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
65 g_signal_new("caps_change",
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
66 G_OBJECT_CLASS_TYPE(klass),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
67 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
68 0,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
69 NULL, NULL,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
70 g_cclosure_marshal_VOID__INT,
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
71 G_TYPE_NONE, 1, G_TYPE_INT);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
72 signals[TRACK_CHANGE_SIG] =
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
73 g_signal_new("track_change",
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
74 G_OBJECT_CLASS_TYPE(klass),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
75 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
76 0,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
77 NULL, NULL,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
78 g_cclosure_marshal_VOID__BOXED,
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
79 G_TYPE_NONE, 1, DBUS_TYPE_G_STRING_VALUE_HASHTABLE);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
80 signals[STATUS_CHANGE_SIG] =
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
81 g_signal_new("status_change",
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
82 G_OBJECT_CLASS_TYPE(klass),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
83 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
84 0,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
85 NULL, NULL,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
86 g_cclosure_marshal_VOID__INT,
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
87 G_TYPE_NONE, 1, G_TYPE_INT);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
88 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
89
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
90 void mpris_tracklist_class_init(MprisTrackListClass *klass) {}
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
91
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
92 void audacious_rc_init(RemoteObject *object) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
93 GError *error = NULL;
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
94 DBusGProxy *driver_proxy;
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
95 guint request_ret;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
96
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
97
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
98 dbus_g_object_type_install_info(audacious_rc_get_type(),
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
99 &dbus_glib_audacious_rc_object_info);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
100
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
101 // Register DBUS path
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
102 dbus_g_connection_register_g_object(dbus_conn,
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
103 AUDACIOUS_DBUS_PATH, G_OBJECT(object));
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
104
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
105 // Register the service name, the constants here are defined in
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
106 // dbus-glib-bindings.h
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
107 driver_proxy = dbus_g_proxy_new_for_name(dbus_conn,
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
108 DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
109 DBUS_INTERFACE_DBUS);
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
110
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
111 if (!org_freedesktop_DBus_request_name(driver_proxy,
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
112 AUDACIOUS_DBUS_SERVICE, 0, &request_ret, &error)) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
113 g_warning("Unable to register service: %s", error->message);
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
114 g_error_free(error);
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
115 }
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
116
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
117 if (!org_freedesktop_DBus_request_name(driver_proxy,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
118 AUDACIOUS_DBUS_SERVICE_MPRIS, 0, &request_ret, &error)) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
119 g_warning("Unable to register service: %s", error->message);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
120 g_error_free(error);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
121 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
122
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
123 g_object_unref(driver_proxy);
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
124 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
125
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
126 void mpris_root_init(MprisRoot *object) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
127 dbus_g_object_type_install_info(mpris_root_get_type(),
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
128 &dbus_glib_mpris_root_object_info);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
129
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
130 // Register DBUS path
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
131 dbus_g_connection_register_g_object(dbus_conn,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
132 AUDACIOUS_DBUS_PATH_MPRIS_ROOT,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
133 G_OBJECT(object));
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
134 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
135
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
136 void mpris_player_init(MprisPlayer *object) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
137 dbus_g_object_type_install_info(mpris_player_get_type(),
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
138 &dbus_glib_mpris_player_object_info);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
139
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
140 // Register DBUS path
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
141 dbus_g_connection_register_g_object(dbus_conn,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
142 AUDACIOUS_DBUS_PATH_MPRIS_PLAYER,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
143 G_OBJECT(object));
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
144
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
145 // Add signals
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
146 DBusGProxy *proxy = object->proxy;
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
147 dbus_g_proxy_add_signal(proxy, "StatusChange",
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
148 G_TYPE_INT, G_TYPE_INVALID);
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
149 dbus_g_proxy_add_signal(proxy, "CapsChange",
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
150 G_TYPE_INT, G_TYPE_INVALID);
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
151 dbus_g_proxy_add_signal(proxy, "TrackChange",
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
152 DBUS_TYPE_G_STRING_VALUE_HASHTABLE, G_TYPE_INVALID);
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
153 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
154
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
155 void mpris_tracklist_init(MprisTrackList *object) {
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
156 dbus_g_object_type_install_info(mpris_tracklist_get_type(),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
157 &dbus_glib_mpris_tracklist_object_info);
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
158
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
159 // Register DBUS path
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
160 dbus_g_connection_register_g_object(dbus_conn,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
161 AUDACIOUS_DBUS_PATH_MPRIS_TRACKLIST,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
162 G_OBJECT(object));
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
163 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
164
2700
2d1837805ca4 [svn] Improved DBus initialization and fixed a warning.
magma
parents: 2696
diff changeset
165 void init_dbus() {
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
166 GError *error = NULL;
3886
5c8d5ff0e601 fix exit_on_disconnect behaviour.
William Pitcock <nenolod@atheme.org>
parents: 3873
diff changeset
167 DBusConnection *local_conn;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
168 // Initialize the DBus connection
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
169 dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
170 if (dbus_conn == NULL) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
171 g_warning("Unable to connect to dbus: %s", error->message);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
172 g_error_free(error);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
173 return;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
174 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
175
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
176 g_type_init();
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
177 g_object_new(audacious_rc_get_type(), NULL);
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
178 g_object_new(mpris_root_get_type(), NULL);
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
179 mpris = g_object_new(mpris_player_get_type(), NULL);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
180 g_object_new(mpris_tracklist_get_type(), NULL);
2728
452a159dc619 [svn] - log when dbus has been successfully started up
nenolod
parents: 2717
diff changeset
181 g_message("D-Bus support has been activated");
3886
5c8d5ff0e601 fix exit_on_disconnect behaviour.
William Pitcock <nenolod@atheme.org>
parents: 3873
diff changeset
182
5c8d5ff0e601 fix exit_on_disconnect behaviour.
William Pitcock <nenolod@atheme.org>
parents: 3873
diff changeset
183 local_conn = dbus_g_connection_get_connection(dbus_conn);
5c8d5ff0e601 fix exit_on_disconnect behaviour.
William Pitcock <nenolod@atheme.org>
parents: 3873
diff changeset
184 dbus_connection_set_exit_on_disconnect(local_conn, FALSE);
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
185 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
186
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
187 GValue *tuple_value_to_gvalue(Tuple *tuple, const gchar *key) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
188 GValue *val;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
189 TupleValueType type;
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3348
diff changeset
190 type = tuple_get_value_type(tuple, -1, key);
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
191 if (type == TUPLE_STRING) {
3827
fd86a88426f4 dbus: ensure that only proper UTF8 is sent over the wire.
William Pitcock <nenolod@atheme.org>
parents: 3490
diff changeset
192 gchar *result = str_to_utf8(tuple_get_string(tuple, -1, key));
fd86a88426f4 dbus: ensure that only proper UTF8 is sent over the wire.
William Pitcock <nenolod@atheme.org>
parents: 3490
diff changeset
193
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
194 val = g_new0(GValue, 1);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
195 g_value_init(val, G_TYPE_STRING);
3827
fd86a88426f4 dbus: ensure that only proper UTF8 is sent over the wire.
William Pitcock <nenolod@atheme.org>
parents: 3490
diff changeset
196 g_value_set_string(val, result);
fd86a88426f4 dbus: ensure that only proper UTF8 is sent over the wire.
William Pitcock <nenolod@atheme.org>
parents: 3490
diff changeset
197
fd86a88426f4 dbus: ensure that only proper UTF8 is sent over the wire.
William Pitcock <nenolod@atheme.org>
parents: 3490
diff changeset
198 g_free(result);
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
199 return val;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
200 } else if (type == TUPLE_INT) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
201 val = g_new0(GValue, 1);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
202 g_value_init(val, G_TYPE_INT);
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3348
diff changeset
203 g_value_set_int(val, tuple_get_int(tuple, -1, key));
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
204 return val;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
205 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
206 return NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
207 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
208
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
209 GHashTable *mpris_metadata_from_tuple(Tuple *tuple) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
210 GHashTable *md = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
211 GValue *value;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
212
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
213 if (tuple == NULL)
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
214 return NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
215
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
216 md = g_hash_table_new(g_str_hash, g_str_equal);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
217
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
218 value = tuple_value_to_gvalue(tuple, "length");
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
219 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
220 g_hash_table_insert(md, "length", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
221 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
222
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
223 value = tuple_value_to_gvalue(tuple, "title");
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
224 if (value != NULL) {
3348
2a081105513c -Set the track "title" in metadata instead of "name"
Ben Tucker <ben.tucker@gmail.com>
parents: 3346
diff changeset
225 g_hash_table_insert(md, "title", value);
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
226 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
227
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
228 value = tuple_value_to_gvalue(tuple, "artist");
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
229 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
230 g_hash_table_insert(md, "artist", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
231 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
232
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
233 value = tuple_value_to_gvalue(tuple, "album");
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
234 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
235 g_hash_table_insert(md, "album", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
236 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
237
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
238 value = tuple_value_to_gvalue(tuple, "genre");
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
239 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
240 g_hash_table_insert(md, "genre", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
241 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
242
3968
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
243 value = tuple_value_to_gvalue(tuple, "codec");
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
244 if (value != NULL) {
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
245 g_hash_table_insert(md, "codec", value);
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
246 }
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
247
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
248 value = tuple_value_to_gvalue(tuple, "quality");
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
249 if (value != NULL) {
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
250 g_hash_table_insert(md, "quality", value);
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
251 }
f1ed63913f1c Add MPRIS codec and quality fields.
William Pitcock <nenolod@atheme.org>
parents: 3955
diff changeset
252
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
253 return md;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
254 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
255
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
256 /* MPRIS API */
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
257 // MPRIS /
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
258 gboolean mpris_root_identity(MprisRoot *obj, gchar **identity,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
259 GError **error) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
260 *identity = g_strdup_printf("Audacious %s", VERSION);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
261 return TRUE;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
262 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
263
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
264 // MPRIS /Player
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
265 gboolean mpris_player_next(MprisPlayer *obj, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
266 playlist_next(playlist_get_active());
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
267 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
268 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
269 gboolean mpris_player_prev(MprisPlayer *obj, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
270 playlist_prev(playlist_get_active());
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
271 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
272 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
273 gboolean mpris_player_pause(MprisPlayer *obj, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
274 playback_pause();
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
275 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
276 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
277 gboolean mpris_player_stop(MprisPlayer *obj, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
278 ip_data.stop = TRUE;
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
279 playback_stop();
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
280 ip_data.stop = FALSE;
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
281 mainwin_clear_song_info();
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
282 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
283 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
284 gboolean mpris_player_play(MprisPlayer *obj, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
285 if (playback_get_paused())
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
286 playback_pause();
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
287 else if (playlist_get_length(playlist_get_active()))
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
288 playback_initiate();
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
289 else
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
290 mainwin_eject_pushed();
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
291 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
292 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
293 gboolean mpris_player_repeat(MprisPlayer *obj, gboolean rpt, GError **error) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
294 mainwin_repeat_pushed(rpt);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
295 mainwin_set_noplaylistadvance(rpt);
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
296 return TRUE;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
297 }
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
298 gboolean mpris_player_quit(MprisPlayer *obj, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
299 mainwin_quit_cb();
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
300 return TRUE;
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
301 }
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
302 gboolean mpris_player_get_status(MprisPlayer *obj, gint *status,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
303 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
304 // check paused before playing because playback_get_playing() is true when
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
305 // paused as well as when playing
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
306 if (playback_get_paused())
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
307 *status = MPRIS_STATUS_PAUSE;
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
308 else if (playback_get_playing())
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
309 *status = MPRIS_STATUS_PLAY;
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
310 else
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
311 *status = MPRIS_STATUS_STOP;
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
312 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
313 }
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
314 gboolean mpris_player_get_metadata(MprisPlayer *obj, GHashTable **metadata,
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
315 GError **error) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
316 GHashTable *md = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
317 Tuple *tuple = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
318 GValue *value;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
319 Playlist *active;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
320
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
321 active = playlist_get_active();
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
322 gint pos = playlist_get_position(active);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
323 tuple = playlist_get_tuple(active, pos);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
324
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
325 md = mpris_metadata_from_tuple(tuple);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
326
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
327 if (md == NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
328 // there's no metadata for this track
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
329 return TRUE;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
330 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
331
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
332 // Song URI
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
333 value = g_new0(GValue, 1);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
334 g_value_init(value, G_TYPE_STRING);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
335 g_value_set_string(value, playlist_get_filename(active, pos));
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
336
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
337 g_hash_table_insert(md, "URI", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
338
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
339 *metadata = md;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
340
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
341 return TRUE;
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
342 }
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
343 gboolean mpris_player_get_caps(MprisPlayer *obj, gint *capabilities,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
344 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
345 *capabilities = MPRIS_CAPS_CAN_GO_NEXT |
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
346 MPRIS_CAPS_CAN_GO_PREV |
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
347 MPRIS_CAPS_CAN_PAUSE |
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
348 MPRIS_CAPS_CAN_PLAY |
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
349 MPRIS_CAPS_CAN_SEEK |
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
350 MPRIS_CAPS_CAN_PROVIDE_METADATA |
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
351 MPRIS_CAPS_PROVIDES_TIMING;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
352 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
353 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
354 gboolean mpris_player_volume_set(MprisPlayer *obj, gint vol, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
355 gint vl, vr, v;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
356
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
357 // get the current volume so we can maintain the balance
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
358 input_get_volume(&vl, &vr);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
359
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
360 // sanity check
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
361 vl = CLAMP(vl, 0, 100);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
362 vr = CLAMP(vr, 0, 100);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
363 v = CLAMP(vol, 0, 100);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
364
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
365 if (vl > vr) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
366 input_set_volume(v, (gint) rint(((gdouble) vr / vl) * v));
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
367 } else if (vl < vr) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
368 input_set_volume((gint) rint(((gdouble) vl / vr) * v), v);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
369 } else {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
370 input_set_volume(v, v);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
371 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
372 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
373 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
374 gboolean mpris_player_volume_get(MprisPlayer *obj, gint *vol,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
375 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
376 gint vl, vr;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
377 input_get_volume(&vl, &vr);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
378 // vl and vr may be different depending on the balance; the true volume is
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
379 // the maximum of vl or vr.
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
380 *vol = MAX(vl, vr);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
381 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
382 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
383 gboolean mpris_player_position_set(MprisPlayer *obj, gint pos,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
384 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
385 gint time = CLAMP(pos / 1000, 0,
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
386 playlist_get_current_length(playlist_get_active()) / 1000 - 1);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
387 playback_seek(time);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
388 return TRUE;
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
389 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
390 gboolean mpris_player_position_get(MprisPlayer *obj, gint *pos,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
391 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
392 if (playback_get_playing())
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
393 *pos = playback_get_time();
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
394 else
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
395 *pos = 0;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
396 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
397 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
398 // MPRIS /Player signals
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
399 gboolean mpris_emit_caps_change(MprisPlayer *obj) {
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
400 g_signal_emit(obj, signals[CAPS_CHANGE_SIG], 0, 0);
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
401 return TRUE;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
402 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
403
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
404 gboolean mpris_emit_track_change(MprisPlayer *obj) {
3827
fd86a88426f4 dbus: ensure that only proper UTF8 is sent over the wire.
William Pitcock <nenolod@atheme.org>
parents: 3490
diff changeset
405 GHashTable *metadata;
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
406 Tuple *tuple = NULL;
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
407 GValue *value;
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
408 Playlist *active;
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
409
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
410 active = playlist_get_active();
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
411 gint pos = playlist_get_position(active);
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
412 tuple = playlist_get_tuple(active, pos);
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
413
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
414 metadata = mpris_metadata_from_tuple(tuple);
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
415
3955
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
416 if (!metadata)
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
417 metadata = g_hash_table_new(g_str_hash, g_str_equal);
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
418
3955
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
419 // Song URI
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
420 value = g_new0(GValue, 1);
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
421 g_value_init(value, G_TYPE_STRING);
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
422 g_value_set_string(value, playlist_get_filename(active, pos));
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
423
37963a32f627 Fix misleading assertion triggers (Debian #451214)
William Pitcock <nenolod@atheme.org>
parents: 3929
diff changeset
424 g_hash_table_insert(metadata, "URI", value);
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
425
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
426 g_signal_emit(obj, signals[TRACK_CHANGE_SIG], 0, metadata);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
427 return TRUE;
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
428 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
429
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
430 gboolean mpris_emit_status_change(MprisPlayer *obj, PlaybackStatus status) {
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3344
diff changeset
431 g_signal_emit(obj, signals[STATUS_CHANGE_SIG], 0, status);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
432 return TRUE;
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
433 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
434
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
435 // MPRIS /TrackList
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
436 gboolean mpris_tracklist_get_metadata(MprisTrackList *obj, gint pos,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
437 GHashTable **metadata, GError **error) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
438 GHashTable *md = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
439 Tuple *tuple = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
440 GValue *value;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
441 Playlist *active;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
442
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
443 active = playlist_get_active();
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
444 tuple = playlist_get_tuple(active, pos);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
445
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
446 md = mpris_metadata_from_tuple(tuple);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
447
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
448 if (md == NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
449 // there's no metadata for this track
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
450 return TRUE;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
451 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
452
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
453 // Song URI
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
454 value = g_new0(GValue, 1);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
455 g_value_init(value, G_TYPE_STRING);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
456 g_value_set_string(value, playlist_get_filename(active, pos));
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
457
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
458 g_hash_table_insert(md, "URI", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
459
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
460 *metadata = md;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
461
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
462 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
463 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
464 gboolean mpris_tracklist_get_current_track(MprisTrackList *obj, gint *pos,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
465 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
466 *pos = playlist_get_position(playlist_get_active());
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
467 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
468 }
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
469 gboolean mpris_tracklist_get_length(MprisTrackList *obj, gint *length,
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
470 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
471 *length = playlist_get_length(playlist_get_active());
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
472 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
473 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
474 gboolean mpris_tracklist_add_track(MprisTrackList *obj, gchar *uri,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
475 gboolean play, GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
476 guint num_added;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
477 num_added = playlist_add_url(playlist_get_active(), uri);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
478 if (play && num_added > 0) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
479 gint pos = playlist_get_length(playlist_get_active()) - 1;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
480 playlist_set_position(playlist_get_active(), pos);
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
481 playback_initiate();
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
482 }
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
483 // TODO: set an error if num_added == 0
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
484 return TRUE;
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
485 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
486 gboolean mpris_tracklist_del_track(MprisTrackList *obj, gint pos,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
487 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
488 playlist_delete_index(playlist_get_active(), pos);
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
489 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
490 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
491 gboolean mpris_tracklist_loop(MprisTrackList *obj, gboolean loop,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
492 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
493 mainwin_repeat_pushed(loop);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
494 if (loop) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
495 mainwin_set_noplaylistadvance(FALSE);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
496 mainwin_set_stopaftersong(FALSE);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
497 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
498 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
499 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
500 gboolean mpris_tracklist_random(MprisTrackList *obj, gboolean random,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
501 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
502 mainwin_shuffle_pushed(random);
3268
8af43e099cce Added function prototypes for Disconnect and GetMetadata methods, and a prototype for the Disconnected signal.
Ben Tucker <ben.tucker@gmail.com>
parents: 3165
diff changeset
503 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
504 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
505
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
506 // Audacious General Information
3873
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
507 gboolean audacious_rc_version(RemoteObject *obj, gchar **version, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
508 *version = g_strdup(VERSION);
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
509 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
510 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
511
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
512 gboolean audacious_rc_quit(RemoteObject *obj, GError **error) {
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
513 mainwin_quit_cb();
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
514 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
515 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
516
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
517 gboolean audacious_rc_eject(RemoteObject *obj, GError **error) {
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
518 if (has_x11_connection)
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
519 mainwin_eject_pushed();
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
520 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
521 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
522
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
523 gboolean audacious_rc_main_win_visible(RemoteObject *obj,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
524 gboolean *is_main_win, GError **error) {
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
525 *is_main_win = cfg.player_visible;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
526 g_message("main win %s\n", (cfg.player_visible? "visible" : "hidden"));
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
527 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
528 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
529
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
530 gboolean audacious_rc_show_main_win(RemoteObject *obj, gboolean show,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
531 GError **error) {
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
532 g_message("%s main win\n", (show? "showing": "hiding"));
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
533 if (has_x11_connection)
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
534 mainwin_show(show);
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
535 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
536 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
537
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
538 gboolean audacious_rc_equalizer_visible(RemoteObject *obj,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
539 gboolean *is_eq_win, GError **error) {
2741
e4c08b7023a0 [svn] - fix cfg options for visibility
giacomo
parents: 2733
diff changeset
540 *is_eq_win = cfg.equalizer_visible;
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
541 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
542 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
543
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
544 gboolean audacious_rc_show_equalizer(RemoteObject *obj, gboolean show,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
545 GError **error) {
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
546 if (has_x11_connection)
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
547 equalizerwin_show(show);
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
548 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
549 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
550
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
551 gboolean audacious_rc_playlist_visible(RemoteObject *obj, gboolean *is_pl_win,
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
552 GError **error) {
2741
e4c08b7023a0 [svn] - fix cfg options for visibility
giacomo
parents: 2733
diff changeset
553 *is_pl_win = cfg.playlist_visible;
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
554 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
555 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
556
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
557 gboolean audacious_rc_show_playlist(RemoteObject *obj, gboolean show,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
558 GError **error) {
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
559 if (has_x11_connection) {
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
560 if (show)
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
561 playlistwin_show();
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
562 else
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
563 playlistwin_hide();
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
564 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
565 return TRUE;
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
566 }
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
567
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
568 // Playback Information/Manipulation
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
569 gboolean audacious_rc_play(RemoteObject *obj, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
570 if (playback_get_paused())
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
571 playback_pause();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
572 else if (playlist_get_length(playlist_get_active()))
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
573 playback_initiate();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
574 else
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
575 mainwin_eject_pushed();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
576 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
577 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
578
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
579 gboolean audacious_rc_pause(RemoteObject *obj, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
580 playback_pause();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
581 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
582 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
583
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
584 gboolean audacious_rc_stop(RemoteObject *obj, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
585 ip_data.stop = TRUE;
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
586 playback_stop();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
587 ip_data.stop = FALSE;
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
588 mainwin_clear_song_info();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
589 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
590 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
591
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
592 gboolean audacious_rc_playing(RemoteObject *obj, gboolean *is_playing,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
593 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
594 *is_playing = playback_get_playing();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
595 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
596 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
597
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
598 gboolean audacious_rc_paused(RemoteObject *obj, gboolean *is_paused,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
599 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
600 *is_paused = playback_get_paused();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
601 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
602 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
603
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
604 gboolean audacious_rc_stopped(RemoteObject *obj, gboolean *is_stopped,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
605 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
606 *is_stopped = !playback_get_playing();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
607 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
608 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
609
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
610 gboolean audacious_rc_status(RemoteObject *obj, gchar **status,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
611 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
612 if (playback_get_paused())
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
613 *status = g_strdup("paused");
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
614 else if (playback_get_playing())
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
615 *status = g_strdup("playing");
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
616 else
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
617 *status = g_strdup("stopped");
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
618 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
619 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
620
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
621 gboolean audacious_rc_info(RemoteObject *obj, gint *rate, gint *freq,
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
622 gint *nch, GError **error) {
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
623 playback_get_sample_params(rate, freq, nch);
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
624 return TRUE;
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
625 }
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
626
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
627 gboolean audacious_rc_time(RemoteObject *obj, gint *time, GError **error) {
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
628 if (playback_get_playing())
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
629 *time = playback_get_time();
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
630 else
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
631 *time = 0;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
632 return TRUE;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
633 }
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
634
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
635 gboolean audacious_rc_seek(RemoteObject *obj, guint pos, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
636 if (playlist_get_current_length(playlist_get_active()) > 0 &&
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
637 pos < (guint)playlist_get_current_length(playlist_get_active()))
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
638 playback_seek(pos / 1000);
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
639
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
640 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
641 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
642
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
643 gboolean audacious_rc_volume(RemoteObject *obj, gint *vl, gint *vr,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
644 GError **error) {
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
645 input_get_volume(vl, vr);
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
646 return TRUE;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
647 }
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
648
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
649 gboolean audacious_rc_set_volume(RemoteObject *obj, gint vl, gint vr,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
650 GError **error) {
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
651 if (vl > 100)
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
652 vl = 100;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
653 if (vr > 100)
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
654 vr = 100;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
655 input_set_volume(vl, vr);
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
656 return TRUE;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
657 }
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
658
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
659 gboolean audacious_rc_balance(RemoteObject *obj, gint *balance,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
660 GError **error) {
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
661 gint vl, vr;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
662 input_get_volume(&vl, &vr);
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
663 if (vl < 0 || vr < 0)
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
664 *balance = 0;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
665 else if (vl > vr)
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
666 *balance = -100 + ((vr * 100) / vl);
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
667 else if (vr > vl)
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
668 *balance = 100 - ((vl * 100) / vr);
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
669 else
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
670 *balance = 0;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
671 return TRUE;
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
672 }
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2706
diff changeset
673
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
674 // Playlist Information/Manipulation
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
675 gboolean audacious_rc_position(RemoteObject *obj, gint *pos, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
676 *pos = playlist_get_position(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
677 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
678 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
679
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
680 gboolean audacious_rc_advance(RemoteObject *obj, GError **error) {
2696
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
681 playlist_next(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
682 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
683 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
684
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
685 gboolean audacious_rc_reverse(RemoteObject *obj, GError **error) {
2696
c00850315ce1 [svn] Fixed licensing issues and DBus node/interface names. Also implemented playlist advance and reverse.
magma
parents: 2695
diff changeset
686 playlist_prev(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
687 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
688 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
689
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
690 gboolean audacious_rc_length(RemoteObject *obj, gint *length,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
691 GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
692 *length = playlist_get_length(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
693 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
694 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
695
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
696 gboolean audacious_rc_song_title(RemoteObject *obj, guint pos,
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
697 gchar **title, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
698 *title = playlist_get_songtitle(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
699 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
700 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
701
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
702 gboolean audacious_rc_song_filename(RemoteObject *obj, guint pos,
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
703 gchar **filename, GError **error) {
2814
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
704 gchar *tmp = NULL;
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
705 tmp = playlist_get_filename(playlist_get_active(), pos);
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
706
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
707 if(tmp){
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
708 *filename = str_to_utf8(tmp);
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
709 }
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
710 free(tmp);
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
711 tmp = NULL;
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
712
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
713 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
714 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
715
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
716 gboolean audacious_rc_song_length(RemoteObject *obj, guint pos, gint *length,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
717 GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
718 *length = playlist_get_songtime(playlist_get_active(), pos) / 1000;
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
719 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
720 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
721
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
722 gboolean audacious_rc_song_frames(RemoteObject *obj, guint pos, gint *length,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
723 GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
724 *length = playlist_get_songtime(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
725 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
726 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
727
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
728 gboolean audacious_rc_song_tuple(RemoteObject *obj, guint pos, gchar *field,
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
729 GValue *value, GError **error) {
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
730 Tuple *tuple;
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
731 tuple = playlist_get_tuple(playlist_get_active(), pos);
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
732 if (!tuple) {
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
733 return FALSE;
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
734 } else {
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3348
diff changeset
735 TupleValueType type = tuple_get_value_type(tuple, -1, field);
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
736
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
737 switch(type)
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
738 {
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
739 case TUPLE_STRING:
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
740 g_value_init(value, G_TYPE_STRING);
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3348
diff changeset
741 g_value_set_string(value, tuple_get_string(tuple, -1, field));
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
742 break;
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
743 case TUPLE_INT:
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
744 g_value_init(value, G_TYPE_INT);
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3348
diff changeset
745 g_value_set_int(value, tuple_get_int(tuple, -1, field));
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
746 break;
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
747 default:
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
748 return FALSE;
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
749 break;
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
750 }
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
751 }
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
752 return TRUE;
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
753 }
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
754
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
755 gboolean audacious_rc_jump(RemoteObject *obj, guint pos, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
756 if (pos < (guint)playlist_get_length(playlist_get_active()))
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
757 playlist_set_position(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
758 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
759 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
760
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
761 gboolean audacious_rc_add(RemoteObject *obj, gchar *file, GError **error) {
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
762 playlist_add_url(playlist_get_active(), file);
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
763 return TRUE;
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
764 }
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
765 gboolean audacious_rc_add_url(RemoteObject *obj, gchar *url, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
766 playlist_add_url(playlist_get_active(), url);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
767 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
768 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
769
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
770 gboolean audacious_rc_delete(RemoteObject *obj, guint pos, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
771 playlist_delete_index(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
772 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
773 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
774
2733
cf080b11c3fa [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.
magma
parents: 2728
diff changeset
775 gboolean audacious_rc_clear(RemoteObject *obj, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
776 playlist_clear(playlist_get_active());
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
777 mainwin_clear_song_info();
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
778 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
779 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
780
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
781 gboolean audacious_rc_auto_advance(RemoteObject *obj, gboolean *is_advance,
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
782 GError **error) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
783 *is_advance = cfg.no_playlist_advance;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
784 return TRUE;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
785 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
786
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
787 gboolean audacious_rc_toggle_auto_advance(RemoteObject *obj, GError **error) {
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
788 cfg.no_playlist_advance = !cfg.no_playlist_advance;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
789 return TRUE;
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
790 }
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
791
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
792 gboolean audacious_rc_repeat(RemoteObject *obj, gboolean *is_repeating,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
793 GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
794 *is_repeating = cfg.repeat;
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
795 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
796 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
797
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
798 gboolean audacious_rc_toggle_repeat(RemoteObject *obj, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
799 mainwin_repeat_pushed(!cfg.repeat);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
800 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
801 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
802
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
803 gboolean audacious_rc_shuffle(RemoteObject *obj, gboolean *is_shuffling,
2766
ea20b1e92411 [svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
magma
parents: 2741
diff changeset
804 GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
805 *is_shuffling = cfg.shuffle;
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
806 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
807 }
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
808
2769
bf2d80abf76e [svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents: 2766
diff changeset
809 gboolean audacious_rc_toggle_shuffle(RemoteObject *obj, GError **error) {
2706
958d12f78138 [svn] Completed the implementation of all the stubs in dbus.c, and commented the creation of the mpris dbus bindings to fix compilation issues.
magma
parents: 2702
diff changeset
810 mainwin_shuffle_pushed(!cfg.shuffle);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
811 return TRUE;
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
diff changeset
812 }
2785
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
813
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
814 /* New on Oct 5 */
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
815 gboolean audacious_rc_show_prefs_box(RemoteObject *obj, gboolean show, GError **error) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
816 if (has_x11_connection) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
817 if (show)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
818 show_prefs_window();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
819 else
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
820 hide_prefs_window();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
821 }
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
822 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
823 }
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
824 gboolean audacious_rc_show_about_box(RemoteObject *obj, gboolean show, GError **error) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
825 if (has_x11_connection) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
826 if (show)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
827 show_about_window();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
828 else
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
829 hide_about_window();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
830 }
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
831 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
832 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
833
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
834 gboolean audacious_rc_show_jtf_box(RemoteObject *obj, gboolean show, GError **error) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
835 if (has_x11_connection) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
836 if (show)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
837 ui_jump_to_track();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
838 else
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
839 ui_jump_to_track_hide();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
840 }
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
841 return TRUE;
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
842 }
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
843
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
844 gboolean audacious_rc_show_filebrowser(RemoteObject *obj, gboolean show, GError **error)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
845 {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
846 if (has_x11_connection) {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
847 if (show)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
848 run_filebrowser(FALSE);
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
849 else
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
850 hide_filebrowser();
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
851 }
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
852 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
853 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
854
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
855 gboolean audacious_rc_play_pause(RemoteObject *obj, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
856 if (playback_get_playing())
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
857 playback_pause();
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
858 else
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
859 playback_initiate();
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
860 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
861 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
862
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
863 gboolean audacious_rc_activate(RemoteObject *obj, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
864 gtk_window_present(GTK_WINDOW(mainwin));
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
865 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
866 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
868 gboolean audacious_rc_get_skin(RemoteObject *obj, gchar **skin, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
869 *skin = g_strdup(bmp_active_skin->path);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
870 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
871 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
872
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
873 gboolean audacious_rc_set_skin(RemoteObject *obj, gchar *skin, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
874 if (has_x11_connection == TRUE)
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
875 bmp_active_skin_load(skin);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
876 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
877 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
878
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
879 gboolean audacious_rc_get_info(RemoteObject *obj, gint *rate, gint *freq, gint *nch, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
880 playback_get_sample_params(rate, freq, nch);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
881 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
882 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
883
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
884 gboolean audacious_rc_toggle_aot(RemoteObject *obj, gboolean ontop, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
885 if (has_x11_connection) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
886 mainwin_set_always_on_top(ontop);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
887 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
888 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
889 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
890
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
891 /* New on Oct 9: Queue */
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
892 gboolean audacious_rc_playqueue_add(RemoteObject *obj, gint pos, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
893 if (pos < (guint)playlist_get_length(playlist_get_active()))
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
894 playlist_queue_position(playlist_get_active(), pos);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
895 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
896 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
897
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
898 gboolean audacious_rc_playqueue_remove(RemoteObject *obj, gint pos, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
899 if (pos < (guint)playlist_get_length(playlist_get_active()))
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
900 playlist_queue_remove(playlist_get_active(), pos);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
901 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
902 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
903
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
904 gboolean audacious_rc_playqueue_clear(RemoteObject *obj, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
905 playlist_clear_queue(playlist_get_active());
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
906 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
907 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
908
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
909 gboolean audacious_rc_get_playqueue_length(RemoteObject *obj, gint *length, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
910 *length = playlist_queue_get_length(playlist_get_active());
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
911 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
912 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
913
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
914 gboolean audacious_rc_queue_get_list_pos(RemoteObject *obj, gint qpos, gint *pos, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
915 if (playback_get_playing())
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
916 *pos = playlist_get_queue_qposition_number(playlist_get_active(), qpos);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
917
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
918 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
919 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
920
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
921 gboolean audacious_rc_queue_get_queue_pos(RemoteObject *obj, gint pos, gint *qpos, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
922 if (playback_get_playing())
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
923 *qpos = playlist_get_queue_position_number(playlist_get_active(), pos);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
924
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
925 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
926 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
927
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
928 gboolean audacious_rc_playqueue_is_queued(RemoteObject *obj, gint pos, gboolean *is_queued, GError **error) {
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
929 *is_queued = playlist_is_position_queued(playlist_get_active(), pos);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
930 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
931 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
932
3873
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
933 gboolean audacious_rc_playlist_ins_url_string(RemoteObject *obj, gchar *url, gint pos, GError **error) {
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
934 if (pos >= 0 && url && strlen(url)) {
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
935 playlist_ins_url(playlist_get_active(), url, pos);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
936 }
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
937 return TRUE;
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
938 }
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
939
3873
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
940 static void call_playlist_add_url(GList *list, gpointer *data) {
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
941 playlist_add_url(playlist_get_active(), list->data);
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
942 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
943
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
944 gboolean audacious_rc_playlist_add(RemoteObject *obj, gpointer list, GError **error) {
3873
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
945 g_list_foreach((GList *)list, (GFunc)call_playlist_add_url, NULL);
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
946 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
947 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
948
3873
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
949 gboolean audacious_rc_playlist_enqueue_to_temp(RemoteObject *obj, gchar *url, GError **error) {
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
950 GList *playlists = NULL;
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
951 Playlist *new_pl = playlist_new();
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
952 gchar *pl_name = NULL;
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
953
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
954 pl_name = (gchar*)playlist_get_current_name(new_pl);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
955 if(!pl_name)
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
956 pl_name = g_strdup("New Playlist");
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
957 playlist_set_current_name(new_pl, pl_name);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
958 g_free(pl_name);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
959
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
960 playlists = playlist_get_playlists();
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
961 playlist_add_playlist(new_pl);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
962
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
963 // DISABLE_MANAGER_UPDATE();
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
964 playlist_select_playlist(new_pl);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
965 // ENABLE_MANAGER_UPDATE();
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
966
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
967 playlist_add_url(new_pl, url);
f3341c2d6b9e audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3867
diff changeset
968
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
969 return TRUE;
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
970 }
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
971
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
972 /* New on Nov 7: Equalizer */
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
973 gboolean audacious_rc_get_eq(RemoteObject *obj, gdouble *preamp, GArray **bands, GError **error)
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
974 {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
975 int i;
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
976
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
977 *preamp = (gdouble)equalizerwin_get_preamp();
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
978 *bands = g_array_sized_new(FALSE, FALSE, sizeof(gdouble), 10);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
979
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
980 for(i=0; i<10; i++){
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
981 gdouble val = (gdouble)equalizerwin_get_band(i);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
982 g_array_append_val(*bands, val);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
983 }
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
984
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
985 return TRUE;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
986 }
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
987
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
988 gboolean audacious_rc_get_eq_preamp(RemoteObject *obj, gdouble *preamp, GError **error)
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
989 {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
990 *preamp = (gdouble)equalizerwin_get_preamp();
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
991 return TRUE;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
992 }
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
993
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
994 gboolean audacious_rc_get_eq_band(RemoteObject *obj, gint band, gdouble *value, GError **error)
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
995 {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
996 *value = (gdouble)equalizerwin_get_band(band);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
997 return TRUE;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
998 }
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
999
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1000 gboolean audacious_rc_set_eq(RemoteObject *obj, gdouble preamp, GArray *bands, GError **error)
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1001 {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1002 gdouble element;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1003 int i;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1004
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1005 equalizerwin_set_preamp((gfloat)preamp);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1006
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1007 for (i = 0; i < 10; i++) {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1008 element = g_array_index(bands, gdouble, i);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1009 equalizerwin_set_band(i, (gfloat)element);
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1010 }
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1011 equalizerwin_eq_changed();
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1012
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1013 return TRUE;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1014 }
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1015
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1016 gboolean audacious_rc_set_eq_preamp(RemoteObject *obj, gdouble preamp, GError **error)
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1017 {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1018 equalizerwin_set_preamp((gfloat)preamp);
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1019 equalizerwin_eq_changed();
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1020 return TRUE;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1021 }
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1022
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1023 gboolean audacious_rc_set_eq_band(RemoteObject *obj, gint band, gdouble value, GError **error)
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1024 {
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1025 equalizerwin_set_band(band, (gfloat)value);
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1026 equalizerwin_eq_changed();
3915
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1027 return TRUE;
86c9abc83fbd audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3888
diff changeset
1028 }
3867
e48f2f4c116d - many remained audacious remote functions have been implemented.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3827
diff changeset
1029
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1030 gboolean audacious_rc_equalizer_activate(RemoteObject *obj, gboolean active, GError **error)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1031 {
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1032 equalizer_activate(active);
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1033 return TRUE;
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1034 }
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1035
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3915
diff changeset
1036
2785
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1037 DBusGProxy *audacious_get_dbus_proxy(void)
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1038 {
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1039 DBusGConnection *connection = NULL;
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1040 GError *error = NULL;
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1041 connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1042 g_clear_error(&error);
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1043 return dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1044 AUDACIOUS_DBUS_PATH,
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1045 AUDACIOUS_DBUS_INTERFACE);
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
1046 }