online-desktop r7284 - in trunk/weblogindriver: . weblogindriver
- From: marinaz svn gnome org
- To: svn-commits-list gnome org
- Subject: online-desktop r7284 - in trunk/weblogindriver: . weblogindriver
- Date: Tue, 28 Oct 2008 07:45:37 +0000 (UTC)
Author: marinaz
Date: Tue Oct 28 07:45:36 2008
New Revision: 7284
URL: http://svn.gnome.org/viewvc/online-desktop?rev=7284&view=rev
Log:
Turn username label into a link and open a helpful page for finding the account info for a given type when the link is clicked.
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 07:45:36 2008
@@ -309,7 +309,7 @@
TYPE_GOOGLE = "google"
-ONLINE_ACCOUNT_TYPES = {TYPE_GOOGLE : ("Google", "Gmail or Google Apps for Your Domain email")}
+ONLINE_ACCOUNT_TYPES = {TYPE_GOOGLE : ("Google", "Gmail or Google Apps for Your Domain email", "http://gmail.com")}
ACCOUNT_TYPES_FROM_SERVER = set([TYPE_GOOGLE])
@@ -678,8 +678,9 @@
name = node.getAttribute("name")
full_name = node.getAttribute("fullName")
user_info_type = node.getAttribute("userInfoType")
+ link = node.getAttribute("helpfulLink")
_logger.debug("parsing online account type name=%s full_name=%s" % (name, full_name))
- ONLINE_ACCOUNT_TYPES[name]= (full_name, user_info_type)
+ ONLINE_ACCOUNT_TYPES[name]= (full_name, user_info_type, link)
ACCOUNT_TYPES_FROM_SERVER.add(name)
self.__received_account_types_from_server = True
except urllib2.HTTPError, e:
@@ -1324,22 +1325,22 @@
return object_paths_list
@dbus.service.method(OA_BUS_IFACE_STR,
- out_signature="a{s(ss)}")
+ out_signature="a{s(sss)}")
def GetAllAccountTypes(self):
_logger.debug("in GetAllAccountTypes")
return ONLINE_ACCOUNT_TYPES
@dbus.service.method(OA_BUS_IFACE_STR,
- in_signature="sss")
- def EnsureAccountType(self, type_name, type_full_name, type_user_info_type):
+ in_signature="ssss")
+ def EnsureAccountType(self, type_name, type_full_name, type_user_info_type, type_link):
# we don't overwrite the information we already have (that was possibly received from
# the server or added by another application), but we add an account type if it doesn't
# exist
if type_name not in ONLINE_ACCOUNT_TYPES:
- for (name, (full_name, user_info_type)) in ONLINE_ACCOUNT_TYPES.items():
+ for (name, (full_name, user_info_type, link)) in ONLINE_ACCOUNT_TYPES.items():
if type_full_name == full_name:
raise dbus.DBusException("Account type with this full name already exists and is associated with a short name " + name)
- ONLINE_ACCOUNT_TYPES[type_name]= (type_full_name, type_user_info_type)
+ ONLINE_ACCOUNT_TYPES[type_name]= (type_full_name, type_user_info_type, type_link)
@dbus.service.method(OA_BUS_IFACE_STR,
in_signature="u")
Modified: trunk/weblogindriver/weblogindriver/accounts_dialog.py
==============================================================================
--- trunk/weblogindriver/weblogindriver/accounts_dialog.py (original)
+++ trunk/weblogindriver/weblogindriver/accounts_dialog.py Tue Oct 28 07:45:36 2008
@@ -153,12 +153,14 @@
self.__all_account_types = self.__online_accounts_service.GetAllAccountTypes()
_logger.debug("will get accounts types 2")
self.__user_info_types_by_full_name = {}
+ self.__type_links_by_full_name = {}
- for (account_type, (type_full_name, user_info_type)) in self.__all_account_types.items():
+ for (account_type, (type_full_name, user_info_type, type_link)) in self.__all_account_types.items():
if (not self.__account_types) or account_type in self.__account_types:
self.__account_types_model.append([type_full_name])
self.__user_info_types_by_full_name[type_full_name] = user_info_type
-
+ self.__type_links_by_full_name[type_full_name] = type_link
+
# Setting padding to 1 here is a hack to get the content of both tabs to be aligned,
# we'll need to change this when it will become possible to add new account types to
# the existing dialog, for example, by adding stocks that require these account types
@@ -172,14 +174,15 @@
self.__username_entry.connect('activate',
self.__on_new_username_added)
- username_vbox = gtk.VBox(spacing=2)
- self.__username_label = gtk.Label("Username:")
- self.__username_label.set_size_request(DIALOG_WIDTH - 20, -1)
- self.__username_label.set_alignment(0.0, 0.5)
- self.__username_label.set_line_wrap(True)
- username_vbox.pack_start(self.__username_label, False, False)
- username_vbox.pack_end(self.__username_entry, False, False)
- self.__new_account_vbox.pack_start(username_vbox, padding=padding)
+ self.__username_vbox = gtk.VBox(spacing=2)
+ self.__username_link = Link()
+ self.__username_link.set_size_request(DIALOG_WIDTH - 20, -1)
+ self.__username_link.set_alignment(0.0, 0.5)
+ self.__username_link.set_line_wrap(True)
+ self.__username_link_connect_id = None
+ self.__username_vbox.pack_start(self.__username_link, False, False)
+ self.__username_vbox.pack_end(self.__username_entry, False, False)
+ self.__new_account_vbox.pack_start(self.__username_vbox, padding=padding)
self.__add_button_box = gtk.HBox()
self.__add_button = gtk.Button(label="Add Account")
@@ -226,7 +229,7 @@
if len(self.__account_types_model) == 0:
self.__account_types_combo.hide()
- self.__username_label.hide()
+ self.__username_link.hide()
self.__username_entry.hide()
self.__add_button.hide()
@@ -265,6 +268,9 @@
def __open_server_page(self, l, page):
gnome.url_show(urlparse.urljoin(ddm_util.get_baseurl(), page))
+ def __open_page(self, l, page):
+ gnome.url_show(page)
+
def __update_online_links(self):
save_online_flag = self.__online_accounts_service.GetSaveOnlineFlag()
have_online_user_flag = self.__online_accounts_service.GetHaveOnlineUserFlag()
@@ -376,7 +382,11 @@
def __on_edited_account_type_changed(self, *args):
new_iter = self.__account_types_combo.get_active_iter()
_logger.debug("account type changed to %s" % self.__account_types_model.get_value(new_iter, 0))
- self.__username_label.set_text(self.__user_info_types_by_full_name[self.__account_types_model.get_value(new_iter, 0)] + ":")
+ if self.__username_link_connect_id is not None:
+ self.__username_link.disconnect(self.__username_link_connect_id)
+
+ self.__username_link.set_text(self.__user_info_types_by_full_name[self.__account_types_model.get_value(new_iter, 0)] + ":")
+ self.__username_link_connect_id = self.__username_link.connect("clicked", self.__open_page, self.__type_links_by_full_name[self.__account_types_model.get_value(new_iter, 0)])
def __on_edited_account_changed(self, *args):
new_iter = self.__accounts_combo.get_active_iter()
@@ -525,12 +535,18 @@
& gtk.gdk.ENTER_NOTIFY_MASK
& gtk.gdk.LEAVE_NOTIFY_MASK)
+ def set_size_request(self, width, height):
+ self.__label.set_size_request(width, height)
+
def set_alignment(self, x, y):
self.__label.set_alignment(x, y)
def set_ellipsize(self, do_ellipsize):
self.__label.set_ellipsize(do_ellipsize)
+ def set_line_wrap(self, do_line_wrap):
+ self.__label.set_line_wrap(do_line_wrap)
+
def __on_button_press(self, self2, e):
if e.button == 1 and self.__enabled:
self.emit("clicked")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]