imho roster looks better now

This commit is contained in:
Nikos Kouremenos 2005-04-01 00:28:45 +00:00
parent 610bc35b22
commit 38a576d870
2 changed files with 20 additions and 20 deletions

View File

@ -677,14 +677,14 @@ class New_message_dialog:
jid = self.jid_entry.get_text() jid = self.jid_entry.get_text()
# use User class, new_chat expects it that way # use User class, new_chat expects it that way
# is it in the roster? # is it in the roster?
if not self.plugin.roster.contacts[self.account].has_key(jid): if self.plugin.roster.contacts[self.account].has_key(jid):
user = self.plugin.roster.contacts[self.account][jid][0]
else:
user = gtkgui.User(jid, jid, ['not in the roster'], \ user = gtkgui.User(jid, jid, ['not in the roster'], \
'not in the roster', 'not in the roster', 'none', None, '', 0, '') 'not in the roster', 'not in the roster', 'none', None, '', 0, '')
self.plugin.roster.contacts[self.account][jid] = [user] self.plugin.roster.contacts[self.account][jid] = [user]
self.plugin.roster.add_user_to_roster(user.jid, self.account) self.plugin.roster.add_user_to_roster(user.jid, self.account)
else:
user = self.plugin.roster.contacts[self.account][jid][0]
if not self.plugin.windows[self.account]['chats'].has_key(jid): if not self.plugin.windows[self.account]['chats'].has_key(jid):
self.plugin.roster.new_chat(user, self.account) self.plugin.roster.new_chat(user, self.account)
self.plugin.windows[self.account]['chats'][jid].active_tab(jid) self.plugin.windows[self.account]['chats'][jid].active_tab(jid)

View File

@ -651,10 +651,7 @@ class Roster_window:
iter = model.get_iter(path) iter = model.get_iter(path)
type = model.get_value(iter, 2) type = model.get_value(iter, 2)
if (type == 'group' or type == 'account'): if (type == 'group' or type == 'account'):
print self.tree.get_columns() if x < 20: # first cell in 1st column (the arrow SINGLE clicked)
print column
#self.tree.get_column(0)
if column == self.tree.get_column(0): # if first column (the one that has \/
if (self.tree.row_expanded(path)): if (self.tree.row_expanded(path)):
self.tree.collapse_row(path) self.tree.collapse_row(path)
else: else:
@ -1003,8 +1000,7 @@ class Roster_window:
self.plugin.windows[account]['chats'][jid].active_tab(jid) self.plugin.windows[account]['chats'][jid].active_tab(jid)
def on_roster_treeview_row_expanded(self, widget, iter, path): def on_roster_treeview_row_expanded(self, widget, iter, path):
"""When a row is expanded : """When a row is expanded change the icon of the arrow"""
change the icon of the arrow"""
model = self.tree.get_model() model = self.tree.get_model()
account = model.get_value(iter, 4) account = model.get_value(iter, 4)
type = model.get_value(iter, 2) type = model.get_value(iter, 2)
@ -1093,8 +1089,8 @@ class Roster_window:
self.path = 'plugins/gtkgui/icons/' + iconset + '/' self.path = 'plugins/gtkgui/icons/' + iconset + '/'
self.pixbufs = {} self.pixbufs = {}
for state in ('connecting', 'online', 'chat', 'away', 'xa', 'dnd', \ for state in ('connecting', 'online', 'chat', 'away', 'xa', 'dnd', \
'invisible', 'offline', 'error', 'requested', 'message', 'opened', \ 'invisible', 'offline', 'error', 'requested', 'message', \
'closed', 'not in the roster'): 'opened', 'closed', 'not in the roster'):
# try to open a pixfile with the correct method # try to open a pixfile with the correct method
state_file = state.replace(' ', '_') state_file = state.replace(' ', '_')
files = [] files = []
@ -1147,11 +1143,12 @@ class Roster_window:
elif model.get_value(iter, 2) == 'group': elif model.get_value(iter, 2) == 'group':
renderer.set_property('cell-background', \ renderer.set_property('cell-background', \
self.plugin.config['groupbgcolor']) self.plugin.config['groupbgcolor'])
renderer.set_property('xalign', 0.3) renderer.set_property('xalign', 0.5)
else: else:
renderer.set_property('cell-background', \ renderer.set_property('cell-background', \
self.plugin.config['userbgcolor']) self.plugin.config['userbgcolor'])
renderer.set_property('xalign', 1) renderer.set_property('xalign', 1)
renderer.set_property('width', 20)
def nameCellDataFunc(self, column, renderer, model, iter, data=None): def nameCellDataFunc(self, column, renderer, model, iter, data=None):
"""When a row is added, set properties for name renderer""" """When a row is added, set properties for name renderer"""
@ -1161,20 +1158,21 @@ class Roster_window:
renderer.set_property('cell-background', \ renderer.set_property('cell-background', \
self.plugin.config['accountbgcolor']) self.plugin.config['accountbgcolor'])
renderer.set_property('font', self.plugin.config['accountfont']) renderer.set_property('font', self.plugin.config['accountfont'])
renderer.set_property('xpad', 0)
elif model.get_value(iter, 2) == 'group': elif model.get_value(iter, 2) == 'group':
renderer.set_property('foreground', \ renderer.set_property('foreground', \
self.plugin.config['grouptextcolor']) self.plugin.config['grouptextcolor'])
renderer.set_property('cell-background', \ renderer.set_property('cell-background', \
self.plugin.config['groupbgcolor']) self.plugin.config['groupbgcolor'])
renderer.set_property('font', self.plugin.config['groupfont']) renderer.set_property('font', self.plugin.config['groupfont'])
renderer.set_property('xpad', 4)
else: else:
renderer.set_property('foreground', \ renderer.set_property('foreground', \
self.plugin.config['usertextcolor']) self.plugin.config['usertextcolor'])
renderer.set_property('cell-background', \ renderer.set_property('cell-background', \
self.plugin.config['userbgcolor']) self.plugin.config['userbgcolor'])
renderer.set_property('font', self.plugin.config['userfont']) renderer.set_property('font', self.plugin.config['userfont'])
renderer.set_property('xpad', 8)
renderer.set_property('xpad', 5)
def compareIters(self, model, iter1, iter2, data = None): def compareIters(self, model, iter1, iter2, data = None):
"""Compare two iters to sort them""" """Compare two iters to sort them"""
@ -1333,8 +1331,9 @@ class Roster_window:
self.xml.get_widget('show_offline_contacts_menuitem').set_active(showOffline) self.xml.get_widget('show_offline_contacts_menuitem').set_active(showOffline)
#columns #columns
#this col has two cells: first one img, second one text
col = gtk.TreeViewColumn() col = gtk.TreeViewColumn()
self.tree.append_column(col)
render_pixbuf = CellRendererImage() render_pixbuf = CellRendererImage()
col.pack_start(render_pixbuf, expand = False) col.pack_start(render_pixbuf, expand = False)
col.add_attribute(render_pixbuf, 'image', 0) col.add_attribute(render_pixbuf, 'image', 0)
@ -1342,13 +1341,14 @@ class Roster_window:
render_text = gtk.CellRendererText() render_text = gtk.CellRendererText()
render_text.connect('edited', self.on_cell_edited) render_text.connect('edited', self.on_cell_edited)
#need gtk2.4 render_text.connect('editing-canceled', self.on_editing_canceled)
#render_text.connect('editing-canceled', self.on_editing_canceled)
col.pack_start(render_text, expand = True) col.pack_start(render_text, expand = True)
col.add_attribute(render_text, 'text', 1) col.add_attribute(render_text, 'text', 1)
col.add_attribute(render_text, 'editable', 5) col.add_attribute(render_text, 'editable', 5) #5th column?? I don't understand :(
col.set_cell_data_func(render_text, self.nameCellDataFunc, None) col.set_cell_data_func(render_text, self.nameCellDataFunc, None)
self.tree.append_column(col)
#do not show gtk arrows workaround
col = gtk.TreeViewColumn() col = gtk.TreeViewColumn()
render_pixbuf = gtk.CellRendererPixbuf() render_pixbuf = gtk.CellRendererPixbuf()
col.pack_start(render_pixbuf, expand = False) col.pack_start(render_pixbuf, expand = False)