bigboard r7304 - trunk/bigboard/stocks/people



Author: marco
Date: Wed Apr 16 18:39:55 2008
New Revision: 7304
URL: http://svn.gnome.org/viewvc/bigboard?rev=7304&view=rev

Log:
Display a button to configure mime accounts when ~/.pigdin/accounts.xml does not exist. #527444

Modified:
   trunk/bigboard/stocks/people/PeopleStock.py

Modified: trunk/bigboard/stocks/people/PeopleStock.py
==============================================================================
--- trunk/bigboard/stocks/people/PeopleStock.py	(original)
+++ trunk/bigboard/stocks/people/PeopleStock.py	Wed Apr 16 18:39:55 2008
@@ -1,6 +1,11 @@
-import logging, gtk
+import os
+import logging
 
+import gtk
 import hippo
+import gnomevfs
+
+from pyonlinedesktop.fsutil import VfsMonitor
 
 import bigboard
 from bigboard.people_tracker import PeopleTracker, sort_people
@@ -20,7 +25,11 @@
         super(PeopleStock, self).__init__(*args, **kwargs)
 
         self.__box = hippo.CanvasBox(orientation=hippo.ORIENTATION_VERTICAL, spacing=3)
-        
+
+        self.__accounts_link = hippo.CanvasLink(text="Configure IM Accounts")
+        self.__accounts_link.connect('activated', self.__on_accounts_link_activated)
+        self.__box.append(self.__accounts_link)
+
         self.__scroll_box = scroll_ribbon.VerticalScrollArea()
         self.__scroll_box.set_increment(50)
         self.__box.append(self.__scroll_box, hippo.PACK_EXPAND)
@@ -49,6 +58,18 @@
         search.enable_search_provider('people',
                                       lambda: PeopleSearchProvider(self.__tracker))
 
+        self.__accounts_config = os.path.expanduser('~/.purple/accounts.xml')
+        VfsMonitor('file://' + self.__accounts_config, gnomevfs.MONITOR_FILE,
+                   lambda: self.__sync_accounts_message())
+        self.__sync_accounts_message()
+
+    def __sync_accounts_message(self):
+        self.__box.set_child_visible(self.__accounts_link,
+                                     not os.path.exists(self.__accounts_config))
+
+    def __on_accounts_link_activated(self, link):
+        os.spawnlp(os.P_NOWAIT, 'pidgin', 'pidgin')
+
     def get_authed_content(self, size):
         return self.__box
 



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