diff --git a/src/common/connection.py b/src/common/connection.py index 2039a140c..b88eef336 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -764,7 +764,7 @@ class Connection: iq.setID(id) self.connection.send(iq) - def unregister_account(self, account_name) + def unregister_account(self, account_name): pass #FIXME: WRITE THE CODE def process(self, timeout): diff --git a/src/config.py b/src/config.py index afd356c09..ede99f9e6 100644 --- a/src/config.py +++ b/src/config.py @@ -1364,36 +1364,18 @@ class Accounts_window: self.plugin.windows['account_modification'] = \ Account_modification_window(self.plugin, '') - def on_remove_button_clicked(self, widget): - '''When remove button is clicked: + '''When delete button is clicked : Remove an account from the listStore and from the config file''' sel = self.accounts_treeview.get_selection() (model, iter) = sel.get_selected() if not iter: return - dialog = self.xml.get_widget('remove_account_dialog') - remove_and_unregister_radiobutton = self.xml.get_widget(\ - 'remove_and_unregister_radiobutton') account = model.get_value(iter, 0) - dialog.set_title(_('Removing (%s) account') % account) - if dialog.get_response() == gtk.RESPONSE_YES: - if gajim.connections[account].connected: #FIXME: WHAT? user doesn't know this does he? - gajim.connections[account].change_status('offline', 'offline') - unregister = False - if remove_and_unregister_radiobutton.get_active(): - unregister = True - del gajim.connections[account] - gajim.config.del_per('accounts', account) - del self.plugin.windows[account] - del self.plugin.queues[account] - del self.plugin.roster.groups[account] - del self.plugin.roster.contacts[account] - del self.plugin.roster.to_be_removed[account] - del self.plugin.roster.newlt_added[account] - self.plugin.roster.draw_roster() - self.init_accounts() - if unregister: - pass #FIXME: call Connection.remove_account(account) + if self.plugin.windows[account].has_key('remove_account'): + self.plugin.windows[account]['remove_account'].window.present() + else: + self.plugin.windows[account]['remove_account'] = \ + Remove_account_window(self.plugin, account) def on_modify_button_clicked(self, widget): '''When modify button is clicked: @@ -1921,3 +1903,47 @@ class Service_discovery_window: self.services_treeview.get_model().clear() self.browse(server_address) self.plugin.save_config() + +class Remove_account_window: + '''ask for removing from gajim only or from gajim and server too + and do removing of the account given''' + + def on_remove_account_window_destroy(self, widget): + '''close window''' + del self.plugin.windows[self.account]['remove_account'] + + def on_cancel_button_clicked(self, widget): + self.window.destroy() + + def __init__(self, plugin, account): + self.plugin = plugin + self.account = account + xml = gtk.glade.XML(GTKGUI_GLADE, 'remove_account_window', APP) + self.window = xml.get_widget('remove_account_window') + self.remove_and_unregister_radiobutton = xml.get_widget(\ + 'remove_and_unregister_radiobutton') + self.window.set_title(_('Removing %s account') % self.account) + xml.signal_autoconnect(self) + self.window.show_all() + + def on_remove_button_clicked(self, widget): + if gajim.connections[self.account].connected: #FIXME: user unfriendly?? + gajim.connections[self.account].change_status('offline', 'offline') + + unregister = False + if self.remove_and_unregister_radiobutton.get_active(): + unregister = True + return #FIXME: remove me when ready + del gajim.connections[self.account] + gajim.config.del_per('accounts', self.account) + del self.plugin.windows[self.account] + del self.plugin.queues[self.account] + del self.plugin.roster.groups[self.account] + del self.plugin.roster.contacts[self.account] + del self.plugin.roster.to_be_removed[self.account] + del self.plugin.roster.newlt_added[self.account] + self.plugin.roster.draw_roster() + self.init_accounts() + if unregister: + pass #FIXME: call Connection.remove_account(self.account) + self.window.destroy() diff --git a/src/gajim.py b/src/gajim.py index 05533bfb1..87858d269 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -683,7 +683,7 @@ class Interface: # get instances for windows/dialogs that will show_all()/hide() self.windows['preferences'] = config.Preferences_window(self) - self.windows['add_remove_emoticons_window'] = \ + self.windows['add_remove_emoticons'] = \ config.Add_remove_emoticons_window(self) self.windows['roster'] = self.roster diff --git a/src/gtkgui.glade b/src/gtkgui.glade index b98d57d1e..eea532d28 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -472,11 +472,73 @@ True - gtk-delete - True GTK_RELIEF_NORMAL True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-delete + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Remove + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + @@ -5805,7 +5867,7 @@ Custom True 0 0.5 - GTK_SHADOW_IN + GTK_SHADOW_ETCHED_IN @@ -5829,7 +5891,7 @@ Custom True True - Do not send OS Information + Do not send _OS information True GTK_RELIEF_NORMAL True @@ -5849,7 +5911,7 @@ Custom True True - Do not check for new version at startup + Do not check for new _version at startup True GTK_RELIEF_NORMAL True @@ -10276,7 +10338,7 @@ send a chat message to True False False - GDK_WINDOW_TYPE_HINT_NORMAL + GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True @@ -10551,11 +10613,8 @@ send a chat message to - + 4 - 400 - 130 - True GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -10565,118 +10624,17 @@ send a chat message to True False False - GDK_WINDOW_TYPE_HINT_DIALOG + GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True - False + - - + + True False 5 - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - -5 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-delete - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Remove - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - GTK_PACK_END - - - True @@ -10804,6 +10762,107 @@ send a chat message to False + + + + True + GTK_BUTTONBOX_END + 10 + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-delete + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Remove + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + + 0 + False + False + +