transport's list is available

This commit is contained in:
Yann Leboulanger 2003-11-12 21:51:38 +00:00
parent d84e0444c9
commit 5afec1f54b
3 changed files with 285 additions and 6 deletions

View File

@ -163,6 +163,9 @@ class GajimCore:
#('UPDUSER', (jid, name, groups))
elif ev[0] == 'UPDUSER':
self.con.updateRosterItem(jid=ev[1][0], name=ev[1][1], groups=ev[1][2])
elif ev[0] == 'REQ_AGENTS':
agents = self.con.requestAgents()
self.hub.sendPlugin('AGENTS', agents)
else:
log.debug("Unknown Command")
elif self.connected == 1:
@ -179,5 +182,6 @@ def start():
gc.hub.register('gtkgui', 'MSG')
gc.hub.register('gtkgui', 'SUBSCRIBED')
gc.hub.register('gtkgui', 'SUBSCRIBE')
gc.hub.register('gtkgui', 'AGENTS')
guiPl.load ()
gc.mainLoop()

View File

@ -40,7 +40,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image72">
<widget class="GtkImage" id="image97">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -62,7 +62,7 @@
<signal name="activate" handler="on_preferences_activate" last_modification_time="Wed, 22 Oct 2003 21:18:29 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image73">
<widget class="GtkImage" id="image98">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -83,7 +83,7 @@
<signal name="activate" handler="on_accounts_activate" last_modification_time="Wed, 22 Oct 2003 21:18:21 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image74">
<widget class="GtkImage" id="image99">
<property name="visible">True</property>
<property name="stock">gtk-select-color</property>
<property name="icon_size">1</property>
@ -96,6 +96,27 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="browse_agents">
<property name="visible">True</property>
<property name="label" translatable="yes">_Browse agents</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_browse_agents_activate" last_modification_time="Wed, 12 Nov 2003 10:50:33 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image100">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
@ -110,7 +131,7 @@
<signal name="activate" handler="on_add_activate" last_modification_time="Sun, 26 Oct 2003 17:26:34 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image75">
<widget class="GtkImage" id="image101">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -137,7 +158,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Fri, 03 Oct 2003 12:49:50 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image76">
<widget class="GtkImage" id="image102">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -159,7 +180,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image77">
<widget class="GtkImage" id="image103">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -1886,4 +1907,208 @@ David Ferlier (david@yazzy.org)</property>
</child>
</widget>
<widget class="GtkWindow" id="browser">
<property name="visible">True</property>
<property name="title" translatable="yes">Agents browser</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">400</property>
<property name="default_height">250</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<child>
<widget class="GtkVBox" id="vbox11">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow9">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="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>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator6">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox4">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="refresh">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_refresh_clicked" last_modification_time="Wed, 12 Nov 2003 18:20:25 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment16">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox20">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image105">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label29">
<property name="visible">True</property>
<property name="label" translatable="yes">_Refresh</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="button12">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="gtk_widget_destroy" last_modification_time="Wed, 12 Nov 2003 12:22:42 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment15">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox19">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image104">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label28">
<property name="visible">True</property>
<property name="label" translatable="yes">_Close</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">2</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -27,6 +27,7 @@ import gobject
import string
import common.optparser
CONFPATH = "~/.gajimrc"
Wbrowser = 0
class user:
def __init__(self, *args):
@ -135,6 +136,44 @@ class authorize:
self.xml.signal_connect('on_button_deny_clicked', self.deny)
self.xml.signal_connect('on_button_close_clicked', self.delete_event)
class browser:
def delete_event(self, widget):
global Wbrowser
Wbrowser = 0
self.window.destroy()
def browse(self):
self.r.queueOUT.put(('REQ_AGENTS', None))
def agents(self, agents):
for jid in agents.keys():
iter = self.model.append()
self.model.set(iter, 0, agents[jid]['name'], 1, jid)
def on_refresh(self, widget):
self.model.clear()
self.browse()
def __init__(self, roster):
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'browser')
self.window = self.xml.get_widget('browser')
self.treeview = self.xml.get_widget('treeview')
self.r = roster
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.treeview.set_model(self.model)
#columns
renderer = gtk.CellRendererText()
renderer.set_data('column', 0)
self.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, 'JID', renderer, text=1)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
self.xml.signal_connect('on_refresh_clicked', self.on_refresh)
#TODO: Si connecté
self.browse()
class message:
def delete_event(self, widget):
del self.roster.tab_messages[self.user.jid]
@ -204,6 +243,7 @@ class roster:
self.l_contact = {}
""" l_group = {name:iter} """
self.l_group = {}
self.treestore.clear()
for jid in tab.keys():
name = tab[jid]['name']
if not name:
@ -378,6 +418,11 @@ class roster:
self.l_contact[jid]['user'].name = new_text
self.queueOUT.put(('UPDUSER', (jid, new_text, self.l_contact[jid]['user'].groups)))
def on_browse(self, widget):
global Wbrowser
if not Wbrowser:
Wbrowser = browser(self)
def __init__(self, queueOUT):
#initialisation des variables
# FIXME : handle no file ...
@ -424,6 +469,7 @@ class roster:
#signals
self.xml.signal_connect('gtk_main_quit', self.on_quit)
self.xml.signal_connect('on_accounts_activate', self.on_accounts)
self.xml.signal_connect('on_browse_agents_activate', self.on_browse)
self.xml.signal_connect('on_add_activate', self.on_add)
self.xml.signal_connect('on_about_activate', self.on_about)
self.xml.signal_connect('on_quit_activate', self.on_quit)
@ -434,6 +480,7 @@ class roster:
class plugin:
def read_queue(self):
global Wbrowser
while self.queueIN.empty() == 0:
ev = self.queueIN.get()
# print ev
@ -454,6 +501,9 @@ class plugin:
u.name = ev[1]['nom']
for i in self.r.l_contact[u.jid]['iter']:
self.r.treestore.set_value(i, 1, u.name)
elif ev[0] == 'AGENTS':
if Wbrowser:
Wbrowser.agents(ev[1])
return 1
def __init__(self, quIN, quOUT):