changeset 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
files pidgin-audacious.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-audacious.c	Thu Oct 02 17:12:04 2008 +0900
+++ b/pidgin-audacious.c	Thu Oct 02 18:26:21 2008 +0900
@@ -63,6 +63,7 @@
 GHashTable *pushed_userinfo;
 GHashTable *pushed_alias;
 
+DBusGConnection *connection = NULL;
 DBusGProxy *session = NULL;
 
 static PurpleCmdId cmdid_paste_current_song;
@@ -72,8 +73,6 @@
 static DBusGProxy *
 get_dbus_proxy(void)
 {
-    DBusGConnection *connection = NULL;
-    DBusGProxy *session = NULL;
     GError *error = NULL;
     connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
     g_clear_error(&error);
@@ -104,6 +103,7 @@
 
     if(!audacious_remote_is_playing(session)) { /* audacious isn't playing */
         aud_process(NULL);
+        purple_util_set_current_song(NULL, NULL, NULL);
         return rv;
     }
 
@@ -561,6 +561,11 @@
     g_object_unref(session);
     session = NULL;
 
+    if(connection) {
+        dbus_g_connection_unref(connection);
+        connection = NULL;
+    }
+
     return TRUE;
 }