save plugin on SAVE button for account modification window

This commit is contained in:
Nikos Kouremenos 2005-04-20 23:20:26 +00:00
parent 387e09162f
commit 8f2cfe50bd
1 changed files with 24 additions and 41 deletions

View File

@ -980,9 +980,8 @@ class Account_modification_window:
def on_save_button_clicked(self, widget): def on_save_button_clicked(self, widget):
'''When save button is clicked: Save information in config file''' '''When save button is clicked: Save information in config file'''
save_password = 0 save_password =
if self.xml.get_widget('save_password_checkbutton').get_active(): self.xml.get_widget('save_password_checkbutton').get_active()
save_password = 1
password = self.xml.get_widget('password_entry').get_text() password = self.xml.get_widget('password_entry').get_text()
resource = self.xml.get_widget('resource_entry').get_text() resource = self.xml.get_widget('resource_entry').get_text()
priority = self.xml.get_widget('priority_spinbutton').get_value_as_int() priority = self.xml.get_widget('priority_spinbutton').get_value_as_int()
@ -994,12 +993,10 @@ class Account_modification_window:
dialogs.Error_dialog(_('You must be offline to change the account\'s name')) dialogs.Error_dialog(_('You must be offline to change the account\'s name'))
return return
jid = self.xml.get_widget('jid_entry').get_text() jid = self.xml.get_widget('jid_entry').get_text()
autoconnect = 0 autoconnect = self.xml.get_widget('autoconnect_checkbutton').get_active()
if self.xml.get_widget('autoconnect_checkbutton').get_active():
autoconnect = 1
if self.account: if self.account:
list_no_log_for = gajim.config.get_per('accounts', self.account, \ list_no_log_for = gajim.config.get_per('accounts', self.account,
'no_log_for').split() 'no_log_for').split()
else: else:
list_no_log_for = [] list_no_log_for = []
@ -1008,14 +1005,10 @@ class Account_modification_window:
if not self.xml.get_widget('log_history_checkbutton').get_active(): if not self.xml.get_widget('log_history_checkbutton').get_active():
list_no_log_for.append(name) list_no_log_for.append(name)
sync_with_global_status = 0 sync_with_global_status_checkbutton =
if self.xml.get_widget('sync_with_global_status_checkbutton').\ self.xml.get_widget('sync_with_global_status_checkbutton').get_active()
get_active():
sync_with_global_status = 1
use_proxy = 0 use_proxy = self.xml.get_widget('use_proxy_checkbutton').get_active()
if self.xml.get_widget('use_proxy_checkbutton').get_active():
use_proxy = 1
proxyhost = self.xml.get_widget('proxyhost_entry').get_text() proxyhost = self.xml.get_widget('proxyhost_entry').get_text()
proxyport = self.xml.get_widget('proxyport_entry').get_text() proxyport = self.xml.get_widget('proxyport_entry').get_text()
if (name == ''): if (name == ''):
@ -1048,13 +1041,12 @@ class Account_modification_window:
key_name = self.xml.get_widget('gpg_name_label').get_text() key_name = self.xml.get_widget('gpg_name_label').get_text()
if key_name == '': #no key selected if key_name == '': #no key selected
keyID = '' keyID = ''
save_gpg_password = 0 save_gpg_password = False
gpg_password = '' gpg_password = ''
else: else:
keyID = self.xml.get_widget('gpg_key_label').get_text() keyID = self.xml.get_widget('gpg_key_label').get_text()
save_gpg_password = 0 save_gpg_password =
if self.xml.get_widget('gpg_save_password_checkbutton').get_active(): self.xml.get_widget('gpg_save_password_checkbutton').get_active()
save_gpg_password = 1
gpg_password = self.xml.get_widget('gpg_password_entry').get_text() gpg_password = self.xml.get_widget('gpg_password_entry').get_text()
#if we are modifying an account #if we are modifying an account
if self.modify: if self.modify:
@ -1120,6 +1112,7 @@ class Account_modification_window:
self.plugin.windows['accounts'].init_accounts() self.plugin.windows['accounts'].init_accounts()
#refresh roster #refresh roster
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
self.window.destroy() self.window.destroy()
return return
#if it's a new account #if it's a new account
@ -1170,6 +1163,7 @@ class Account_modification_window:
self.plugin.windows['accounts'].init_accounts() self.plugin.windows['accounts'].init_accounts()
#refresh roster #refresh roster
self.plugin.roster.draw_roster() self.plugin.roster.draw_roster()
self.plugin.save_config()
self.window.destroy() self.window.destroy()
def on_change_password_button_clicked(self, widget): def on_change_password_button_clicked(self, widget):
@ -1188,30 +1182,24 @@ class Account_modification_window:
self.account = acct self.account = acct
jid = self.xml.get_widget('jid_entry').get_text() jid = self.xml.get_widget('jid_entry').get_text()
(login, hostname) = jid.split('@') (login, hostname) = jid.split('@')
save_password = 0
password = self.xml.get_widget('password_entry').get_text() password = self.xml.get_widget('password_entry').get_text()
resource = self.xml.get_widget('resource_entry').get_text() resource = self.xml.get_widget('resource_entry').get_text()
priority = self.xml.get_widget('priority_spinbutton').get_value_as_int() priority = self.xml.get_widget('priority_spinbutton').get_value_as_int()
autoconnect = 0 autoconnect = self.xml.get_widget('autoconnect_checkbutton').get_active()
if self.xml.get_widget('autoconnect_checkbutton').get_active(): use_proxy = self.xml.get_widget('use_proxy_checkbutton').get_active()
autoconnect = 1
use_proxy = 0
if self.xml.get_widget('use_proxy_checkbutton').get_active():
use_proxy = 1
proxyhost = self.xml.get_widget('proxyhost_entry').get_text() proxyhost = self.xml.get_widget('proxyhost_entry').get_text()
proxyport = self.xml.get_widget('proxyport_entry').get_text() proxyport = self.xml.get_widget('proxyport_entry').get_text()
key_name = self.xml.get_widget('gpg_name_label').get_text() key_name = self.xml.get_widget('gpg_name_label').get_text()
if self.xml.get_widget('save_password_checkbutton').get_active(): save_password =
save_password = 1 self.xml.get_widget('save_password_checkbutton').get_active()
if key_name == '': #no key selected if key_name == '': #no key selected
keyID = '' keyID = ''
save_gpg_password = 0 save_gpg_password = False
gpg_password = '' gpg_password = ''
else: else:
keyID = self.xml.get_widget('gpg_key_label').get_text() keyID = self.xml.get_widget('gpg_key_label').get_text()
save_gpg_password = 0 save_gpg_password =
if self.xml.get_widget('gpg_save_password_checkbutton').get_active(): self.xml.get_widget('gpg_save_password_checkbutton').get_active()
save_gpg_password = 1
gpg_password = self.xml.get_widget('gpg_password_entry').get_text() gpg_password = self.xml.get_widget('gpg_password_entry').get_text()
no_log_for = '' no_log_for = ''
if self.xml.get_widget('log_history_checkbutton').get_active(): if self.xml.get_widget('log_history_checkbutton').get_active():
@ -1379,12 +1367,6 @@ class Accounts_window:
self.plugin.windows[account]['account_modification'] = \ self.plugin.windows[account]['account_modification'] = \
Account_modification_window(self.plugin, account) Account_modification_window(self.plugin, account)
def on_sync_with_global_status_checkbutton_toggled(self, widget):
gajim.config.set_per('accounts', account,
'sync_with_global_status',
not widget.get_active())
self.plugin.save_config()
def __init__(self, plugin): def __init__(self, plugin):
self.plugin = plugin self.plugin = plugin
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'accounts_window', APP) self.xml = gtk.glade.XML(GTKGUI_GLADE, 'accounts_window', APP)
@ -1636,6 +1618,9 @@ class Service_discovery_window:
self.window.destroy() self.window.destroy()
def __init__(self, plugin, account): def __init__(self, plugin, account):
self.plugin = plugin
self.account = account
self.agent_infos = {}
if gajim.connections[account].connected < 2: if gajim.connections[account].connected < 2:
dialogs.Error_dialog(_('You must be connected to browse services')) dialogs.Error_dialog(_('You must be connected to browse services'))
del self.plugin.windows[self.account]['disco'] del self.plugin.windows[self.account]['disco']
@ -1648,9 +1633,7 @@ class Service_discovery_window:
self.address_comboboxentry = xml.get_widget('address_comboboxentry') self.address_comboboxentry = xml.get_widget('address_comboboxentry')
self.address_comboboxentry_entry = self.address_comboboxentry.child self.address_comboboxentry_entry = self.address_comboboxentry.child
self.address_comboboxentry_entry.set_activates_default(True) self.address_comboboxentry_entry.set_activates_default(True)
self.plugin = plugin
self.account = account
self.agent_infos = {}
model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.services_treeview.set_model(model) self.services_treeview.set_model(model)
#columns #columns