comparison pidgin-audacious.c @ 22:fbad40babe88

build system update: - ported Makefile.in from pidgin-twitter. - ported autogen.sh from pidgin-twitter. - moved some declarations and definitions to pidgin-audacious.h - updated configure.in to go along with new Makefile. - removed aclocal.m4 from version control.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 06 Oct 2008 18:18:06 +0900
parents 83002f858ee9
children dffc9604a9fb
comparison
equal deleted inserted replaced
21:83002f858ee9 22:fbad40babe88
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16 * 02111-1307, USA. 16 * 02111-1307, USA.
17 */ 17 */
18 #define PURPLE_PLUGINS 1 18 #define PURPLE_PLUGINS 1
19 19
20 #include <stdio.h> 20 #include "pidgin-audacious.h"
21 #include <stdlib.h>
22 #include <string.h>
23 #include <glib.h>
24 #include <dbus/dbus.h>
25 #include <dbus/dbus-glib.h>
26
27 #include "gtkplugin.h"
28 #include "util.h"
29 #include "debug.h"
30 #include "connection.h"
31 #include "version.h"
32 #include "cmds.h"
33 #include "savedstatuses.h"
34
35 #define PIDGINAUD_PLUGIN_ID "pidgin_audacious"
36 #define PLUGIN_NAME "Pidgin-Audacious"
37
38 /* preferences */
39 #define OPT_PIDGINAUD "/plugins/pidgin_audacious"
40 #define OPT_PROCESS_STATUS OPT_PIDGINAUD "/process_status"
41 #define OPT_PROCESS_USERINFO OPT_PIDGINAUD "/process_userinfo"
42 #define OPT_SONG_TEMPLATE OPT_PIDGINAUD "/song_template"
43 #define OPT_PASTE_TEMPLATE OPT_PIDGINAUD "/paste_template"
44 #define OPT_LOG_OUTPUT OPT_PIDGINAUD "/log_output"
45 #define OPT_PLAYER OPT_PIDGINAUD "/player"
46
47 /* templates */
48 #define TITLE "%title"
49 #define ARTIST "%artist"
50 #define ALBUM "%album"
51 #define GENRE "%genre"
52 #define DEFAULT_SONG_TEMPLATE "%title - %artist"
53 #define DEFAULT_PLAYER "audacious"
54 #define SONG_TOKEN "%song"
55 #define NO_SONG_MESSAGE "No song being played."
56
57 /* constants */
58 #define DBUS_TIMEOUT 1000
59 #define PLAYING 0
60 #define PAUSED 1
61 #define STOPPED 2
62
63 /* custom data type */
64 typedef struct song_tuple {
65 gchar *title;
66 gchar *artist;
67 gchar *album;
68 gchar *genre;
69 } song_tuple;
70
71 /* mpris data containers */
72 #define DBUS_TYPE_MPRIS_STATUS (dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID))
73
74 #define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
75
76 /* debug macros */
77 #define aud_debug(fmt, ...) do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
78
79 #define aud_error(fmt, ...) do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
80 21
81 /* globals */ 22 /* globals */
82 static GHashTable *seed_status; 23 static GHashTable *seed_status;
83 static GHashTable *seed_userinfo; 24 static GHashTable *seed_userinfo;
84 static GHashTable *pushed_status; 25 static GHashTable *pushed_status;