changeset 14:89bd98990fff

now it tries to get dbus proxy if session is NULL.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sun, 28 Sep 2008 00:58:59 +0900
parents 44568f7ef51d
children b88a5f934224
files pidgin-audacious.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-audacious.c	Sat Sep 27 01:07:06 2008 +0900
+++ b/pidgin-audacious.c	Sun Sep 28 00:58:59 2008 +0900
@@ -95,8 +95,11 @@
     gboolean rv = TRUE;
     size_t dummy;
 
+    if(!session) {
+        session = get_dbus_proxy();
+    }
+
     aud_debug("session = %p\n", session);
-
     aud_debug("is_playing = %d\n", audacious_remote_is_playing(session));
 
     if(!audacious_remote_is_playing(session)) { /* audacious isn't playing */
@@ -539,6 +542,9 @@
 
     purple_cmd_unregister(cmdid_paste_current_song);
 
+    g_object_unref(session);
+    session = NULL;
+
     return TRUE;
 }
 
@@ -622,7 +628,6 @@
     purple_prefs_add_bool(OPT_PROCESS_ALIAS, TRUE);
     purple_prefs_add_string(OPT_PASTE_TEMPLATE, SONG_TOKEN);
 
-    session = get_dbus_proxy();
 }
 
 PURPLE_INIT_PLUGIN(pidgin_audacious, init_plugin, info)