annotate src/audacious/dbus.c @ 3344:c03055ef8822 trunk

-Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet -Implemented /TrackList Loop and GetMetadata -Fixed /TrackList Random so that it toggles shuffle mode based on the passed argument instead of the current state -Modified /TrackList AddTrack so that it will not start playing if the add failed (pending mods to playlist.c by yaz)
author Ben Tucker <ben.tucker@gmail.com>
date Sun, 12 Aug 2007 13:26:02 -0700
parents 904c58081f0a
children 71d8d93f1bad
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>
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
26 #include <dbus/dbus-glib-bindings.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
27 #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
28 #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
29 #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
30
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
31 #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
32 #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
33 #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
34 #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
35 #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
36 #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
37 #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
38 #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
39 #include "ui_preferences.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 "memorypool.h"
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
41 #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
42 #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
43 #include "strings.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
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
45 static DBusGConnection *dbus_conn = NULL;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
46 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
47
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
48 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
49 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
50 G_DEFINE_TYPE(MprisPlayer, mpris_player, G_TYPE_OBJECT);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
51 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
52
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
53 #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
54
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
55 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
56 void mpris_root_class_init(MprisRootClass *klass) {}
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
57
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
58 void mpris_player_class_init(MprisPlayerClass *klass) {
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
59 signals[CAPS_CHANGE_SIG] =
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
60 g_signal_new("caps_change",
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
61 G_OBJECT_CLASS_TYPE(klass),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
62 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
63 0,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
64 NULL, NULL,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
65 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
66 G_TYPE_NONE, 1, G_TYPE_INT);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
67 signals[TRACK_CHANGE_SIG] =
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
68 g_signal_new("track_change",
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
69 G_OBJECT_CLASS_TYPE(klass),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
70 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
71 0,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
72 NULL, NULL,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
73 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
74 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
75 signals[STATUS_CHANGE_SIG] =
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
76 g_signal_new("status_change",
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
77 G_OBJECT_CLASS_TYPE(klass),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
78 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
79 0,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
80 NULL, NULL,
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
81 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
82 G_TYPE_NONE, 1, G_TYPE_INT);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
83 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
84
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
85 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
86
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
87 void audacious_rc_init(RemoteObject *object) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
88 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
89 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
90 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
91
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
92
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
93 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
94 &dbus_glib_audacious_rc_object_info);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
95
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
96 // 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
97 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
98 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
99
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
100 // 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
101 // 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
102 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
103 DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
104 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
105
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
106 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
107 AUDACIOUS_DBUS_SERVICE, 0, &request_ret, &error)) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
108 g_warning("Unable to register service: %s", error->message);
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
109 g_error_free(error);
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
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
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
112 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
113 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
114 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
115 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
116 }
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
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
118 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
119 }
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
120
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
121 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
122 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
123 &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
124
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
125 // 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
126 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
127 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
128 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
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
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 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
132 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
133 &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
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 // 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
136 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
137 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
138 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
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
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
141 void mpris_tracklist_init(MprisTrackList *object) {
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
142 dbus_g_object_type_install_info(mpris_tracklist_get_type(),
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
143 &dbus_glib_mpris_tracklist_object_info);
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
144
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
145 // Register DBUS path
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
146 dbus_g_connection_register_g_object(dbus_conn,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
147 AUDACIOUS_DBUS_PATH_MPRIS_TRACKLIST,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
148 G_OBJECT(object));
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
149 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
150
2700
2d1837805ca4 [svn] Improved DBus initialization and fixed a warning.
magma
parents: 2696
diff changeset
151 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
152 GError *error = 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
153 // 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
154 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
155 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
156 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
157 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
158 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
159 }
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
160
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
161 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
162 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
163 g_object_new(mpris_root_get_type(), 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
164 g_object_new(mpris_player_get_type(), NULL);
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
165 g_object_new(mpris_tracklist_get_type(), NULL);
2728
452a159dc619 [svn] - log when dbus has been successfully started up
nenolod
parents: 2717
diff changeset
166 g_message("D-Bus support has been activated");
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
167 }
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
168
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
169 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
170 GValue *val;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
171 TupleValueType type;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
172 type = tuple_get_value_type(tuple, key);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
173 if (type == TUPLE_STRING) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
174 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
175 g_value_init(val, G_TYPE_STRING);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
176 g_value_set_string(val, tuple_get_string(tuple, key));
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
177 return val;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
178 } 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
179 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
180 g_value_init(val, G_TYPE_INT);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
181 g_value_set_int(val, tuple_get_int(tuple, key));
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
182 return val;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
183 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
184 return NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
185 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
186
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
187 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
188 GHashTable *md = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
189 GValue *value;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
190
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
191 if (tuple == NULL)
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
192 return NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
193
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
194 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
195
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
196 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
197 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
198 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
199 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
200
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
201 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
202 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
203 g_hash_table_insert(md, "name", value);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
204 }
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 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
207 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
208 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
209 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
210
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
211 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
212 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
213 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
214 }
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 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
217 if (value != NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
218 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
219 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
220
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
221 return md;
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
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
224 /* MPRIS API */
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
225 // 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
226 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
227 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
228 *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
229 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
230 }
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
231
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
232 // 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
233 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
234 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
235 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
236 }
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
237 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
238 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
239 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
240 }
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
241 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
242 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
243 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
244 }
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
245 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
246 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
247 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
248 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
249 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
250 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
251 }
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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 }
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 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
262 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
263 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
264 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
265 }
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
266 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
267 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
268 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
269 }
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
270 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
271 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
272 // 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
273 // 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
274 if (playback_get_paused())
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
275 *status = 1;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
276 else 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
277 *status = 0;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
278 else
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
279 *status = 2;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
280 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
281 }
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
282 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
283 GError **error) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
284 GHashTable *md = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
285 Tuple *tuple = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
286 GValue *value;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
287 Playlist *active;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
288
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
289 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
290 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
291 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
292
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
293 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
294
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
295 if (md == NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
296 // 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
297 return TRUE;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
298 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
299
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
300 // Song URI
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
301 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
302 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
303 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
304
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
305 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
306
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
307 *metadata = md;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
308
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
309 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
310 }
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
311 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
312 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
313 *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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 }
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
322 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
323 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
324
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
325 // 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
326 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
327
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
328 // sanity check
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
329 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
330 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
331 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
332
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
333 if (vl > vr) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
334 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
335 } 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
336 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
337 } else {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
338 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
339 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
340 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
341 }
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
342 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
343 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
344 gint vl, vr;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
345 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
346 // 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
347 // 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
348 *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
349 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
350 }
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
351 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
352 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
353 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
354 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
355 playback_seek(time);
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
356 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
357 }
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
358 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
359 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
360 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
361 *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
362 else
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
363 *pos = 0;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
364 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
365 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
366 // MPRIS /Player signals
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
367 gboolean mpris_player_emit_caps_change(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
368 static GQuark quark;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
369 if (!quark)
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
370 quark = g_quark_from_static_string("CapsChange");
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
371 g_signal_emit(obj, signals[CAPS_CHANGE_SIG], quark, "capabilities changed");
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
372 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
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
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
375 gboolean mpris_player_emit_track_change(MprisPlayer *obj, GError **error) {
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
376 g_signal_emit(obj, signals[TRACK_CHANGE_SIG], 0, "track changed");
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
377 return TRUE;
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
378 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
379
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
380 gboolean mpris_player_emit_status_change(MprisPlayer *obj, GError **error) {
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
381 g_signal_emit(obj, signals[STATUS_CHANGE_SIG], 0, "status changed");
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
382 return TRUE;
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
383 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
384
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
385 // MPRIS /TrackList
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
386 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
387 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
388 GHashTable *md = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
389 Tuple *tuple = NULL;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
390 GValue *value;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
391 Playlist *active;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
392
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
393 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
394 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
395
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
396 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
397
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
398 if (md == NULL) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
399 // 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
400 return TRUE;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
401 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
402
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
403 // Song URI
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
404 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
405 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
406 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
407
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
408 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
409
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
410 *metadata = md;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
411
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
412 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
413 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
414 gboolean mpris_tracklist_get_current_track(MprisTrackList *obj, gint *pos,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
415 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
416 *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
417 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
418 }
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
419 gboolean mpris_tracklist_get_length(MprisTrackList *obj, gint *length,
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
420 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
421 *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
422 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
423 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
424 gboolean mpris_tracklist_add_track(MprisTrackList *obj, gchar *uri,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
425 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
426 guint num_added;
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
427 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
428 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
429 gint pos = playlist_get_length(playlist_get_active()) - 1;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
430 playlist_set_position(playlist_get_active(), pos);
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
431 playback_initiate();
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
432 }
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
433 // TODO: set an error if num_added == 0
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
434 return TRUE;
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
435 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
436 gboolean mpris_tracklist_del_track(MprisTrackList *obj, gint pos,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
437 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
438 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
439 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
440 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
441 gboolean mpris_tracklist_loop(MprisTrackList *obj, gboolean loop,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
442 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
443 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
444 if (loop) {
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
445 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
446 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
447 }
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
448 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
449 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
450 gboolean mpris_tracklist_random(MprisTrackList *obj, gboolean random,
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
451 GError **error) {
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
452 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
453 return TRUE;
2771
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
454 }
4585019eb82e [svn] -Renamed MPRIS /TrackList Shuffle method to Random
magma
parents: 2769
diff changeset
455
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
456 // Audacious General Information
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
457 gboolean audacious_rc_version(RemoteObject *obj, gchar **version,
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
458 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
459 *version = g_strdup(VERSION);
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
460 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
461 }
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
462
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
463 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
464 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
465 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
466 }
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
467
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
468 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
469 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
470 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
471 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
472 }
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
473
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
474 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
475 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
476 *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
477 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
478 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
479 }
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
480
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
481 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
482 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
483 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
484 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
485 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
486 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
487 }
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
488
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
489 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
490 gboolean *is_eq_win, GError **error) {
2741
e4c08b7023a0 [svn] - fix cfg options for visibility
giacomo
parents: 2733
diff changeset
491 *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
492 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
493 }
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
494
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
495 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
496 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
497 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
498 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
499 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
500 }
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
501
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
502 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
503 GError **error) {
2741
e4c08b7023a0 [svn] - fix cfg options for visibility
giacomo
parents: 2733
diff changeset
504 *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
505 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
506 }
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
507
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
508 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
509 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
510 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
511 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
512 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
513 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
514 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
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 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
517 }
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
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
519 // 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
520 gboolean audacious_rc_play(RemoteObject *obj, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
521 if (playback_get_paused())
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
522 playback_pause();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
523 else if (playlist_get_length(playlist_get_active()))
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
524 playback_initiate();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
525 else
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
526 mainwin_eject_pushed();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
527 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
528 }
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
529
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
530 gboolean audacious_rc_pause(RemoteObject *obj, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
531 playback_pause();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
532 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
533 }
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
534
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
535 gboolean audacious_rc_stop(RemoteObject *obj, GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
536 ip_data.stop = TRUE;
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
537 playback_stop();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
538 ip_data.stop = FALSE;
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
539 mainwin_clear_song_info();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
540 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
541 }
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
542
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
543 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
544 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
545 *is_playing = playback_get_playing();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
546 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
547 }
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
548
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
549 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
550 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
551 *is_paused = playback_get_paused();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
552 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
553 }
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
554
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
555 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
556 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
557 *is_stopped = !playback_get_playing();
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
558 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
559 }
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
560
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
561 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
562 GError **error) {
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
563 if (playback_get_paused())
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
564 *status = g_strdup("paused");
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
565 else if (playback_get_playing())
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
566 *status = g_strdup("playing");
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
567 else
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
568 *status = g_strdup("stopped");
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
569 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
570 }
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
571
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
572 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
573 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
574 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
575 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
576 }
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
577
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
578 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
579 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
580 *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
581 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
582 *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
583 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
584 }
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
585
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
586 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
587 if (playlist_get_current_length(playlist_get_active()) > 0 &&
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
588 pos < (guint)playlist_get_current_length(playlist_get_active()))
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
589 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
590
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
591 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
592 }
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
593
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
594 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
595 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
596 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
597 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
598 }
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
599
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
600 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
601 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
602 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
603 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
604 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
605 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
606 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
607 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
608 }
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
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_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
611 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
612 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
613 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
614 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
615 *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
616 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
617 *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
618 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
619 *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
620 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
621 *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
622 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
623 }
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
624
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
625 // 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
626 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
627 *pos = playlist_get_position(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
628 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
629 }
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
630
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
631 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
632 playlist_next(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
633 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
634 }
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
635
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
636 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
637 playlist_prev(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
638 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
639 }
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
640
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
641 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
642 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
643 *length = playlist_get_length(playlist_get_active());
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
644 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
645 }
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
646
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
647 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
648 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
649 *title = playlist_get_songtitle(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
650 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
651 }
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
652
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
653 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
654 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
655 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
656 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
657
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
658 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
659 *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
660 }
77a012c3b521 [svn] - give default values to audacious_remote_* functions. if dbus call fails, default value will be returned.
yaz
parents: 2785
diff changeset
661 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
662 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
663
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
664 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
665 }
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
666
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
667 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
668 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
669 *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
670 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
671 }
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
672
3344
c03055ef8822 -Implemented /Player GetStatus, GetMetadata, GetCaps, PositionGet, PositionSet, VolumeGet, and VolumeSet
Ben Tucker <ben.tucker@gmail.com>
parents: 3336
diff changeset
673 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
674 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
675 *length = playlist_get_songtime(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
676 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
677 }
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
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
679 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
680 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
681 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
682 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
683 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
684 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
685 } else {
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
686 TupleValueType type = tuple_get_value_type(tuple, field);
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
687
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
688 switch(type)
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
689 {
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
690 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
691 g_value_init(value, G_TYPE_STRING);
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
692 g_value_set_string(value, tuple_get_string(tuple, field));
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
693 break;
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
694 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
695 g_value_init(value, G_TYPE_INT);
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
696 g_value_set_int(value, tuple_get_int(tuple, field));
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
697 break;
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
698 default:
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
699 return FALSE;
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3268
diff changeset
700 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
701 }
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 }
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 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
704 }
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
705
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
706 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
707 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
708 playlist_set_position(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
709 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
710 }
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
711
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
712 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
713 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
714 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
715 }
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
716 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
717 playlist_add_url(playlist_get_active(), url);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
718 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
719 }
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
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
721 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
722 playlist_delete_index(playlist_get_active(), pos);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
723 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
724 }
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
725
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
726 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
727 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
728 mainwin_clear_song_info();
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
729 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
730 }
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
731
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
732 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
733 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
734 *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
735 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
736 }
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
737
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
738 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
739 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
740 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
741 }
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
742
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
743 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
744 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
745 *is_repeating = cfg.repeat;
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
746 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
747 }
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
748
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
749 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
750 mainwin_repeat_pushed(!cfg.repeat);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
751 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
752 }
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
753
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
754 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
755 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 *is_shuffling = cfg.shuffle;
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
757 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
758 }
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
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
760 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
761 mainwin_shuffle_pushed(!cfg.shuffle);
2695
4c4c8b294287 [svn] Fixed formatting. Tabs + tw=2 ==> spaces + tw=4.
magma
parents: 2694
diff changeset
762 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
763 }
2785
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
764
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
765 DBusGProxy *audacious_get_dbus_proxy(void)
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
766 {
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
767 DBusGConnection *connection = NULL;
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
768 GError *error = NULL;
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
769 connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
770 g_clear_error(&error);
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
771 return dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
772 AUDACIOUS_DBUS_PATH,
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
773 AUDACIOUS_DBUS_INTERFACE);
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2771
diff changeset
774 }