online-desktop r7282 - in trunk/weblogindriver: . weblogindriver
- From: marinaz svn gnome org
- To: svn-commits-list gnome org
- Subject: online-desktop r7282 - in trunk/weblogindriver: . weblogindriver
- Date: Tue, 28 Oct 2008 04:42:19 +0000 (UTC)
Author: marinaz
Date: Tue Oct 28 04:42:18 2008
New Revision: 7282
URL: http://svn.gnome.org/viewvc/online-desktop?rev=7282&view=rev
Log:
Check self.__model.self_resource when checking if we have an online user and create a separate flag for checking if we are connected to the server.
Modified:
trunk/weblogindriver/web-login-driver
trunk/weblogindriver/weblogindriver/accounts_dialog.py
Modified: trunk/weblogindriver/web-login-driver
==============================================================================
--- trunk/weblogindriver/web-login-driver (original)
+++ trunk/weblogindriver/web-login-driver Tue Oct 28 04:42:18 2008
@@ -696,6 +696,7 @@
self.__get_online_accounts()
def __get_online_accounts(self):
+ _logger.debug("values %s %s" % (self.__model.global_resource.online, self.__model.self_resource != None))
if self.__model.global_resource.online and self.__model.self_resource != None and self.__save_online_flag:
_logger.debug("will get online desktop accounts")
query = self.__model.query_resource(self.__model.self_resource, "googleEnabledEmails; lovedAccounts +")
@@ -710,6 +711,7 @@
elif not self.__model.global_resource.online or self.__model.self_resource == None:
self.__received_response_from_server = False
self.HaveOnlineUserFlagChanged(self.GetHaveOnlineUserFlag())
+ self.ConnectedToServerFlagChanged(self.GetConnectedToServerFlag())
# we will want to use the merge mode once we do get the self resource
self.__merge_mode = True
@@ -717,11 +719,12 @@
_logger.error("datamodel error %s: %s", code, str)
def __on_datamodel_response(self, myself):
- _logger.debug("received data model response, found the server")
+ _logger.debug("received data model response")
if not self.__received_account_types_from_server:
self.__download_online_account_types()
self.__received_response_from_server = True
self.HaveOnlineUserFlagChanged(self.GetHaveOnlineUserFlag())
+ self.ConnectedToServerFlagChanged(self.GetConnectedToServerFlag())
myself.connect(self.__update_google_enabled_emails, 'googleEnabledEmails')
myself.connect(self.__update_loved_accounts, 'lovedAccounts')
self.__update_google_enabled_emails(myself)
@@ -744,6 +747,7 @@
if not global_resource.online:
self.__received_response_from_server = False
self.HaveOnlineUserFlagChanged(self.GetHaveOnlineUserFlag())
+ self.ConnectedToServerFlagChanged(self.GetConnectedToServerFlag())
self.__merge_mode = True
# def __on_loved_accounts(self, myself):
@@ -920,11 +924,14 @@
new_save_online_flag = self.__gconf.get_value(GCONF_BASE_DIR + "/save_online")
if self.__save_online_flag is None:
self.__save_online_flag = new_save_online_flag
+ self.SaveOnlineFlagChanged(self.__save_online_flag)
+ self.ConnectedToServerFlagChanged(self.GetConnectedToServerFlag())
return
if new_save_online_flag != self.__save_online_flag:
self.__save_online_flag = new_save_online_flag
self.SaveOnlineFlagChanged(self.__save_online_flag)
+ self.ConnectedToServerFlagChanged(self.GetConnectedToServerFlag())
if self.__save_online_flag:
_logger.debug("will enter the merge mode")
self.__merge_mode = True
@@ -1130,15 +1137,21 @@
@dbus.service.method(OA_BUS_IFACE_STR,
out_signature="b")
def GetHaveOnlineUserFlag(self):
- # we only want to return False when we don't have an online user, but are
- # connected to the server
- return self.__received_response_from_server or not self.__model.global_resource.online
+ return self.__model is not None and self.__model.self_resource is not None and self.__save_online_flag
@dbus.service.signal(OA_BUS_IFACE_STR,
signature='b')
def HaveOnlineUserFlagChanged(self, new_have_online_user_flag):
pass
+ def GetConnectedToServerFlag(self):
+ return self.__model is not None and self.__model.global_resource is not None and self.__model.global_resource.online and self.__save_online_flag
+
+ @dbus.service.signal(OA_BUS_IFACE_STR,
+ signature='b')
+ def ConnectedToServerFlagChanged(self, new_connected_to_server_flag):
+ pass
+
@dbus.service.signal(OA_BUS_IFACE_STR,
signature='ssb')
def AccountUpdateFeedback(self, feedback_header, feedback_message, is_error_flag):
Modified: trunk/weblogindriver/weblogindriver/accounts_dialog.py
==============================================================================
--- trunk/weblogindriver/weblogindriver/accounts_dialog.py (original)
+++ trunk/weblogindriver/weblogindriver/accounts_dialog.py Tue Oct 28 04:42:18 2008
@@ -253,7 +253,10 @@
self.__on_save_online_flag_changed)
self.__connections.add(self.__onlineaccounts_proxy, id)
id = self.__onlineaccounts_proxy.connect_to_signal('HaveOnlineUserFlagChanged',
- self.__on__have_online_user_flag_changed)
+ self.__on_have_online_user_flag_changed)
+ self.__connections.add(self.__onlineaccounts_proxy, id)
+ id = self.__onlineaccounts_proxy.connect_to_signal('ConnectedToServerFlagChanged',
+ self.__on_connected_to_server_flag_changed)
self.__connections.add(self.__onlineaccounts_proxy, id)
id = self.__onlineaccounts_proxy.connect_to_signal('AccountUpdateFeedback',
self.__on_account_update_feedback)
@@ -265,6 +268,7 @@
def __update_online_links(self):
save_online_flag = self.__online_accounts_service.GetSaveOnlineFlag()
have_online_user_flag = self.__online_accounts_service.GetHaveOnlineUserFlag()
+ connected_to_server_flag = self.__online_accounts_service.GetConnectedToServerFlag()
if self.__account_page_link_connect_id is not None:
self.__account_page_link.disconnect(self.__account_page_link_connect_id)
@@ -272,7 +276,7 @@
if self.__account_page_link_2_connect_id is not None:
self.__account_page_link_2.disconnect(self.__account_page_link_2_connect_id)
- if save_online_flag and have_online_user_flag:
+ if save_online_flag and have_online_user_flag and connected_to_server_flag:
# display a link to the account page
self.__account_page_link.set_text("Visit Account Page")
self.__account_page_link_connect_id = self.__account_page_link.connect("clicked", self.__open_server_page, "/account")
@@ -280,10 +284,18 @@
self.__account_page_link_2_connect_id = self.__account_page_link_2.connect("clicked", self.__open_server_page, "/account")
elif save_online_flag and not have_online_user_flag:
# tell the user that they need to sign in
+ # connected_to_server_flag will always be False when we don't have a user, so we need to check this case first
+ # we can't tell if the server is actually available or not in the case we don't have a user, but that's ok
self.__account_page_link.set_text("Click Here to Sign in", "red")
self.__account_page_link_connect_id = self.__account_page_link.connect("clicked", self.__open_server_page, "/who-are-you")
self.__account_page_link_2.set_text("Click Here to Sign in", "red")
self.__account_page_link_2_connect_id = self.__account_page_link_2.connect("clicked", self.__open_server_page, "/who-are-you")
+ elif save_online_flag and not connected_to_server_flag:
+ # tell the user that the server is not available (either it's down or they are not online)
+ self.__account_page_link.set_text("The Server is Not Available")
+ self.__account_page_link_connect_id = self.__account_page_link.connect("clicked", self.__open_server_page, "")
+ self.__account_page_link_2.set_text("The Server is Not Available")
+ self.__account_page_link_2_connect_id = self.__account_page_link_2.connect("clicked", self.__open_server_page, "")
else:
# display a Learn More link
self.__account_page_link.set_text("Learn More")
@@ -296,7 +308,10 @@
self.__save_online_check_box_2.set_active(new_save_online_flag)
self.__update_online_links()
- def __on__have_online_user_flag_changed(self, new_have_online_user_flag):
+ def __on_have_online_user_flag_changed(self, new_have_online_user_flag):
+ self.__update_online_links()
+
+ def __on_connected_to_server_flag_changed(self, new_connected_to_server_flag):
self.__update_online_links()
def __on_account_added(self, a_path):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]