Mercurial > pidgin-audacious
annotate pidgin-audacious.h @ 25:c0280cf3ca84
first try to avoid too frequent updates.
| author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
|---|---|
| date | Sat, 24 Jan 2009 14:57:20 +0900 |
| parents | dffc9604a9fb |
| children | 47b3caeb47c5 |
| 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 | |
|
25
c0280cf3ca84
first try to avoid too frequent updates.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
23
diff
changeset
|
43 #define MINIMAL_INTERVAL 8 |
| 22 | 44 #define PLAYING 0 |
| 45 #define PAUSED 1 | |
| 46 #define STOPPED 2 | |
| 47 | |
| 48 /* custom data type */ | |
| 49 typedef struct song_tuple { | |
| 50 gchar *title; | |
| 51 gchar *artist; | |
| 52 gchar *album; | |
| 53 gchar *genre; | |
| 54 } song_tuple; | |
| 55 | |
| 56 /* mpris data containers */ | |
| 57 #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)) | |
| 58 | |
| 59 #define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) | |
| 60 | |
| 61 /* debug macros */ | |
| 62 #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); | |
| 63 | |
| 64 #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); | |
| 65 | |
|
23
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
66 |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
67 /* prototypes */ |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
68 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
|
69 static void aud_process(gchar *aud_info); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
70 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
|
71 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
|
72 static gboolean is_app_playing(void); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
73 static GHashTable *get_song_table(void); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
74 static song_tuple *get_song_tuple(GHashTable *table); |
|
dffc9604a9fb
- moved prototypes to pidgin-audacious.h
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
22
diff
changeset
|
75 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
|
76 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
|
77 |
| 22 | 78 #endif |
