diff --git a/src/config.py b/src/config.py index ed2c663ac..104e29538 100644 --- a/src/config.py +++ b/src/config.py @@ -2410,13 +2410,9 @@ class AccountCreationWizardWindow: self.window = self.xml.get_widget('wizard_window') # Connect events from comboboxentry.child - server_comboboxentry = self.xml.get_widget('existing_server_comboboxentry') + server_comboboxentry = self.xml.get_widget('server_comboboxentry') server_comboboxentry.child.connect('key_press_event', self.on_server_comboboxentry_key_press_event) - register_server_comboboxentry = self.xml.get_widget( - 'register_server_comboboxentry') - register_server_comboboxentry.child.connect('key_press_event', - self.on_server_comboboxentry_key_press_event) # parse servers.xml servers_xml = os.path.join(gajim.DATA_DIR, 'other', 'servers.xml') @@ -2428,8 +2424,6 @@ class AccountCreationWizardWindow: # Put servers into comboboxentries server_comboboxentry.set_model(servers_model) server_comboboxentry.set_text_column(0) - register_server_comboboxentry.set_model(servers_model) - register_server_comboboxentry.set_text_column(0) # Generic widgets self.notebook = self.xml.get_widget('notebook') @@ -2460,12 +2454,7 @@ class AccountCreationWizardWindow: helpers.launch_browser_mailer('url', 'http://www.jabber.org/network/') def on_save_password_checkbutton_toggled(self, widget): - if widget.get_name() == 'existing_save_password_checkbutton': - widget2 = self.xml.get_widget('existing_pass_entry') - if widget2.get_property('sensitive'): - widget2.set_sensitive(False) - else: - widget2.set_sensitive(True) + self.xml.get_widget('pass_entry').grab_focus() def on_cancel_button_clicked(self, widget): self.window.destroy() @@ -2473,11 +2462,9 @@ class AccountCreationWizardWindow: def on_back_button_clicked(self, widget): if self.notebook.get_current_page() == 1: self.notebook.set_current_page(0) - elif self.notebook.get_current_page() == 2: - self.notebook.set_current_page(0) self.back_button.set_sensitive(False) - def get_widgets(self, prefix): + def get_widgets(self): widgets = {} for widget in ( 'nick_entry', @@ -2489,46 +2476,40 @@ class AccountCreationWizardWindow: 'proxyuser_entry', 'proxypass_entry', 'jid_label'): - widgets[widget] = self.xml.get_widget(prefix + widget) + widgets[widget] = self.xml.get_widget(widget) return widgets - def get_matching_widgets(self, widget): - if widget.get_name().startswith('existing_'): - return self.get_widgets('existing_') - elif widget.get_name().startswith('register_'): - return self.get_widgets('register_') - def on_forward_button_clicked(self, widget): cur_page = self.notebook.get_current_page() if cur_page == 0: widget = self.xml.get_widget('use_existing_account_radiobutton') if widget.get_active(): - self.notebook.set_current_page(1) + self.modify = True + self.xml.get_widget('server_features_button').hide() else: - self.notebook.set_current_page(2) + self.modify = False + self.xml.get_widget('server_features_button').show() + self.notebook.set_current_page(1) self.back_button.set_sensitive(True) return else: - if cur_page == 1: - widgets = self.get_widgets('existing_') - register_new = False + if self.modify: #FIXME: pango me finish_text = _('Account has been added successfully.\n' 'You can set advanced account options by pressing Advanced button,\nor later by clicking in Accounts menuitem under Edit menu from the main window.') - elif cur_page == 2: - widgets = self.get_widgets('register_') - register_new = True + else: #FIXME: pango me finish_text = _('Your new account has been created successfully.\n' 'You can set advanced account options by pressing Advanced button,\nor later by clicking in Accounts menuitem under Edit menu from the main window.') + widgets = self.get_widgets() username = widgets['nick_entry'].get_text().decode('utf-8') server = widgets['server_comboboxentry'].child.get_text() savepass = widgets['save_password_checkbutton'].get_active() password = widgets['pass_entry'].get_text() - + jid = username + '@' + server # check if jid is conform to RFC and stringprep it try: @@ -2539,15 +2520,14 @@ class AccountCreationWizardWindow: return username, server = gajim.get_room_name_and_server_from_room_jid(jid) - self.save_account(self.account, username, server, savepass, password, - register_new) + self.save_account(self.account, username, server, savepass, password) self.finish_label.set_text(finish_text) self.xml.get_widget('cancel_button').hide() self.back_button.hide() self.xml.get_widget('forward_button').hide() self.finish_button.set_sensitive(True) self.advanced_button.show() - self.notebook.set_current_page(3) + self.notebook.set_current_page(2) def on_advanced_button_clicked(self, widget): gajim.interface.windows[self.account]['account_modification'] = \ @@ -2566,41 +2546,44 @@ class AccountCreationWizardWindow: def on_nick_entry_key_press_event(self, widget, event): # Check for pressed @ and jump to combobox if found if event.keyval == gtk.keysyms.at: - widgets = self.get_matching_widgets(widget) - widgets['server_comboboxentry'].grab_focus() - widgets['server_comboboxentry'].child.set_position(-1) + combobox = self.xml.get_widget('server_comboboxentry') + combobox.grab_focus() + combobox.child.set_position(-1) return True def on_server_comboboxentry_key_press_event(self, widget, event): # If backspace is pressed in empty field, return to the nick entry field - widgets = self.get_matching_widgets(widget.parent) backspace = event.keyval == gtk.keysyms.BackSpace - empty = len(widgets['server_comboboxentry'].get_active_text()) == 0 + combobox = self.xml.get_widget('server_comboboxentry') + empty = len(combobox.get_active_text()) == 0 if backspace and empty: - widgets['nick_entry'].grab_focus() - widgets['nick_entry'].set_position(-1) + nick_entry = self.xml.get_widget('nick_entry') + nick_entry.grab_focus() + nick_entry.set_position(-1) return True def update_jid(self,widget): - widgets = self.get_matching_widgets(widget) - name = widgets['nick_entry'].get_text().decode('utf-8') - server = widgets['server_comboboxentry'].get_active_text() + nick_entry = self.xml.get_widget('nick_entry') + name = nick_entry.get_text().decode('utf-8') + combobox = self.xml.get_widget('server_comboboxentry') + server = combobox.get_active_text() + jid_label = self.xml.get_widget('jid_label') if len(name) == 0 or len(server) == 0: - widgets['jid_label'].set_label('') + jid_label.set_label('') else: string = '%s@%s' % (name, server) - widgets['jid_label'].set_label(string) + jid_label.set_label(string) - def save_account(self, name, login, server, savepass, password, new_account): + def save_account(self, name, login, server, savepass, password): + if not self.modify and password == '': + dialogs.ErrorDialog(_('Invalid password'), + _('You must enter a password for the new account.')).get_response() + return config = {} config['name'] = login config['hostname'] = server config['savepass'] = savepass config['password'] = password - if new_account and config['password'] == '': - dialogs.ErrorDialog(_('Invalid password'), - _('You must enter a password for the new account.')).get_response() - return config['resource'] = 'Gajim' config['priority'] = 5 config['autoconnect'] = self.autoconnect @@ -2622,7 +2605,7 @@ class AccountCreationWizardWindow: return con = connection.Connection(name) gajim.interface.register_handlers(con) - if new_account: + if not self.modify: gajim.events_for_ui[name] = [] con.new_account(name, config) return diff --git a/src/gtkgui.glade b/src/gtkgui.glade index 196962df8..fef598d79 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -13507,7 +13507,8 @@ Status message True - False + True + True False GTK_POS_TOP False @@ -13673,569 +13674,6 @@ to the Jabber network. - - - 6 - True - False - 12 - - - - True - <b>Fill in the data for your existing account</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 5 - 3 - False - 6 - 12 - - - - True - True - True - True - 0 - - True - * - False - - - - - 1 - 2 - 0 - 1 - - - - - - - True - _Server: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - False - True - True - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - _Password: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - existing_pass_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - If checked, Gajim will remember the password for this account - True - Save pass_word - True - GTK_RELIEF_NORMAL - False - False - False - True - - - - 2 - 3 - 2 - 3 - fill - - - - - - - True - False - True - True - False - 0 - - True - * - True - - - - 1 - 2 - 2 - 3 - - - - - - - True - _Nickname: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - existing_nick_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - False - 0 - - - - 5 - True - 4 - 2 - False - 5 - 5 - - - - True - _Host: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - existing_proxyhost_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Port: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - existing_proxyport_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - _Username: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - existing_proxyuser_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - Pass_word: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - existing_proxypass_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - - 1 - 2 - 0 - 1 - - - - - - - True - True - True - True - 0 - 3128 - True - * - False - - - - 1 - 2 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - - 1 - 2 - 2 - 3 - - - - - - - True - True - True - True - 0 - - True - * - False - - - - 1 - 2 - 3 - 4 - - - - - - - - - True - _Use proxy - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - 3 - 3 - 4 - fill - - - - - - True - True - - False - True - GTK_JUSTIFY_LEFT - False - True - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 3 - 4 - 5 - fill - - - - - - - True - Your JID: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 4 - 5 - fill - - - - - - 0 - True - True - - - - - False - True - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - 6 @@ -14278,7 +13716,7 @@ to the Jabber network. 12 - + True True True @@ -14329,7 +13767,7 @@ to the Jabber network. - + True False True @@ -14347,7 +13785,7 @@ to the Jabber network. - + True Click to see features (like MSN, ICQ transports) of jabber servers True @@ -14380,7 +13818,7 @@ to the Jabber network. 0.5 0 0 - register_pass_entry + pass_entry PANGO_ELLIPSIZE_NONE -1 False @@ -14397,7 +13835,7 @@ to the Jabber network. - + True If checked, Gajim will remember the password for this account True @@ -14421,7 +13859,7 @@ to the Jabber network. - + True True True @@ -14455,7 +13893,7 @@ to the Jabber network. 0.5 0 0 - register_nick_entry + nick_entry PANGO_ELLIPSIZE_NONE -1 False @@ -14500,7 +13938,7 @@ to the Jabber network. - + True True @@ -14587,7 +14025,7 @@ to the Jabber network. 0.5 0 0 - register_proxyport_entry + proxyport_entry PANGO_ELLIPSIZE_NONE -1 False @@ -14616,7 +14054,7 @@ to the Jabber network. 0.5 0 0 - register_proxyuser_entry + proxyuser_entry PANGO_ELLIPSIZE_NONE -1 False @@ -14645,7 +14083,7 @@ to the Jabber network. 0.5 0 0 - register_proxypass_entry + proxypass_entry PANGO_ELLIPSIZE_NONE -1 False @@ -14683,7 +14121,7 @@ to the Jabber network. - + True True True @@ -14705,7 +14143,7 @@ to the Jabber network. - + True True True @@ -14727,7 +14165,7 @@ to the Jabber network. - + True True True