confirm window is now build without glade

This commit is contained in:
Yann Leboulanger 2005-03-01 18:36:13 +00:00
parent 5a1d5231dd
commit d007712e20
4 changed files with 13 additions and 99 deletions

View File

@ -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_OK:
window = confirm_window(_("Are you sure you want to remove this account (%s) ?") % account)
if window.wait() == gtk.RESPONSE_YES:
if self.plugin.connected[account]:
self.plugin.send('STATUS', account, ('offline', 'offline'))
del self.plugin.accounts[account]

View File

@ -398,17 +398,17 @@ 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 confirm_window:
"""Class for confirmation window"""
def wait(self):
out = self.win.run()
self.win.destroy()
return out
response = self.window.run()
self.window.destroy()
return response
def __init__(self, label):
xml = gtk.glade.XML(GTKGUI_GLADE, 'Confirm', APP)
xml.get_widget('label_confirm').set_text(label)
self.win = xml.get_widget('Confirm')
self.window = gtk.MessageDialog(None,\
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\
gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, label)
class subscription_request_Window:
"""Class for authorization window :

View File

@ -2548,92 +2548,6 @@ on the server as a vCard</property>
</child>
</widget>
<widget class="GtkDialog" id="Confirm">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Sure ?</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton">
<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="okbutton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</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">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label_confirm">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</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="mnemonic_widget">okbutton</property>
</widget>
<packing>
<property name="padding">10</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="subscription_request_window">
<property name="border_width">5</property>
<property name="visible">True</property>

View File

@ -1579,8 +1579,8 @@ class roster_Window:
def on_remove_agent(self, widget, jid, account):
"""When an agent is requested to log in or off"""
window = confirm_Window(_("Are you sure you want to remove the agent %s from your roster ?") % jid)
if window.wait() == gtk.RESPONSE_OK:
window = confirm_window(_("Are you sure you want to remove the agent %s from your roster ?") % jid)
if window.wait() == gtk.RESPONSE_YES:
self.plugin.send('UNSUB_AGENT', account, jid)
for u in self.contacts[account][jid]:
self.remove_user(u, account)
@ -1804,8 +1804,8 @@ class roster_Window:
def on_req_usub(self, widget, user, account):
"""Remove a user"""
window = confirm_Window(_("Are you sure you want to remove %s (%s) from your roster ?") % (user.name, user.jid))
if window.wait() == gtk.RESPONSE_OK:
window = confirm_window(_("Are you sure you want to remove %s (%s) from your roster ?") % (user.name, user.jid))
if window.wait() == gtk.RESPONSE_YES:
self.plugin.send('UNSUB', account, user.jid)
for u in self.contacts[account][user.jid]:
self.remove_user(u, account)