Audacious
$Id:Doxyfile42802007-03-2104:39:00Znenolod$
Main Page
Related Pages
Classes
Files
File List
File Members
src
audacious
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 <
libaudcore/hook.h
>
23
24
#include "
dbus-service.h
"
25
#include "
main.h
"
26
27
static
void
mpris_status_cb (
void
* hook_data,
void
* user_data)
28
{
29
mpris_emit_status_change
(
mpris
, GPOINTER_TO_INT (user_data));
30
}
31
#endif
32
33
void
mpris_signals_init
(
void
)
34
{
35
#ifdef USE_DBUS
36
hook_associate
(
"playback begin"
, mpris_status_cb, GINT_TO_POINTER
37
(
MPRIS_STATUS_PLAY
));
38
hook_associate
(
"playback pause"
, mpris_status_cb, GINT_TO_POINTER
39
(
MPRIS_STATUS_PAUSE
));
40
hook_associate
(
"playback unpause"
, mpris_status_cb, GINT_TO_POINTER
41
(
MPRIS_STATUS_PLAY
));
42
hook_associate
(
"playback stop"
, mpris_status_cb, GINT_TO_POINTER
43
(
MPRIS_STATUS_STOP
));
44
45
hook_associate
(
"set shuffle"
, mpris_status_cb, GINT_TO_POINTER (
MPRIS_STATUS_INVALID
));
46
hook_associate
(
"set repeat"
, mpris_status_cb, GINT_TO_POINTER (
MPRIS_STATUS_INVALID
));
47
hook_associate
(
"set no_playlist_advance"
, mpris_status_cb, GINT_TO_POINTER
48
(
MPRIS_STATUS_INVALID
));
49
#endif
50
}
51
52
void
mpris_signals_cleanup
(
void
)
53
{
54
#ifdef USE_DBUS
55
hook_dissociate
(
"playback begin"
, mpris_status_cb);
56
hook_dissociate
(
"playback pause"
, mpris_status_cb);
57
hook_dissociate
(
"playback unpause"
, mpris_status_cb);
58
hook_dissociate
(
"playback stop"
, mpris_status_cb);
59
60
hook_dissociate
(
"set shuffle"
, mpris_status_cb);
61
hook_dissociate
(
"set repeat"
, mpris_status_cb);
62
hook_dissociate
(
"set no_playlist_advance"
, mpris_status_cb);
63
#endif
64
}
Generated by
1.8.1.1