diff --git a/data/glade/manage_pep_services_window.glade b/data/glade/manage_pep_services_window.glade
index 500c0b462..8d9fd5bfd 100644
--- a/data/glade/manage_pep_services_window.glade
+++ b/data/glade/manage_pep_services_window.glade
@@ -30,6 +30,18 @@
True
6
GTK_BUTTONBOX_END
+
+
+ True
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ gtk-delete
+ True
+ 0
+
+
+
True
@@ -63,6 +75,9 @@
+
+ 1
+
@@ -75,7 +90,7 @@
- 1
+ 3
diff --git a/src/common/pubsub.py b/src/common/pubsub.py
index f7e3a6970..48b8a64b4 100644
--- a/src/common/pubsub.py
+++ b/src/common/pubsub.py
@@ -50,7 +50,15 @@ class ConnectionPubSub:
d = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
d = d.addChild('delete', {'node': node})
- self.connection.send(query)
+ def response(con, resp, jid, node):
+ if resp.getType() == 'result':
+ self.dispatch('PUBSUB_NODE_REMOVED', (jid, node))
+ else:
+ msg = resp.getErrorMsg()
+ self.dispatch('PUBSUB_NODE_NOT_REMOVED', (jid, node, msg))
+
+ self.connection.SendAndCallForResponse(query, response, {'jid': jid,
+ 'node': node})
def send_pb_create(self, jid, node, configure = False, configure_form = None):
'''Creates new node.'''
diff --git a/src/config.py b/src/config.py
index b63559fc5..842fba7e9 100644
--- a/src/config.py
+++ b/src/config.py
@@ -3674,6 +3674,7 @@ class ManagePEPServicesWindow:
self.window = self.xml.get_widget('manage_pep_services_window')
self.window.set_transient_for(gajim.interface.roster.window)
self.xml.get_widget('configure_button').set_sensitive(False)
+ self.xml.get_widget('delete_button').set_sensitive(False)
self.xml.signal_autoconnect(self)
self.account = account
@@ -3691,6 +3692,7 @@ class ManagePEPServicesWindow:
def on_services_selection_changed(self, sel):
self.xml.get_widget('configure_button').set_sensitive(True)
+ self.xml.get_widget('delete_button').set_sensitive(True)
def init_services(self):
self.treeview = self.xml.get_widget('services_treeview')
@@ -3714,6 +3716,24 @@ class ManagePEPServicesWindow:
if 'jid' in item and item['jid'] == our_jid and 'node' in item:
self.treestore.append([item['node']])
+ def node_removed(self, node):
+ model = self.treeview.get_model()
+ iter = model.get_iter_root()
+ while iter:
+ if model[iter][0] == node:
+ model.remove(iter)
+ break
+ iter = model.get_iter_next(iter)
+
+ def on_delete_button_clicked(self, widget):
+ selection = self.treeview.get_selection()
+ if not selection:
+ return
+ model, iter = selection.get_selected()
+ node = model[iter][0]
+ our_jid = gajim.get_jid_from_account(self.account)
+ gajim.connections[self.account].send_pb_delete(our_jid, node)
+
def on_configure_button_clicked(self, widget):
selection = self.treeview.get_selection()
if not selection:
diff --git a/src/gajim.py b/src/gajim.py
index cacc6ef72..4e7203b7c 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -2196,7 +2196,7 @@ class Interface:
is_modal = False, ok_handler = on_ok)
def handle_event_pep_config(self, account, data):
- # ('PEP_ACCESS_MODEL', account, (node, form))
+ # ('PEP_CONFIG', account, (node, form))
if self.instances[account].has_key('pep_services'):
self.instances[account]['pep_services'].config(data[0], data[1])
@@ -2293,6 +2293,18 @@ class Interface:
dialog = dialogs.YesNoDialog(pritext, sectext, checktext,
on_response_yes=on_yes, on_response_no=on_no)
+ def handle_event_pubsub_node_removed(self, account, data):
+ # ('PUBSUB_NODE_REMOVED', account, (jid, node))
+ if self.instances[account].has_key('pep_services'):
+ if data[0] == gajim.get_jid_from_account(account):
+ self.instances[account]['pep_services'].node_removed(data[1])
+
+ def handle_event_pubsub_node_not_removed(self, account, data):
+ # ('PUBSUB_NODE_NOT_REMOVED', account, (jid, node, msg))
+ if data[0] == gajim.get_jid_from_account(account):
+ dialogs.WarningDialog(_('PEP node was not removed'),
+ _('PEP node %s was not removed: %s') % (data[1], data[2]))
+
def read_sleepy(self):
'''Check idle status and change that status if needed'''
if not self.sleeper.poll():
@@ -2648,6 +2660,8 @@ class Interface:
'SSL_ERROR': self.handle_event_ssl_error,
'FINGERPRINT_ERROR': self.handle_event_fingerprint_error,
'PLAIN_CONNECTION': self.handle_event_plain_connection,
+ 'PUBSUB_NODE_REMOVED': self.handle_event_pubsub_node_removed,
+ 'PUBSUB_NODE_NOT_REMOVED': self.handle_event_pubsub_node_not_removed,
}
gajim.handlers = self.handlers