Mercurial > pidgin-audacious
annotate pidgin-audacious.h @ 24:8ac1ebc63fab
set the version to 3.0.0
| author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
|---|---|
| date | Sat, 10 Jan 2009 14:41:46 +0900 |
| parents | dffc9604a9fb |
| children | c0280cf3ca84 |
| rev | line source |
|---|---|
| 22 | 1 #ifndef _PIDGIN_AUDACIOUS_H_ |
| 2 #define _PIDGIN_AUDACIOUS_H_ | |
| 3 | |
| 4 #include <stdio.h> | |
| 5 #include <stdlib.h> | |
| 6 #include <string.h> | |
| 7 #include <glib.h> | |
| 8 #include <dbus/dbus.h> | |
| 9 #include <dbus/dbus-glib.h> | |
| 10 | |
| 11 #include "gtkplugin.h" | |
| 12 #include "util.h" | |
| 13 #include "debug.h" | |
| 14 #include "connection.h" | |
| 15 #include "version.h" | |
| 16 #include "cmds.h" | |
| 17 #include "savedstatuses.h" | |
| 18 | |
| 19 #define PIDGINAUD_PLUGIN_ID "pidgin_audacious" | |
| 20 #define PLUGIN_NAME "Pidgin-Audacious" | |
| 21 | |
| 22 /* preferences */ | |
| 23 #define OPT_PIDGINAUD "/plugins/pidgin_audacious" | |
| 24 #define OPT_PROCESS_STATUS OPT_PIDGINAUD "/process_status" | |
| 25 #define OPT_PROCESS_USERINFO OPT_PIDGINAUD "/process_userinfo" | |
| 26 #define OPT_SONG_TEMPLATE OPT_PIDGINAUD "/song_template" | |
| 27 #define OPT_PASTE_TEMPLATE OPT_PIDGINAUD "/paste_template" | |
| 28 #define OPT_LOG_OUTPUT OPT_PIDGINAUD "/log_output" | |
| 29 #define OPT_PLAYER OPT_PIDGINAUD "/player" | |
| 30 | |
| 31 /* templates */ | |
| 32 #define TITLE "%title" | |
| 33 #define ARTIST "%artist" | |
| 34 #define ALBUM "%album" | |
| 35 #define GENRE "%genre" | |
| 36 #define DEFAULT_SONG_TEMPLATE "%title - %artist" | |
| 37 #define DEFAULT_PLAYER "audacious" | |
| 38 #define SONG_TOKEN "%song" | |
| 39 #define NO_SONG_MESSAGE "No song being played." | |
| 40 | |
| 41 /* constants */ | |
| 42 #define DBUS_TIMEOUT 1000 | |
| 43 #define PLAYING 0 | |
| 44 #define PAUSED 1 | |
| 45 #define STOPPED 2 | |
| 46 | |
| 47 /* custom data type */ | |
| 48 typedef struct song_tuple { | |
| 49 gchar *title; | |
| 50 gchar *artist; | |
| 51 gchar *album; | |
| 52 gchar *genre; | |
| 53 } song_tuple; | |
| 54 | |
| 55 /* mpris data containers */ | |
| 56 #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)) | |
| 57 | |
| 58 #define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) | |
| 59 | |
| 60 /* debug macros */ | |
| 61 #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); | |
| 62 | |
| 63 #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); | |
| 64 | |
|
23
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
65 |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
66 /* prototypes */ |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
67 extern gchar *botch_utf(const gchar *msg, gsize len, gsize *newlen) __attribute__ ((weak)); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
68 static void aud_process(gchar *aud_info); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
69 static void track_signal_cb(DBusGProxy *player_proxy, GHashTable *table, gpointer data); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
70 static void status_signal_cb(DBusGProxy *player_proxy, gint status, gpointer data); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
71 static gboolean is_app_playing(void); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
72 static GHashTable *get_song_table(void); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
73 static song_tuple *get_song_tuple(GHashTable *table); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
74 static void signed_on_cb(PurpleConnection *gc, void *data); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
75 static void prefs_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
76 |
| 22 | 77 #endif |
