fix number of argument of _add_item() function in pubsub browser. fixes #2990

This commit is contained in:
Yann Leboulanger 2007-02-14 09:10:50 +00:00
parent d10182c7e8
commit ec80b7dc82
1 changed files with 5 additions and 12 deletions

View File

@ -1722,9 +1722,9 @@ class DiscussionGroupsBrowser(AgentBrowser):
def _create_treemodel(self): def _create_treemodel(self):
''' Create treemodel for the window. ''' ''' Create treemodel for the window. '''
# JID, node, name (with description) - pango markup, dont have info?, subscribed? # JID, node, name (with description) - pango markup, dont have info?, subscribed?
model = gtk.ListStore(str, str, str, bool, bool) self.model = gtk.ListStore(str, str, str, bool, bool)
model.set_sort_column_id(3, gtk.SORT_ASCENDING) self.model.set_sort_column_id(3, gtk.SORT_ASCENDING)
self.window.services_treeview.set_model(model) self.window.services_treeview.set_model(self.model)
# Name column # Name column
# Pango markup for name and description, description printed with # Pango markup for name and description, description printed with
@ -1746,7 +1746,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
self.window.services_treeview.set_headers_visible(True) self.window.services_treeview.set_headers_visible(True)
def _add_item(self, model, jid, node, item, force): def _add_item(self, jid, node, item, force):
''' Called when we got basic information about new node from query. ''' Called when we got basic information about new node from query.
Show the item. ''' Show the item. '''
name = item.get('name', '') name = item.get('name', '')
@ -1761,7 +1761,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
name = gobject.markup_escape_text(name) name = gobject.markup_escape_text(name)
name = '<b>%s</b>' % name name = '<b>%s</b>' % name
model.append((jid, node, name, dunno, subscribed)) self.model.append((jid, node, name, dunno, subscribed))
def _add_actions(self): def _add_actions(self):
self.post_button = gtk.Button(label=_('New post'), use_underline=True) self.post_button = gtk.Button(label=_('New post'), use_underline=True)
@ -1843,33 +1843,26 @@ class DiscussionGroupsBrowser(AgentBrowser):
def _subscriptionsCB(self, conn, request): def _subscriptionsCB(self, conn, request):
''' We got the subscribed groups list stanza. Now, if we already ''' We got the subscribed groups list stanza. Now, if we already
have items on the list, we should actualize them. ''' have items on the list, we should actualize them. '''
print 0
try: try:
subscriptions = request.getTag('pubsub').getTag('subscriptions') subscriptions = request.getTag('pubsub').getTag('subscriptions')
except: except:
return return
print 1
groups = set() groups = set()
for child in subscriptions.getTags('subscription'): for child in subscriptions.getTags('subscription'):
print 2, repr(child), str(child)
groups.add(child['node']) groups.add(child['node'])
print 3, groups
self.subscriptions = groups self.subscriptions = groups
# try to setup existing items in model # try to setup existing items in model
model = self.window.services_treeview.get_model() model = self.window.services_treeview.get_model()
print 4
for row in model: for row in model:
print 5
# 1 = group node # 1 = group node
# 3 = insensitive checkbox for subscribed # 3 = insensitive checkbox for subscribed
# 4 = subscribed? # 4 = subscribed?
groupnode = row[1] groupnode = row[1]
row[3]=False row[3]=False
row[4]=groupnode in groups row[4]=groupnode in groups
print 6
# we now know subscriptions, update button states # we now know subscriptions, update button states
self.update_actions() self.update_actions()