glade and code fixes. still code for unregistering is missing

This commit is contained in:
Nikos Kouremenos 2005-04-19 23:43:58 +00:00
parent c5aa9f0e81
commit ba272a9553
4 changed files with 226 additions and 141 deletions

View File

@ -764,7 +764,7 @@ class Connection:
iq.setID(id) iq.setID(id)
self.connection.send(iq) self.connection.send(iq)
def unregister_account(self, account_name) def unregister_account(self, account_name):
pass #FIXME: WRITE THE CODE pass #FIXME: WRITE THE CODE
def process(self, timeout): def process(self, timeout):

View File

@ -1364,36 +1364,18 @@ class Accounts_window:
self.plugin.windows['account_modification'] = \ self.plugin.windows['account_modification'] = \
Account_modification_window(self.plugin, '') Account_modification_window(self.plugin, '')
def on_remove_button_clicked(self, widget): 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''' Remove an account from the listStore and from the config file'''
sel = self.accounts_treeview.get_selection() sel = self.accounts_treeview.get_selection()
(model, iter) = sel.get_selected() (model, iter) = sel.get_selected()
if not iter: return 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) account = model.get_value(iter, 0)
dialog.set_title(_('Removing (%s) account') % account) if self.plugin.windows[account].has_key('remove_account'):
if dialog.get_response() == gtk.RESPONSE_YES: self.plugin.windows[account]['remove_account'].window.present()
if gajim.connections[account].connected: #FIXME: WHAT? user doesn't know this does he? else:
gajim.connections[account].change_status('offline', 'offline') self.plugin.windows[account]['remove_account'] = \
unregister = False Remove_account_window(self.plugin, account)
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)
def on_modify_button_clicked(self, widget): def on_modify_button_clicked(self, widget):
'''When modify button is clicked: '''When modify button is clicked:
@ -1921,3 +1903,47 @@ class Service_discovery_window:
self.services_treeview.get_model().clear() self.services_treeview.get_model().clear()
self.browse(server_address) self.browse(server_address)
self.plugin.save_config() 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()

View File

@ -683,7 +683,7 @@ class Interface:
# get instances for windows/dialogs that will show_all()/hide() # get instances for windows/dialogs that will show_all()/hide()
self.windows['preferences'] = config.Preferences_window(self) self.windows['preferences'] = config.Preferences_window(self)
self.windows['add_remove_emoticons_window'] = \ self.windows['add_remove_emoticons'] = \
config.Add_remove_emoticons_window(self) config.Add_remove_emoticons_window(self)
self.windows['roster'] = self.roster self.windows['roster'] = self.roster

View File

@ -472,11 +472,73 @@
<child> <child>
<widget class="GtkButton" id="remove_button"> <widget class="GtkButton" id="remove_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-delete</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
<signal name="clicked" handler="on_remove_button_clicked" last_modification_time="Tue, 19 Apr 2005 22:15:48 GMT"/> <signal name="clicked" handler="on_remove_button_clicked" last_modification_time="Tue, 19 Apr 2005 22:15:48 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment61">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2953">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image500">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label244">
<property name="visible">True</property>
<property name="label">_Remove</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget> </widget>
</child> </child>
@ -5805,7 +5867,7 @@ Custom</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="label_xalign">0</property> <property name="label_xalign">0</property>
<property name="label_yalign">0.5</property> <property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child> <child>
<widget class="GtkAlignment" id="alignment56"> <widget class="GtkAlignment" id="alignment56">
@ -5829,7 +5891,7 @@ Custom</property>
<widget class="GtkCheckButton" id="do_not_send_os_info_checkbutton"> <widget class="GtkCheckButton" id="do_not_send_os_info_checkbutton">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Do not send OS Information</property> <property name="label" translatable="yes">Do not send _OS information</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
@ -5849,7 +5911,7 @@ Custom</property>
<widget class="GtkCheckButton" id="do_not_check_for_new_version_checkbutton"> <widget class="GtkCheckButton" id="do_not_check_for_new_version_checkbutton">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Do not check for new version at startup</property> <property name="label" translatable="yes">Do not check for new _version at startup</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
@ -10276,7 +10338,7 @@ send a chat message to</property>
<property name="decorated">True</property> <property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property> <property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property> <property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property> <property name="focus_on_map">True</property>
<signal name="delete_event" handler="on_add_remove_emoticons_window_delete_event" last_modification_time="Wed, 06 Apr 2005 15:34:38 GMT"/> <signal name="delete_event" handler="on_add_remove_emoticons_window_delete_event" last_modification_time="Wed, 06 Apr 2005 15:34:38 GMT"/>
@ -10551,11 +10613,8 @@ send a chat message to</property>
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="remove_account_dialog"> <widget class="GtkWindow" id="remove_account_window">
<property name="border_width">4</property> <property name="border_width">4</property>
<property name="width_request">400</property>
<property name="height_request">130</property>
<property name="visible">True</property>
<property name="title" translatable="yes"></property> <property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
@ -10565,118 +10624,17 @@ send a chat message to</property>
<property name="decorated">True</property> <property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property> <property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property> <property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property> <property name="focus_on_map">True</property>
<property name="has_separator">False</property> <signal name="destroy" handler="on_remove_account_window_destroy" last_modification_time="Tue, 19 Apr 2005 23:40:23 GMT"/>
<child internal-child="vbox"> <child>
<widget class="GtkVBox" id="dialog-vbox10"> <widget class="GtkVBox" id="vbox69">
<property name="visible">True</property> <property name="visible">True</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area9">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton3">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="okbutton3">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<child>
<widget class="GtkAlignment" id="alignment60">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2952">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image499">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label243">
<property name="visible">True</property>
<property name="label">Remove</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child> <child>
<widget class="GtkHBox" id="hbox2951"> <widget class="GtkHBox" id="hbox2951">
<property name="visible">True</property> <property name="visible">True</property>
@ -10804,6 +10762,107 @@ send a chat message to</property>
<property name="fill">False</property> <property name="fill">False</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox16">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">10</property>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Tue, 19 Apr 2005 23:17:51 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="remove_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_remove_button_clicked" last_modification_time="Tue, 19 Apr 2005 23:17:59 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment62">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2954">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image501">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label245">
<property name="visible">True</property>
<property name="label" translatable="yes">_Remove</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>