even on 31st of december !! :)

show offline ans change of icon style take effect immediatly
This commit is contained in:
Yann Leboulanger 2003-12-31 10:55:13 +00:00
parent e1fd6f4c68
commit 6321e0501b
2 changed files with 56 additions and 20 deletions

View File

@ -40,7 +40,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image97">
<widget class="GtkImage" id="image115">
<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="image98">
<widget class="GtkImage" id="image116">
<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="image99">
<widget class="GtkImage" id="image117">
<property name="visible">True</property>
<property name="stock">gtk-select-color</property>
<property name="icon_size">1</property>
@ -104,7 +104,7 @@
<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">
<widget class="GtkImage" id="image118">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -131,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="image101">
<widget class="GtkImage" id="image119">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -144,6 +144,16 @@
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="show_offline">
<property name="visible">True</property>
<property name="label" translatable="yes">Show Offline</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_show_offline_activate" last_modification_time="Wed, 31 Dec 2003 09:49:15 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator1">
<property name="visible">True</property>
@ -158,7 +168,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="image102">
<widget class="GtkImage" id="image120">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -180,7 +190,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image103">
<widget class="GtkImage" id="image121">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>

View File

@ -127,6 +127,8 @@ class prefs:
self.r.cfgParser.writeCfgFile()
self.r.cfgParser.parseCfgFile()
self.r.redraw_roster()
def on_ok(self, widget):
self.write_cfg()
@ -618,13 +620,23 @@ class roster:
if newgrp == 1:
#expand new groups
self.tree.expand_row(self.treestore.get_path(iterG), FALSE)
def redraw_roster(self):
for j in self.l_contact.keys():
self.l_contact[j]['iter'] = []
self.l_group = {}
self.draw_roster()
def draw_roster(self):
self.treestore.clear()
for j in self.l_contact.keys():
self.add_user(self.l_contact[j]['user'])
def mkroster(self, tab):
def mklists(self, tab):
""" l_contact = {jid:{'user':_, 'iter':[iter1, ...]] """
self.l_contact = {}
""" l_group = {name:iter} """
self.l_group = {}
self.treestore.clear()
for jid in tab.keys():
#remove ressource from jid string
ji = string.split(jid, '/')[0]
@ -638,7 +650,7 @@ class roster:
if not show:
show = 'offline'
user1 = user(ji, name, tab[jid]['groups'], show, tab[jid]['status'], tab[jid]['sub'])
self.add_user(user1)
self.l_contact[ji] = {'user':user1, 'iter':[]}
def update_iter(self, widget, path, iter, data):
jid = self.treestore.get_value(iter, 2)
@ -834,6 +846,10 @@ class roster:
pix = gtk.gdk.pixbuf_new_from_file (self.path + state + '.xpm')
self.pixbufs[state] = pix
def on_show_off(self, widget):
self.showOffline = 1 - self.showOffline
self.redraw_roster()
def __init__(self, queueOUT, plug):
# FIXME : handle no file ...
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
@ -880,6 +896,8 @@ class roster:
else:
self.showOffline = 0
self.xml.get_widget('show_offline').set_active(self.showOffline)
self.grpbgcolor = 'gray50'
self.userbgcolor = 'white'
@ -910,6 +928,7 @@ class roster:
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_show_offline_activate', self.on_show_off)
self.xml.signal_connect('on_about_activate', self.on_about)
self.xml.signal_connect('on_quit_activate', self.on_quit)
self.xml.signal_connect('on_treeview_event', self.on_treeview_event)
@ -924,30 +943,37 @@ class plugin:
while self.queueIN.empty() == 0:
ev = self.queueIN.get()
if ev[0] == 'ROSTER':
self.r.mkroster(ev[1])
self.r.mklists(ev[1])
self.r.draw_roster()
elif ev[0] == 'NOTIFY':
jid = string.split(ev[1][0], '/')[0]
if string.find(jid, "@") <= 0:
#It must be an agent
ji = string.replace(jid, '@', '')
else:
ji = jid
#Update user
if self.r.l_contact.has_key(jid):
u = self.r.l_contact[jid]['user']
if self.r.l_contact.has_key(ji):
u = self.r.l_contact[ji]['user']
u.show = ev[1][1]
u.status = ev[1][2]
#Print status in chat window
if self.r.tab_messages.has_key(jid):
self.r.tab_messages[jid].print_conversation(\
if self.r.tab_messages.has_key(ji):
self.r.tab_messages[ji].print_conversation(\
"%s is now %s (%s)" % (u.name, ev[1][1], ev[1][2]), 'status')
if string.find(jid, "@") <= 0:
#It must be an agent
jid = string.replace(jid, '@', '')
if not self.r.l_contact.has_key(jid):
user1 = user(jid, jid, ['Agents'], ev[1][1], ev[1][2], 'from')
if not self.r.l_contact.has_key(ji):
user1 = user(ji, ji, ['Agents'], ev[1][1], ev[1][2], 'from')
self.r.add_user(user1)
else:
#Update existing line
for i in self.r.l_contact[jid]['iter']:
# self.l_contact[jid]['user'].show = show
# self.l_contact[jid]['user'].status = status
for i in self.r.l_contact[ji]['iter']:
if self.r.pixbufs.has_key(ev[1][1]):
self.r.treestore.set_value(i, 0, self.r.pixbufs[ev[1][1]])
elif self.r.l_contact.has_key(jid):
elif self.r.l_contact.has_key(ji):
#It isn't an agent
self.r.chg_status(jid, ev[1][1], ev[1][2])
elif ev[0] == 'MSG':