From 11c34f9e24f81f9787c2455a1965f4bbe479304b Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 27 Mar 2005 23:00:01 +0000 Subject: [PATCH] do not show agents if they are not childs of another agent. It fixs that bug: you ask agents from an account1 and quickly ask agents from another account2, then answer from account1 arrive. They must not be displayed, it's too late. --- plugins/gtkgui/config.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py index e927be12a..e44795e24 100644 --- a/plugins/gtkgui/config.py +++ b/plugins/gtkgui/config.py @@ -1494,6 +1494,11 @@ class Service_discovery_window: def browse(self, jid): """Send a request to the core to know the available agents""" + model = self.agents_treeview.get_model() + if not model.get_iter_first(): + # we begin to fill the treevier with the first line + iter = model.append(None, (jid, jid)) + self.agent_infos[jid] = {'features' : []} self.plugin.send('REQ_AGENTS', self.account, jid) def agents(self, agents): @@ -1571,7 +1576,6 @@ class Service_discovery_window: """When we recieve informations about an agent""" model = self.agents_treeview.get_model() iter = model.get_iter_root() - expand = False # We look if this agent is in the treeview while (iter): if agent == model.get_value(iter, 1): @@ -1583,10 +1587,8 @@ class Service_discovery_window: iter = model.iter_parent(iter) if iter: iter = model.iter_next(iter) - if not iter: #If it is not we add it - iter = model.append(None, (agent, agent)) - self.agent_infos[agent] = {'features' : []} - expand = True + if not iter: #If it is not we stop + return self.agent_infos[agent]['features'] = features if len(identities): self.agent_infos[agent]['identities'] = identities @@ -1604,10 +1606,8 @@ class Service_discovery_window: if not iter_child: # If it is not we add it iter_child = model.append(iter, (item['name'], item['jid'])) self.agent_infos[item['jid']] = {'identities': [item]} - if self.iter_is_visible(iter_child) or expand: + if self.iter_is_visible(iter_child): self.browse(item['jid']) - if expand: - self.agents_treeview.expand_row((model.get_path(iter)), False) def on_refresh_button_clicked(self, widget): """When refresh button is clicked :