Changeset 10138
- Timestamp:
- 08/06/08 22:34:36 (4 months ago)
- Location:
- trunk/src
- Files:
-
- 3 modified
-
config.py (modified) (1 diff)
-
dialogs.py (modified) (3 diffs)
-
roster_window.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/config.py
r10101 r10138 1881 1881 1882 1882 def on_change_password_button1_clicked(self, widget): 1883 def on_changed(new_password): 1884 if new_password is not None: 1885 gajim.connections[self.current_account].change_password( 1886 new_password) 1887 if self.xml.get_widget('save_password_checkbutton1').get_active(): 1888 self.xml.get_widget('password_entry1').set_text(new_password) 1889 1883 1890 try: 1884 dialog = dialogs.ChangePasswordDialog(self.current_account )1891 dialog = dialogs.ChangePasswordDialog(self.current_account, on_changed) 1885 1892 except GajimGeneralException: 1886 1893 # if we showed ErrorDialog, there will not be dialog instance 1887 1894 return 1888 1889 new_password = dialog.run()1890 if new_password != -1:1891 gajim.connections[self.current_account].change_password(new_password)1892 if self.xml.get_widget('save_password_checkbutton1').get_active():1893 self.xml.get_widget('password_entry1').set_text(new_password)1894 1895 1895 1896 def on_autoconnect_checkbutton_toggled(self, widget): -
trunk/src/dialogs.py
r10131 r10138 82 82 self.init_list() 83 83 84 def run(self):85 84 self.dialog.show_all() 86 85 if self.changes_made: … … 1980 1979 1981 1980 class ChangePasswordDialog: 1982 def __init__(self, account ):1981 def __init__(self, account, on_response): 1983 1982 # 'account' can be None if we are about to create our first one 1984 1983 if not account or gajim.connections[account].connected < 2: … … 1987 1986 raise GajimGeneralException, 'You are not connected to the server' 1988 1987 self.account = account 1988 self.on_response = on_response 1989 1989 self.xml = gtkgui_helpers.get_glade('change_password_dialog.glade') 1990 1990 self.dialog = self.xml.get_widget('change_password_dialog') 1991 1991 self.password1_entry = self.xml.get_widget('password1_entry') 1992 1992 self.password2_entry = self.xml.get_widget('password2_entry') 1993 self.dialog.connect('response', self.on_dialog_response) 1993 1994 1994 1995 self.dialog.show_all() 1995 1996 1996 def run(self): 1997 '''Wait for OK button to be pressed and return new password''' 1998 end = False 1999 while not end: 2000 rep = self.dialog.run() 2001 if rep == gtk.RESPONSE_OK: 2002 password1 = self.password1_entry.get_text().decode('utf-8') 2003 if not password1: 2004 ErrorDialog(_('Invalid password'), 2005 _('You must enter a password.')) 2006 continue 2007 password2 = self.password2_entry.get_text().decode('utf-8') 2008 if password1 != password2: 2009 ErrorDialog(_('Passwords do not match'), 2010 _('The passwords typed in both fields must be identical.')) 2011 continue 2012 message = password1 2013 else: 2014 message = -1 2015 end = True 2016 self.dialog.destroy() 2017 return message 2018 1997 def on_dialog_response(self, dialog, response): 1998 if response != gtk.RESPONSE_OK: 1999 dialog.destroy() 2000 self.on_response(None) 2001 return 2002 password1 = self.password1_entry.get_text().decode('utf-8') 2003 if not password1: 2004 ErrorDialog(_('Invalid password'), _('You must enter a password.')) 2005 return 2006 password2 = self.password2_entry.get_text().decode('utf-8') 2007 if password1 != password2: 2008 ErrorDialog(_('Passwords do not match'), 2009 _('The passwords typed in both fields must be identical.')) 2010 return 2011 dialog.destroy() 2012 self.on_response(password1) 2019 2013 2020 2014 class PopupNotificationWindow: -
trunk/src/roster_window.py
r10137 r10138 2728 2728 2729 2729 def on_remove_group_item_activated(self, widget, group, account): 2730 d lg = dialogs.ConfirmationDialogCheck(_('Remove Group'),2730 dialogs.ConfirmationDialogCheck(_('Remove Group'), 2731 2731 _('Do you want to remove group %s from the roster?' % group), 2732 _('Remove also all contacts in this group from your roster')) 2733 dlg.set_default_response(gtk.BUTTONS_OK_CANCEL) 2734 response = dlg.run() 2735 if response == gtk.RESPONSE_OK: 2732 _('Remove also all contacts in this group from your roster'), 2733 on_response_ok=on_ok) 2734 def on_ok(checked): 2736 2735 for contact in gajim.contacts.get_contacts_from_group(account, group): 2737 if not dlg.is_checked():2736 if not checked: 2738 2737 self.remove_contact_from_groups(contact.jid,account, [group]) 2739 2738 else: … … 2821 2820 2822 2821 def on_edit_groups(self, widget, list_): 2823 dlg = dialogs.EditGroupsDialog(list_) 2824 dlg.run() 2822 dialogs.EditGroupsDialog(list_) 2825 2823 2826 2824 def on_history(self, widget, contact, account):
