Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
mpris-signals.c
Go to the documentation of this file.
1 /*
2  * mpris-signals.c
3  * Copyright 2011 John Lindgren
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions, and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions, and the following disclaimer in the documentation
13  * provided with the distribution.
14  *
15  * This software is provided "as is" and without any warranty, express or
16  * implied. In no event shall the authors be liable for any damages arising from
17  * the use of this software.
18  */
19 
20 #ifdef USE_DBUS
21 
22 #include "dbus-service.h"
23 #include "main.h"
24 
25 static void mpris_status_cb (void * hook_data, void * user_data)
26 {
27  mpris_emit_status_change (mpris, GPOINTER_TO_INT (user_data));
28 }
29 #endif
30 
31 void mpris_signals_init (void)
32 {
33 #ifdef USE_DBUS
34  hook_associate ("playback begin", mpris_status_cb, GINT_TO_POINTER
36  hook_associate ("playback pause", mpris_status_cb, GINT_TO_POINTER
38  hook_associate ("playback unpause", mpris_status_cb, GINT_TO_POINTER
40  hook_associate ("playback stop", mpris_status_cb, GINT_TO_POINTER
42 
43  hook_associate ("set shuffle", mpris_status_cb, GINT_TO_POINTER (MPRIS_STATUS_INVALID));
44  hook_associate ("set repeat", mpris_status_cb, GINT_TO_POINTER (MPRIS_STATUS_INVALID));
45  hook_associate ("set no_playlist_advance", mpris_status_cb, GINT_TO_POINTER
47 #endif
48 }
49 
51 {
52 #ifdef USE_DBUS
53  hook_dissociate ("playback begin", mpris_status_cb);
54  hook_dissociate ("playback pause", mpris_status_cb);
55  hook_dissociate ("playback unpause", mpris_status_cb);
56  hook_dissociate ("playback stop", mpris_status_cb);
57 
58  hook_dissociate ("set shuffle", mpris_status_cb);
59  hook_dissociate ("set repeat", mpris_status_cb);
60  hook_dissociate ("set no_playlist_advance", mpris_status_cb);
61 #endif
62 }