Mercurial > pidgin-audacious
comparison pidgin-audacious.c @ 16:9e37b72309d4
- clear current song if audacious is not playing.
- disconnect from dbus when unload this plugin.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 02 Oct 2008 18:26:21 +0900 |
parents | b88a5f934224 |
children | 14de631fa929 |
comparison
equal
deleted
inserted
replaced
15:b88a5f934224 | 16:9e37b72309d4 |
---|---|
61 | 61 |
62 GHashTable *pushed_status; | 62 GHashTable *pushed_status; |
63 GHashTable *pushed_userinfo; | 63 GHashTable *pushed_userinfo; |
64 GHashTable *pushed_alias; | 64 GHashTable *pushed_alias; |
65 | 65 |
66 DBusGConnection *connection = NULL; | |
66 DBusGProxy *session = NULL; | 67 DBusGProxy *session = NULL; |
67 | 68 |
68 static PurpleCmdId cmdid_paste_current_song; | 69 static PurpleCmdId cmdid_paste_current_song; |
69 | 70 |
70 static void aud_process(gchar *aud_info); | 71 static void aud_process(gchar *aud_info); |
71 | 72 |
72 static DBusGProxy * | 73 static DBusGProxy * |
73 get_dbus_proxy(void) | 74 get_dbus_proxy(void) |
74 { | 75 { |
75 DBusGConnection *connection = NULL; | |
76 DBusGProxy *session = NULL; | |
77 GError *error = NULL; | 76 GError *error = NULL; |
78 connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); | 77 connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
79 g_clear_error(&error); | 78 g_clear_error(&error); |
80 | 79 |
81 session = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE, | 80 session = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE, |
102 aud_debug("session = %p\n", session); | 101 aud_debug("session = %p\n", session); |
103 aud_debug("is_playing = %d\n", audacious_remote_is_playing(session)); | 102 aud_debug("is_playing = %d\n", audacious_remote_is_playing(session)); |
104 | 103 |
105 if(!audacious_remote_is_playing(session)) { /* audacious isn't playing */ | 104 if(!audacious_remote_is_playing(session)) { /* audacious isn't playing */ |
106 aud_process(NULL); | 105 aud_process(NULL); |
106 purple_util_set_current_song(NULL, NULL, NULL); | |
107 return rv; | 107 return rv; |
108 } | 108 } |
109 | 109 |
110 playpos = audacious_remote_get_playlist_pos(session); | 110 playpos = audacious_remote_get_playlist_pos(session); |
111 tmp = audacious_remote_get_playlist_title(session, playpos); | 111 tmp = audacious_remote_get_playlist_title(session, playpos); |
558 | 558 |
559 purple_cmd_unregister(cmdid_paste_current_song); | 559 purple_cmd_unregister(cmdid_paste_current_song); |
560 | 560 |
561 g_object_unref(session); | 561 g_object_unref(session); |
562 session = NULL; | 562 session = NULL; |
563 | |
564 if(connection) { | |
565 dbus_g_connection_unref(connection); | |
566 connection = NULL; | |
567 } | |
563 | 568 |
564 return TRUE; | 569 return TRUE; |
565 } | 570 } |
566 | 571 |
567 static PurplePluginPrefFrame * | 572 static PurplePluginPrefFrame * |