Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
mpris-signals.c
Go to the documentation of this file.
00001 /*  Audacious - Cross-platform multimedia player
00002  *  Copyright (C) 2005-2011  Audacious development team.
00003  *
00004  *  Based on BMP:
00005  *  Copyright (C) 2003-2004  BMP development team.
00006  *
00007  *  Based on XMMS:
00008  *  Copyright (C) 1998-2003  XMMS development team.
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; under version 3 of the License.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this program.  If not, see <http://www.gnu.org/licenses>.
00021  *
00022  *  The Audacious team does not consider modular code linking to
00023  *  Audacious or using our public API to be a derived work.
00024  */
00025 
00026 #ifdef USE_DBUS
00027 
00028 #include "dbus-service.h"
00029 
00030 static void mpris_status_cb (void * hook_data, void * user_data)
00031 {
00032     mpris_emit_status_change (mpris, GPOINTER_TO_INT (user_data));
00033 }
00034 #endif
00035 
00036 void mpris_signals_init (void)
00037 {
00038 #ifdef USE_DBUS
00039     hook_associate ("playback begin", mpris_status_cb, GINT_TO_POINTER
00040      (MPRIS_STATUS_PLAY));
00041     hook_associate ("playback pause", mpris_status_cb, GINT_TO_POINTER
00042      (MPRIS_STATUS_PAUSE));
00043     hook_associate ("playback unpause", mpris_status_cb, GINT_TO_POINTER
00044      (MPRIS_STATUS_PLAY));
00045     hook_associate ("playback stop", mpris_status_cb, GINT_TO_POINTER
00046      (MPRIS_STATUS_STOP));
00047 
00048     hook_associate ("toggle shuffle", mpris_status_cb, GINT_TO_POINTER
00049      (MPRIS_STATUS_INVALID));
00050     hook_associate ("toggle repeat", mpris_status_cb, GINT_TO_POINTER
00051      (MPRIS_STATUS_INVALID));
00052 /*    hook_associate ("toggle no playlist advance", mpris_status_cb,
00053      GINT_TO_POINTER (MPRIS_STATUS_INVALID)); */
00054 #endif
00055 }
00056 
00057 void mpris_signals_cleanup (void)
00058 {
00059 #ifdef USE_DBUS
00060     hook_dissociate ("playback begin", mpris_status_cb);
00061     hook_dissociate ("playback pause", mpris_status_cb);
00062     hook_dissociate ("playback unpause", mpris_status_cb);
00063     hook_dissociate ("playback stop", mpris_status_cb);
00064 
00065     hook_dissociate ("toggle shuffle", mpris_status_cb);
00066     hook_dissociate ("toggle repeat", mpris_status_cb);
00067 /*    hook_dissociate ("toggle no playlist advance", mpris_status_cb); */
00068 #endif
00069 }