diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py index 972b66799..1b7a81091 100644 --- a/plugins/gtkgui/config.py +++ b/plugins/gtkgui/config.py @@ -99,11 +99,11 @@ class vCard_Window: if self.plugin.connected[self.account]: self.plugin.send('ASK_VCARD', self.account, self.jid) else: - warning_Window(_("You must be connected to get your informations")) + warning_dialog(_("You must be connected to get your informations")) def on_publish(self, widget): if not self.plugin.connected[self.account]: - warning_Window(_("You must be connected to publish your informations")) + warning_dialog(_("You must be connected to publish your informations")) return vcard = self.make_vcard() nick = '' @@ -914,31 +914,31 @@ class accountpreferences_window: proxyhost = self.xml.get_widget('proxyhost_entry').get_text() proxyport = self.xml.get_widget('proxyport_entry').get_text() if (name == ''): - warning_Window(_('You must enter a name for this account')) + warning_dialog(_('You must enter a name for this account')) return 0 if name.find(' ') != -1: - warning_Window(_('Spaces are not permited in account name')) + warning_dialog(_('Spaces are not permited in account name')) return 0 if (jid == '') or (string.count(jid, '@') != 1): - warning_Window(_('You must enter a Jabber ID for this account\nFor example : login@hostname')) + warning_dialog(_('You must enter a Jabber ID for this account\nFor example : login@hostname')) return 0 if new_account_checkbutton.get_active() and password == '': - warning_Window(_('You must enter a password to register a new account')) + warning_dialog(_('You must enter a password to register a new account')) return 0 if use_proxy: if proxyport != '': try: proxyport = string.atoi(proxyport) except ValueError: - warning_Window(_('Proxy Port must be a port number')) + warning_dialog(_('Proxy Port must be a port number')) return 0 if proxyhost == '': - warning_Window(_('You must enter a proxy host to use proxy')) + warning_dialog(_('You must enter a proxy host to use proxy')) if priority != '': try: priority = string.atoi(priority) except ValueError: - warning_Window(_('Priority must be a number')) + warning_dialog(_('Priority must be a number')) return 0 (login, hostname) = string.split(jid, '@') key_name = self.xml.get_widget('gpg_name_label').get_text() @@ -996,7 +996,7 @@ class accountpreferences_window: return #if it's a new account if name in self.plugin.accounts.keys(): - warning_Window(_('An account already has this name')) + warning_dialog(_('An account already has this name')) return #if we neeed to register a new account if new_account_checkbutton.get_active(): @@ -1053,7 +1053,7 @@ class accountpreferences_window: vCard_Window(jid, self.plugin, self.account) self.plugin.send('ASK_VCARD', self.account, jid) else: - warning_Window(_('You must be connected to get your informations')) + warning_dialog(_('You must be connected to get your informations')) def on_gpg_choose_button_clicked(self, widget, data=None): w = choose_gpg_Window() @@ -1167,8 +1167,8 @@ class accounts_window: sel = self.accounts_treeview.get_selection() (model, iter) = sel.get_selected() account = model.get_value(iter, 0) - window = confirm_window(_("Are you sure you want to remove this account (%s) ?") % account) - if window.wait() == gtk.RESPONSE_YES: + dialog = confirm_dialog(_("Are you sure you want to remove this account (%s) ?") % account) + if dialog.get_response() == gtk.RESPONSE_YES: if self.plugin.connected[account]: self.plugin.send('STATUS', account, ('offline', 'offline')) del self.plugin.accounts[account] @@ -1388,7 +1388,7 @@ class agent_browser_window: def __init__(self, plugin, account): if not plugin.connected[account]: - warning_Window(_("You must be connected to view Agents")) + warning_dialog(_("You must be connected to view Agents")) return xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP) self.window = xml.get_widget('agent_browser_window') @@ -1439,7 +1439,7 @@ class join_gc: def __init__(self, plugin, account, server='', room = ''): if not plugin.connected[account]: - warning_Window(_("You must be connected to join a group chat on this serveur")) + warning_dialog(_("You must be connected to join a group chat on this serveur")) return self.plugin = plugin self.account = account diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py index be908c6fa..1049385a3 100644 --- a/plugins/gtkgui/dialogs.py +++ b/plugins/gtkgui/dialogs.py @@ -272,7 +272,7 @@ class addContact_Window: if not jid: return if jid.find('@') < 0: - warning_Window(_("The contact's name must be something like login@hostname")) + warning_dialog(_("The contact's name must be something like login@hostname")) return message_buffer = self.xml.get_widget('message_textview').get_buffer() start_iter = message_buffer.get_start_iter() @@ -329,7 +329,7 @@ class addContact_Window: def __init__(self, plugin, account, jid=None): if not plugin.connected[account]: - warning_Window(_('You must be connected to add a contact')) + warning_dialog(_('You must be connected to add a contact')) return self.plugin = plugin self.account = account @@ -369,17 +369,6 @@ class addContact_Window: agent_combobox.set_active(jid_agents.index(jid_splited[1])+1) self.xml.signal_autoconnect(self) -class warning_Window: - """Class for warning window : print a warning message""" - def on_close(self, widget): - """When Close button is clicked""" - widget.get_toplevel().destroy() - - def __init__(self, txt): - xml = gtk.glade.XML(GTKGUI_GLADE, 'Warning', APP) - xml.get_widget('label').set_text(txt) - xml.signal_connect('on_close_clicked', self.on_close) - class about_Window: #FIXME: (nk) pygtk2.6 has a built-in window for that """Class for about window""" def delete_event(self, widget): @@ -398,18 +387,28 @@ class about_Window: #FIXME: (nk) pygtk2.6 has a built-in window for that xml.signal_connect('on_close_clicked', self.on_close) -class confirm_window: - """Class for confirmation window""" - def wait(self): - response = self.window.run() - self.window.destroy() +class confirm_dialog: + """Class for confirmation dialog""" + def get_response(self): + response = self.dialog.run() + self.dialog.destroy() return response def __init__(self, label): - self.window = gtk.MessageDialog(None,\ + self.dialog = gtk.MessageDialog(None,\ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\ gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, label) +class warning_dialog: + """Class for warning dialog""" + def __init__(self, label): + self.dialog = gtk.MessageDialog(None,\ + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\ + gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, label) + + response = self.dialog.run() + self.dialog.destroy() + class subscription_request_Window: """Class for authorization window : window that appears when a user wants to add us to his/her roster""" diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 8f29dafec..93ac5762b 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -3305,110 +3305,6 @@ on the server as a vCard - - 5 - True - Warning - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_EDGE - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - - 3 - False - True - GTK_PACK_END - - - - - - 5 - True - False - 0 - - - - True - gtk-dialog-warning - 6 - 1 - 0.5 - 0 - 0 - - - 6 - False - True - - - - - - True - Message - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 5 - True - True - - - - - 0 - True - True - - - - - - 5 True diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index c37b23058..90fc2d77e 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -1890,7 +1890,7 @@ class roster_Window: return accounts = self.plugin.accounts.keys() if len(accounts) == 0: - warning_Window(_("You must setup an account before connecting to jabber network.")) + warning_dialog(_("You must setup an account before connecting to jabber network.")) self.set_cb() return status = model[active][0] @@ -2699,7 +2699,7 @@ class plugin: self.roster.draw_roster() def handle_event_warning(self, unused, msg): - warning_Window(msg) + warning_dialog(msg) def handle_event_status(self, account, status): #('STATUS', account, status) @@ -2820,10 +2820,10 @@ class plugin: 'online', 'to', '', array[1], 0, '') self.roster.contacts[account][jid] = [user1] self.roster.add_user_to_roster(jid, account) - warning_Window(_("You are now authorized by %s") % jid) + warning_dialog(_("You are now authorized by %s") % jid) def handle_event_unsubscribed(self, account, jid): - warning_Window(_("You are now unsubscribed by %s") % jid) + warning_dialog(_("You are now unsubscribed by %s") % jid) def handle_event_agents(self, account, agents): #('AGENTS', account, agents) @@ -2839,7 +2839,7 @@ class plugin: def handle_event_reg_agent_info(self, account, array): #('REG_AGENTS_INFO', account, (agent, infos)) if not array[1].has_key('instructions'): - warning_Window(_("error contacting %s") % array[0]) + warning_dialog(_("error contacting %s") % array[0]) else: agentRegistration_Window(array[0], array[1], self, account) @@ -2920,7 +2920,7 @@ class plugin: self.systray.add_jid(jid, account) def handle_event_bad_passphrase(self, account, array): - warning_Window(_("Your GPG passphrase is wrong, so you are connected without your GPG key.")) + warning_dialog(_("Your GPG passphrase is wrong, so you are connected without your GPG key.")) def handle_event_gpg_secrete_keys(self, account, keys): keys['None'] = 'None'