Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
mpris-signals.c
Go to the documentation of this file.
1 /* Audacious - Cross-platform multimedia player
2  * Copyright (C) 2005-2011 Audacious development team.
3  *
4  * Based on BMP:
5  * Copyright (C) 2003-2004 BMP development team.
6  *
7  * Based on XMMS:
8  * Copyright (C) 1998-2003 XMMS development team.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; under version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses>.
21  *
22  * The Audacious team does not consider modular code linking to
23  * Audacious or using our public API to be a derived work.
24  */
25 
26 #ifdef USE_DBUS
27 
28 #include "dbus-service.h"
29 #include "main.h"
30 
31 static void mpris_status_cb (void * hook_data, void * user_data)
32 {
33  mpris_emit_status_change (mpris, GPOINTER_TO_INT (user_data));
34 }
35 #endif
36 
37 void mpris_signals_init (void)
38 {
39 #ifdef USE_DBUS
40  hook_associate ("playback begin", mpris_status_cb, GINT_TO_POINTER
42  hook_associate ("playback pause", mpris_status_cb, GINT_TO_POINTER
44  hook_associate ("playback unpause", mpris_status_cb, GINT_TO_POINTER
46  hook_associate ("playback stop", mpris_status_cb, GINT_TO_POINTER
48 
49  hook_associate ("set shuffle", mpris_status_cb, GINT_TO_POINTER (MPRIS_STATUS_INVALID));
50  hook_associate ("set repeat", mpris_status_cb, GINT_TO_POINTER (MPRIS_STATUS_INVALID));
51  hook_associate ("set no_playlist_advance", mpris_status_cb, GINT_TO_POINTER
53 #endif
54 }
55 
57 {
58 #ifdef USE_DBUS
59  hook_dissociate ("playback begin", mpris_status_cb);
60  hook_dissociate ("playback pause", mpris_status_cb);
61  hook_dissociate ("playback unpause", mpris_status_cb);
62  hook_dissociate ("playback stop", mpris_status_cb);
63 
64  hook_dissociate ("set shuffle", mpris_status_cb);
65  hook_dissociate ("set repeat", mpris_status_cb);
66  hook_dissociate ("set no_playlist_advance", mpris_status_cb);
67 #endif
68 }