change callback, widget and variable names for agent browser window in glade and in the code

This commit is contained in:
Yann Leboulanger 2005-03-01 14:59:46 +00:00
parent c2a70df954
commit 7a2cb8052c
3 changed files with 35 additions and 44 deletions

View File

@ -1286,18 +1286,14 @@ class agentRegistration_Window:
self.xml.signal_connect('on_button_ok_clicked', self.on_ok)
class browseAgent_Window:
class agent_browser_window:
"""Class for bowser agent window :
to know the agents on the selected server"""
def delete_event(self, widget):
def on_agent_browser_window_destroy(self, widget):
"""close window"""
del self.plugin.windows[self.account]['browser']
def on_cancel(self, widget):
"""When Cancel button is clicked"""
widget.get_toplevel().destroy()
def on_close(self, widget):
def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
widget.get_toplevel().destroy()
@ -1308,14 +1304,14 @@ class browseAgent_Window:
def agents(self, agents):
"""When list of available agent arrive :
Fill the treeview with it"""
model = self.treeview.get_model()
model = self.agents_treeview.get_model()
for agent in agents:
iter = model.append(None, (agent['name'], agent['jid']))
self.agent_infos[agent['jid']] = {'features' : []}
def agent_info(self, agent, identities, features, items):
"""When we recieve informations about an agent"""
model = self.treeview.get_model()
model = self.agents_treeview.get_model()
iter = model.get_iter_root()
expand = 0
while (iter):
@ -1340,23 +1336,24 @@ class browseAgent_Window:
model.append(iter, (item['name'], item['jid']))
self.agent_infos[item['jid']] = {'identities': [item]}
if expand:
self.treeview.expand_row((model.get_path(iter)), False)
self.agents_treeview.expand_row((model.get_path(iter)), False)
def on_refresh(self, widget):
def on_refresh_button_clicked(self, widget):
"""When refresh button is clicked :
refresh list : clear and rerequest it"""
self.treeview.get_model().clear()
self.agents_treeview.get_model().clear()
self.browse()
def on_row_activated(self, widget, path, col=0):
def on_agents_treeview_row_activated(self, widget, path, col=0):
"""When a row is activated :
Register or join the selected agent"""
#TODO
pass
def on_join_button_clicked(self, widget):
"""When we want to join a conference :
Ask specific informations about the selected agent and close the window"""
model, iter = self.treeview.get_selection().get_selected()
model, iter = self.agents_treeview.get_selection().get_selected()
if not iter:
return
service = model.get_value(iter, 1)
@ -1371,17 +1368,17 @@ class browseAgent_Window:
def on_register_button_clicked(self, widget):
"""When we want to register an agent :
Ask specific informations about the selected agent and close the window"""
model, iter = self.treeview.get_selection().get_selected()
model, iter = self.agents_treeview.get_selection().get_selected()
if not iter :
return
service = model.get_value(iter, 1)
self.plugin.send('REG_AGENT_INFO', self.account, service)
widget.get_toplevel().destroy()
def on_cursor_changed(self, widget):
def on_agents_treeview_cursor_changed(self, widget):
"""When we select a row :
activate buttons if needed"""
model, iter = self.treeview.get_selection().get_selected()
model, iter = self.agents_treeview.get_selection().get_selected()
jid = model.get_value(iter, 1)
self.register_button.set_sensitive(False)
if self.agent_infos[jid].has_key('features'):
@ -1398,35 +1395,29 @@ class browseAgent_Window:
if not plugin.connected[account]:
warning_Window(_("You must be connected to view Agents"))
return
xml = gtk.glade.XML(GTKGUI_GLADE, 'browser', APP)
self.window = xml.get_widget('browser')
self.treeview = xml.get_widget('treeview')
xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP)
self.window = xml.get_widget('agent_browser_window')
self.agents_treeview = xml.get_widget('agents_treeview')
self.plugin = plugin
self.account = account
self.agent_infos = {}
model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.treeview.set_model(model)
self.agents_treeview.set_model(model)
#columns
renderer = gtk.CellRendererText()
renderer.set_data('column', 0)
self.treeview.insert_column_with_attributes(-1, 'Name', renderer, text=0)
self.agents_treeview.insert_column_with_attributes(-1, 'Name', \
renderer, text=0)
renderer = gtk.CellRendererText()
renderer.set_data('column', 1)
self.treeview.insert_column_with_attributes(-1, 'Service', \
self.agents_treeview.insert_column_with_attributes(-1, 'Service', \
renderer, text=1)
self.register_button = xml.get_widget('register_button')
self.register_button.set_sensitive(False)
self.join_button = xml.get_widget('join_button')
self.join_button.set_sensitive(False)
xml.signal_connect('gtk_widget_destroy', self.delete_event)
xml.signal_connect('on_refresh_clicked', self.on_refresh)
xml.signal_connect('on_row_activated', self.on_row_activated)
xml.signal_connect('on_join_button_clicked', self.on_join_button_clicked)
xml.signal_connect('on_register_button_clicked', self.on_register_button_clicked)
xml.signal_connect('on_cursor_changed', self.on_cursor_changed)
xml.signal_connect('on_close_clicked', self.on_close)
xml.signal_autoconnect(self)
self.browse()
class join_gc:

View File

@ -2742,7 +2742,7 @@ on the server as a vCard</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button_close_clicked" last_modification_time="Mon, 03 Nov 2003 19:01:49 GMT"/>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Tue, 01 Mar 2005 13:56:50 GMT"/>
</widget>
</child>
@ -2753,7 +2753,7 @@ on the server as a vCard</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button_deny_clicked" last_modification_time="Mon, 03 Nov 2003 19:01:54 GMT"/>
<signal name="clicked" handler="on_deny_button_clicked" last_modification_time="Tue, 01 Mar 2005 13:57:29 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment12">
@ -2824,7 +2824,7 @@ on the server as a vCard</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button_auth_clicked" last_modification_time="Mon, 03 Nov 2003 19:02:02 GMT"/>
<signal name="clicked" handler="on_authorize_button_clicked" last_modification_time="Tue, 01 Mar 2005 13:57:14 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment13">
@ -2898,7 +2898,7 @@ on the server as a vCard</property>
</child>
</widget>
<widget class="GtkWindow" id="browser">
<widget class="GtkWindow" id="agent_browser_window">
<property name="visible">True</property>
<property name="title" translatable="yes">Agents browser</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
@ -2913,7 +2913,7 @@ on the server as a vCard</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Fri, 14 Nov 2003 11:08:36 GMT"/>
<signal name="destroy" handler="on_agent_browser_window_destroy" last_modification_time="Tue, 01 Mar 2005 14:19:07 GMT"/>
<child>
<widget class="GtkVBox" id="vbox11">
@ -2972,15 +2972,15 @@ on the server as a vCard</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="treeview">
<widget class="GtkTreeView" id="agents_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<signal name="row_activated" handler="on_row_activated" last_modification_time="Thu, 13 Nov 2003 18:19:02 GMT"/>
<signal name="cursor_changed" handler="on_cursor_changed" last_modification_time="Wed, 01 Sep 2004 21:00:56 GMT"/>
<signal name="row_activated" handler="on_agents_treeview_row_activated" last_modification_time="Tue, 01 Mar 2005 14:20:15 GMT"/>
<signal name="cursor_changed" handler="on_agents_treeview_cursor_changed" last_modification_time="Tue, 01 Mar 2005 14:20:21 GMT"/>
</widget>
</child>
</widget>
@ -3009,13 +3009,13 @@ on the server as a vCard</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="refresh">
<widget class="GtkButton" id="refresh_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_refresh_clicked" last_modification_time="Wed, 12 Nov 2003 18:20:25 GMT"/>
<signal name="clicked" handler="on_refresh_button_clicked" last_modification_time="Tue, 01 Mar 2005 14:17:42 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment16">
@ -3080,13 +3080,13 @@ on the server as a vCard</property>
</child>
<child>
<widget class="GtkButton" id="button12">
<widget class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_clicked" last_modification_time="Thu, 18 Mar 2004 14:42:04 GMT"/>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Tue, 01 Mar 2005 14:17:35 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment15">

View File

@ -2166,7 +2166,7 @@ class roster_Window:
Call browse class"""
if not self.plugin.windows[account].has_key('browser'):
self.plugin.windows[account]['browser'] = \
browseAgent_Window(self.plugin, account)
agent_browser_window(self.plugin, account)
def image_is_ok(self, image):
if not os.path.exists(image):