new confirm window, more generic
This commit is contained in:
parent
4231e0f09f
commit
d1eebe9057
|
@ -1822,7 +1822,6 @@ on the server.</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="response_id">-6</property>
|
<property name="response_id">-6</property>
|
||||||
<signal name="clicked" handler="on_cancel_clicked" last_modification_time="Wed, 17 Mar 2004 21:04:05 GMT"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
@ -1835,7 +1834,6 @@ on the server.</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="response_id">-5</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>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -785,30 +785,16 @@ class accounts_Window:
|
||||||
self.init_accounts()
|
self.init_accounts()
|
||||||
|
|
||||||
class confirm_Window:
|
class confirm_Window:
|
||||||
"""Class for confirmation window :
|
"""Class for confirmation window"""
|
||||||
window that appears to confirm the removal of a contact"""
|
def wait(self):
|
||||||
def on_cancel(self, widget):
|
out = self.win.run()
|
||||||
"""When Cancel button is clicked"""
|
self.win.destroy()
|
||||||
widget.get_toplevel().destroy()
|
return out
|
||||||
|
|
||||||
def req_usub(self, widget):
|
def __init__(self, label):
|
||||||
"""When Ok button is clicked :
|
|
||||||
Send a message to the core to remove the user
|
|
||||||
and remove it from the roster"""
|
|
||||||
self.plugin.send('UNSUB', self.account, self.user.jid)
|
|
||||||
self.plugin.roster.remove_user(self.user, self.account)
|
|
||||||
del self.plugin.roster.contacts[self.account][self.user.jid]
|
|
||||||
widget.get_toplevel().destroy()
|
|
||||||
|
|
||||||
def __init__(self, plugin, user, account):
|
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'Confirm')
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'Confirm')
|
||||||
self.plugin = plugin
|
xml.get_widget('label_confirm').set_text(label)
|
||||||
self.user = user
|
self.win = xml.get_widget('Confirm')
|
||||||
self.account = account
|
|
||||||
xml.get_widget('label_confirm').set_text(\
|
|
||||||
'Are you sure you want to remove ' + user.name + ' (' + user.jid + ') from your roster ?')
|
|
||||||
xml.signal_connect('on_okbutton_clicked', self.req_usub)
|
|
||||||
xml.signal_connect('on_cancel_clicked', self.on_cancel)
|
|
||||||
|
|
||||||
class authorize_Window:
|
class authorize_Window:
|
||||||
"""Class for authorization window :
|
"""Class for authorization window :
|
||||||
|
@ -1594,7 +1580,12 @@ class roster_Window:
|
||||||
|
|
||||||
def on_req_usub(self, widget, user, account):
|
def on_req_usub(self, widget, user, account):
|
||||||
"""Remove a user"""
|
"""Remove a user"""
|
||||||
confirm_Window(self.plugin, user, account)
|
window = confirm_Window('Are you sure you want to remove ' + user.name + \
|
||||||
|
' (' + user.jid + ') from your roster ?')
|
||||||
|
if window.wait() == gtk.RESPONSE_OK:
|
||||||
|
self.plugin.send('UNSUB', account, user.jid)
|
||||||
|
self.remove_user(user, account)
|
||||||
|
del self.contacts[account][user.jid]
|
||||||
|
|
||||||
def change_status(self, widget, account, status):
|
def change_status(self, widget, account, status):
|
||||||
if status != 'online' and status != 'offline':
|
if status != 'online' and status != 'offline':
|
||||||
|
@ -2052,11 +2043,11 @@ class plugin:
|
||||||
authorize_Window(self, ev[2][0], ev[2][1], ev[1])
|
authorize_Window(self, ev[2][0], ev[2][1], ev[1])
|
||||||
#('SUBSCRIBED', account, (jid, nom, resource))
|
#('SUBSCRIBED', account, (jid, nom, resource))
|
||||||
elif ev[0] == 'SUBSCRIBED':
|
elif ev[0] == 'SUBSCRIBED':
|
||||||
if self.roster.l_contact.has_key(ev[2][0]):
|
if self.roster.contacts[ev[1]].has_key(ev[2][0]):
|
||||||
u = self.roster.l_contact[ev[2][0]]['user']
|
u = self.roster.contacts[ev[1]][ev[2][0]]['user']
|
||||||
u.name = ev[2][1]
|
u.name = ev[2][1]
|
||||||
u.resource = ev[2][2]
|
u.resource = ev[2][2]
|
||||||
for i in self.roster.l_contact[u.jid]['iter']:
|
for i in self.roster.contacts[ev[1]][u.jid]['iter']:
|
||||||
model.set_value(i, 1, u.name)
|
model.set_value(i, 1, u.name)
|
||||||
else:
|
else:
|
||||||
user1 = user(ev[2][0], ev[2][0], ['general'], 'online', \
|
user1 = user(ev[2][0], ev[2][0], ['general'], 'online', \
|
||||||
|
@ -2064,7 +2055,7 @@ class plugin:
|
||||||
self.roster.add_user(user1)
|
self.roster.add_user(user1)
|
||||||
warning_Window("You are now authorized by " + ev[2][0])
|
warning_Window("You are now authorized by " + ev[2][0])
|
||||||
elif ev[0] == 'UNSUBSCRIBED':
|
elif ev[0] == 'UNSUBSCRIBED':
|
||||||
warning_Window("You are now unsubscribed by " + jid)
|
warning_Window("You are now unsubscribed by " + ev[2])
|
||||||
#TODO: change icon
|
#TODO: change icon
|
||||||
#('AGENTS', account, agents)
|
#('AGENTS', account, agents)
|
||||||
elif ev[0] == 'AGENTS':
|
elif ev[0] == 'AGENTS':
|
||||||
|
|
Loading…
Reference in New Issue