bigboard r7423 - in trunk/bigboard: . stocks/self stocks/twitter



Author: marinaz
Date: Fri Aug 22 19:28:12 2008
New Revision: 7423
URL: http://svn.gnome.org/viewvc/bigboard?rev=7423&view=rev

Log:
Remove the accounts dialog maintained by bigboard, and use the accounts dialog available from the Online Accounts DBus service instead.


Removed:
   trunk/bigboard/accounts_dialog.py
Modified:
   trunk/bigboard/Makefile.am
   trunk/bigboard/google.py
   trunk/bigboard/google_stock.py
   trunk/bigboard/stocks/self/portfoliomanager.py
   trunk/bigboard/stocks/twitter/TwitterStock.py

Modified: trunk/bigboard/Makefile.am
==============================================================================
--- trunk/bigboard/Makefile.am	(original)
+++ trunk/bigboard/Makefile.am	Fri Aug 22 19:28:12 2008
@@ -76,7 +76,7 @@
 photosstock_PYTHON = stocks/mugshot_photos/*.py stocks/mugshot_photos/*.png
 
 twitterstockdir=$(stocksdir)/twitter
-twitterstock_PYTHON = stocks/twitter/*.py 
+twitterstock_PYTHON = stocks/twitter/*.py stocks/people/*.png stocks/people/*.css
 
 selfstockdir=$(stocksdir)/self
 selfstock_PYTHON = stocks/self/*.py stocks/self/*.css

Modified: trunk/bigboard/google.py
==============================================================================
--- trunk/bigboard/google.py	(original)
+++ trunk/bigboard/google.py	Fri Aug 22 19:28:12 2008
@@ -577,6 +577,7 @@
         __onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
     except dbus.DBusException, e:
         _logger.error("onlineaccounts DBus service not available, can't refresh googles")   
+        return
     gaccount_paths = __onlineaccounts_proxy.GetEnabledAccountsWithKinds(['google'])
     new_googles = {}
     for g_path in gaccount_paths:

Modified: trunk/bigboard/google_stock.py
==============================================================================
--- trunk/bigboard/google_stock.py	(original)
+++ trunk/bigboard/google_stock.py	Fri Aug 22 19:28:12 2008
@@ -1,7 +1,6 @@
 import logging, dbus
 import hippo
 import bigboard.google as google
-import accounts_dialog
 import bigboard.libbig.gutil as gutil
 from bigboard.libbig.logutil import log_except
 
@@ -26,6 +25,8 @@
         self.googles = set()
         self.__googles_by_account = {} ## maps OnlineAccount ObjectPath => google.Google
 
+        self.__onlineaccounts_proxy = None
+
         _logger.debug("in google stock init action_id is %s", str(action_id))         
         self.__action_id = action_id
 
@@ -37,19 +38,19 @@
 
     def _post_init(self):
         try:
-            onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
+            self.__onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
         except dbus.DBusException, e:
             _logger.error("onlineaccounts DBus service not available, can't get google accounts")
             return
 
-        all_google_account_paths = onlineaccounts_proxy.GetEnabledAccountsWithKinds(["google"])
+        all_google_account_paths = self.__onlineaccounts_proxy.GetEnabledAccountsWithKinds(["google"])
         for a_path in all_google_account_paths:
             self.__on_account_added(a_path)
 
-        id = onlineaccounts_proxy.connect_to_signal('AccountEnabled', self.__on_account_added)
-        self.__connections.add(onlineaccounts_proxy, id)
-        id = onlineaccounts_proxy.connect_to_signal('AccountDisabled', self.__on_account_removed)
-        self.__connections.add(onlineaccounts_proxy, id)
+        id = self.__onlineaccounts_proxy.connect_to_signal('AccountEnabled', self.__on_account_added)
+        self.__connections.add(self.__onlineaccounts_proxy, id)
+        id = self.__onlineaccounts_proxy.connect_to_signal('AccountDisabled', self.__on_account_removed)
+        self.__connections.add(self.__onlineaccounts_proxy, id)
 
     ## we can't just override _on_delisted() because of multiple inheritance,
     ## so our subclasses have to override it then call this
@@ -110,7 +111,10 @@
         return False
 
     def __open_login_dialog(self):
-        accounts_dialog.open_dialog(["google"])
+        if self.__onlineaccounts_proxy:
+            self.__onlineaccounts_proxy.OpenAccountsDialogWithKinds(["google"])
+        else: 
+            _logger.error("onlineaccounts proxy is not initialized, can't open the dialog for google accounts")    
 
     def _checking_google_auth(self, gobj):
         self._login_button.set_property("text", CHECKING_LOGIN_STRING)

Modified: trunk/bigboard/stocks/self/portfoliomanager.py
==============================================================================
--- trunk/bigboard/stocks/self/portfoliomanager.py	(original)
+++ trunk/bigboard/stocks/self/portfoliomanager.py	Fri Aug 22 19:28:12 2008
@@ -1,4 +1,4 @@
-import logging, time, urlparse, urllib
+import logging, time, urlparse, urllib, dbus
 
 import gobject, gtk, gconf
 import hippo
@@ -7,7 +7,6 @@
 
 import bigboard.globals
 import bigboard.libbig as libbig
-import bigboard.accounts_dialog as accounts_dialog
 from bigboard.libbig.logutil import log_except
 from bigboard.big_widgets import BigWindow, CanvasMugshotURLImage, CanvasHBox, CanvasVBox, CanvasCombo
 from bigboard.big_widgets import ActionLink, PrelightingCanvasBox, Button, CanvasCheckbox, CanvasURLImage
@@ -292,7 +291,11 @@
         self.set_root(self.__box)
         
     def __on_open_accounts_dialog(self):
-        accounts_dialog.open_dialog()
+        try:
+            onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
+            onlineaccounts_proxy.OpenAccountsDialog()
+        except dbus.DBusException, e:
+            _logger.error("onlineaccounts DBus service not available, can't open accounts dialog")
         self.__hide_reset()
 
     def __on_google_gadget_add(self, but):

Modified: trunk/bigboard/stocks/twitter/TwitterStock.py
==============================================================================
--- trunk/bigboard/stocks/twitter/TwitterStock.py	(original)
+++ trunk/bigboard/stocks/twitter/TwitterStock.py	Fri Aug 22 19:28:12 2008
@@ -5,7 +5,6 @@
 import twyt.data as twyt_data
 from bigboard.stock import Stock
 from bigboard.slideout import Slideout
-import bigboard.accounts_dialog as accounts_dialog
 import bigboard.libbig.gutil as gutil
 from bigboard.libbig.logutil import log_except
 import bigboard.libbig as libbig
@@ -106,22 +105,24 @@
         self.__twitter_account = None
         self.__twitter_account_changed_signal_match = None
 
+        self.__onlineaccounts_proxy = None
+
         try:
-            onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
+            self.__onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
         except dbus.DBusException, e:
             _logger.error("onlineaccounts DBus service not available, can't get twitter accounts")
             return
 
-        all_twitter_account_paths = onlineaccounts_proxy.GetEnabledAccountsWithKinds([TWITTER_KIND])
+        all_twitter_account_paths = self.__onlineaccounts_proxy.GetEnabledAccountsWithKinds([TWITTER_KIND])
         for a_path in all_twitter_account_paths:
             self.__on_account_added(a_path)
 
         self.__connections = gutil.DisconnectSet()
 
-        id = onlineaccounts_proxy.connect_to_signal('AccountEnabled', self.__on_account_added)
-        self.__connections.add(onlineaccounts_proxy, id)
-        id = onlineaccounts_proxy.connect_to_signal('AccountDisabled', self.__on_account_removed)
-        self.__connections.add(onlineaccounts_proxy, id)
+        id = self.__onlineaccounts_proxy.connect_to_signal('AccountEnabled', self.__on_account_added)
+        self.__connections.add(self.__onlineaccounts_proxy, id)
+        id = self.__onlineaccounts_proxy.connect_to_signal('AccountDisabled', self.__on_account_removed)
+        self.__connections.add(self.__onlineaccounts_proxy, id)
 
     def _on_delisted(self):
         if self.__twitter_account:
@@ -287,7 +288,10 @@
         self.__box.append(self.__login_button) 
  
     def __open_login_dialog(self):
-        accounts_dialog.open_dialog(["twitter"])
+        if self.__onlineaccounts_proxy:
+            self.__onlineaccounts_proxy.OpenAccountsDialogWithKinds(["twitter"])
+        else: 
+            _logger.error("onlineaccounts proxy is not initialized, can't open the dialog for twitter accounts")    
 
     def __on_more_button(self):
         if self.__twitter_account:



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