confirmation before removing a contact
This commit is contained in:
parent
aad2444309
commit
dff0892be0
|
@ -1507,4 +1507,84 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
<widget class="GtkDialog" id="Confirm">
|
||||||
|
<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="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="response_id">-6</property>
|
||||||
|
<signal name="clicked" handler="gtk_widget_destroy" last_modification_time="Sat, 01 Nov 2003 21:36:49 GMT"/>
|
||||||
|
</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="response_id">-5</property>
|
||||||
|
<signal name="clicked" handler="on_okbutton_clicked" last_modification_time="Sat, 01 Nov 2003 21:49:19 GMT"/>
|
||||||
|
</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>
|
||||||
|
<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>
|
||||||
|
|
||||||
</glade-interface>
|
</glade-interface>
|
||||||
|
|
|
@ -248,12 +248,16 @@ class roster:
|
||||||
self.mk_menu_c(event, iter)
|
self.mk_menu_c(event, iter)
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
return gtk.FALSE
|
return gtk.FALSE
|
||||||
|
|
||||||
|
def destroy_window(self, widget, window):
|
||||||
|
window.destroy()
|
||||||
|
|
||||||
def on_req_usub(self, widget, iter):
|
def req_usub(self, widget, iter, window):
|
||||||
jid = self.treestore.get_value(iter, 2)
|
jid = self.treestore.get_value(iter, 2)
|
||||||
self.queueOUT.put(('UNSUB', jid))
|
self.queueOUT.put(('UNSUB', jid))
|
||||||
del self.l_contact[jid]
|
del self.l_contact[jid]
|
||||||
self.treestore.remove(iter)
|
self.treestore.remove(iter)
|
||||||
|
self.destroy_window(widget, window)
|
||||||
|
|
||||||
def req_sub(self, jid, txt):
|
def req_sub(self, jid, txt):
|
||||||
self.queueOUT.put(('SUB', (jid, txt)))
|
self.queueOUT.put(('SUB', (jid, txt)))
|
||||||
|
@ -264,6 +268,14 @@ class roster:
|
||||||
iterU = self.treestore.append(self.l_group['general'], (self.pixbufs['requested'], jid, jid))
|
iterU = self.treestore.append(self.l_group['general'], (self.pixbufs['requested'], jid, jid))
|
||||||
self.l_contact[jid] = {'user':user1, 'iter':[iterU]}
|
self.l_contact[jid] = {'user':user1, 'iter':[iterU]}
|
||||||
|
|
||||||
|
def on_req_usub(self, widget, iter):
|
||||||
|
jid = self.treestore.get_value(iter, 2)
|
||||||
|
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Confirm')
|
||||||
|
self.window = self.xml.get_widget('Confirm')
|
||||||
|
self.xml.get_widget('label_confirm').set_text('Are you sure you want to remove ' + jid + ' from your roster ?')
|
||||||
|
self.xml.signal_connect('gtk_widget_destroy', self.destroy_window, self.window)
|
||||||
|
self.xml.signal_connect('on_okbutton_clicked', self.req_usub, iter, self.window)
|
||||||
|
|
||||||
def on_status_changed(self, widget):
|
def on_status_changed(self, widget):
|
||||||
self.queueOUT.put(('STATUS',widget.name))
|
self.queueOUT.put(('STATUS',widget.name))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue