[rhythmbox] im-status: fix MC5 status restore (bug #612714)



commit d2ca8e6cf68ccae21e93dbe8c31f1b78e1698bd1
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Apr 18 14:14:21 2010 +1000

    im-status: fix MC5 status restore (bug #612714)
    
    When getting the current status from MC5, treat the empty string as a
    valid status, but prefer non-empty strings.  The empty string is used
    for the default status, so we should restore to that on shutdown rather
    than leaving our last status in place.

 plugins/im-status/im-status/__init__.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/plugins/im-status/im-status/__init__.py b/plugins/im-status/im-status/__init__.py
index c716a75..d551554 100644
--- a/plugins/im-status/im-status/__init__.py
+++ b/plugins/im-status/im-status/__init__.py
@@ -247,6 +247,7 @@ class IMStatusPlugin (rb.Plugin):
       bus = dbus.SessionBus ()
       am_obj = bus.get_object (MC5_BUS_NAME, MC5_AM_OBJ_PATH)
       am = dbus.Interface (am_obj, PROPERTIES_IFACE_NAME)
+      got_status = False
 
       # a bit awful: this just returns the status text from the first account
       # that has one.
@@ -254,11 +255,15 @@ class IMStatusPlugin (rb.Plugin):
         acct_obj = bus.get_object (MC5_BUS_NAME, acct)
         acct_iface = dbus.Interface (acct_obj, PROPERTIES_IFACE_NAME)
         status = acct_iface.Get (MC5_ACCT_IFACE_NAME, "RequestedPresence")
+        got_status = True
         if status[2] != "":
           return status[2]
 
+      # if all accounts have empty status, return that
+      if got_status:
+        return ""
     except dbus.DBusException, e:
-      print "dbus exception while setting status: " + str(e)
+      print "dbus exception while getting status: " + str(e)
 
     return None
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]