bigboard r7412 - in trunk/bigboard: . stocks/twitter



Author: marinaz
Date: Mon Jun 30 00:37:32 2008
New Revision: 7412
URL: http://svn.gnome.org/viewvc/bigboard?rev=7412&view=rev

Log:
/onlineaccounts and /onlineaccount are now provided by org.gnome.OnlineAccounts DBus service


Modified:
   trunk/bigboard/accounts_dialog.py
   trunk/bigboard/google.py
   trunk/bigboard/google_stock.py
   trunk/bigboard/stocks/twitter/TwitterStock.py

Modified: trunk/bigboard/accounts_dialog.py
==============================================================================
--- trunk/bigboard/accounts_dialog.py	(original)
+++ trunk/bigboard/accounts_dialog.py	Mon Jun 30 00:37:32 2008
@@ -15,7 +15,7 @@
         super(Dialog, self).__init__(*args, **kwargs)        
         
         try:
-            self.__onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', '/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 manage accounts")
             return
@@ -227,7 +227,7 @@
         # TODO: check for account kind when we have a per-account dialog
         if a_path not in self.__model_tree_iter_by_account:
             try:
-                a = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', a_path)
+                a = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', a_path)
             except dbus.DBusException, e:
                 _logger.error("onlineaccount for path %s was not found" % a_path)
                 return
@@ -261,7 +261,7 @@
             if self.__current_account.GetObjectPath() == a_path and len(self.__model_tree_iter_by_account) > 0:  
                 new_current_account_path = self.__model_tree_iter_by_account.keys()[0]
                 try:
-                    self.__current_account = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', new_current_account_path)
+                    self.__current_account = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', new_current_account_path)
                     self.__accounts_combo.set_active_iter(self.__model_tree_iter_by_account.values()[0]) 
                 except dbus.DBusException, e:
                     _logger.error("onlineaccount for path %s was not found" % new_current_account_path)
@@ -292,7 +292,7 @@
             # this assumes that text for each entry in the drop down box is different, which it should be       
             if self.__model.get_value(tree_iter, 0) == self.__model.get_value(new_iter, 0):
                 try:
-                    self.__current_account = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', a_path)
+                    self.__current_account = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', a_path)
                 except dbus.DBusException, e:
                     _logger.error("onlineaccount for path %s was not found" % a_path)
                     return

Modified: trunk/bigboard/google.py
==============================================================================
--- trunk/bigboard/google.py	(original)
+++ trunk/bigboard/google.py	Mon Jun 30 00:37:32 2008
@@ -573,7 +573,7 @@
     _logger.debug("refresh googles was called")
     global __googles_by_account 
     try:
-        __onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', '/onlineaccounts')
+        __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")   
     gaccount_paths = __onlineaccounts_proxy.GetEnabledAccountsWithKinds(['google'])
@@ -583,7 +583,7 @@
                 new_googles[g_path] = __googles_by_account[g_path]
         else:
             try:
-                g = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', g_path)  
+                g = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', g_path)  
                 new_googles[g_path] = Google(g)
             except dbus.DBusException, e:
                 _logger.error("onlineaccount for path %s was not found" % g_path)
@@ -596,7 +596,7 @@
 
 def __on_account_added(account_path):
     try:
-        a = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', account_path)
+        a = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', account_path)
         if a.GetKind() == "google":
             __refresh_googles()      
     except dbus.DBusException, e:
@@ -604,7 +604,7 @@
 
 def __on_account_removed(account_path):
     try:
-        a = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', account_path)
+        a = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', account_path)
         if a.GetKind() == "google":
             __refresh_googles()      
     except dbus.DBusException, e:
@@ -620,7 +620,7 @@
     __refresh_googles()
 
     try:
-        __onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', '/onlineaccounts')
+        __onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', '/onlineaccounts')
         __onlineaccounts_proxy.connect_to_signal('AccountEnabled', __on_account_added)
         __onlineaccounts_proxy.connect_to_signal('AccountDisabled', __on_account_removed)
     except dbus.DBusException, e:

Modified: trunk/bigboard/google_stock.py
==============================================================================
--- trunk/bigboard/google_stock.py	(original)
+++ trunk/bigboard/google_stock.py	Mon Jun 30 00:37:32 2008
@@ -37,7 +37,7 @@
 
     def _post_init(self):
         try:
-            onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', '/onlineaccounts')
+            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
@@ -65,7 +65,7 @@
     def __on_account_added(self, acct_path):
         try:
             _logger.debug("acct_path is %s" % acct_path)
-            acct = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', acct_path)
+            acct = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', acct_path)
         except dbus.DBusException, e:
             _logger.error("onlineaccount for path %s was not found" % acct_path)
             return
@@ -83,7 +83,7 @@
     
     def __on_account_removed(self, acct_path):
         try:
-            acct = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', acct_path)
+            acct = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', acct_path)
         except dbus.DBusException, e:
             _logger.error("onlineaccount for path %s was not found" % acct_path)
             return

Modified: trunk/bigboard/stocks/twitter/TwitterStock.py
==============================================================================
--- trunk/bigboard/stocks/twitter/TwitterStock.py	(original)
+++ trunk/bigboard/stocks/twitter/TwitterStock.py	Mon Jun 30 00:37:32 2008
@@ -1,6 +1,8 @@
 import logging, dbus
 import urllib
 import hippo
+import twyt.twitter as twyt
+import twyt.data as twyt_data
 from bigboard.stock import Stock
 import bigboard.accounts_dialog as accounts_dialog
 import bigboard.libbig.gutil as gutil
@@ -37,6 +39,9 @@
 
         self._add_more_button(self.__on_more_button)
 
+        self.__twitter = twyt.Twitter()
+        self.__twitter.set_user_agent("gnome")
+
         self.__fetcher = AsyncHTTPFetcherWithAuth()
 
         # even though the account system can theoretically return multiple Twitter accounts, this stock
@@ -45,7 +50,7 @@
         self.__twitter_account_changed_signal_match = None
 
         try:
-            onlineaccounts_proxy = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', '/onlineaccounts')
+            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
@@ -73,7 +78,7 @@
     def __on_account_added(self, acct_path):
         try:
             _logger.debug("acct_path is %s" % acct_path)
-            acct = dbus.SessionBus().get_object('org.gnome.WebLoginDriver', acct_path)
+            acct = dbus.SessionBus().get_object('org.gnome.OnlineAccounts', acct_path)
         except dbus.DBusException, e:
             _logger.error("onlineaccount for path %s was not found" % acct_path)
             return
@@ -152,6 +157,12 @@
             self.__box.append(hello_message)
             self.__box.append(self.__twitter_status_counter_text)
             self.__box.append(self.__twitter_status_input)  
+       
+            self.__twitter.set_auth(username, password)
+            answer = self.__twitter.status_friends_timeline()
+            results = twyt_data.StatusList(answer)
+	    for result in results:
+		_logger.debug("%s" % result)
 
     def __on_twitter_status_response(self, url, data, username, password):
         _logger.debug("Twitter status update went fine")



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