Changeset 10030
- Timestamp:
- 07/25/08 16:11:14 (4 months ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
data/glade/preferences_window.glade (modified) (3 diffs)
-
src/common/config.py (modified) (1 diff)
-
src/common/pep.py (modified) (1 diff)
-
src/config.py (modified) (2 diffs)
-
src/roster_window.py (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/glade/preferences_window.glade
r10024 r10030 91 91 </child> 92 92 <child> 93 <widget class="GtkCheckButton" id="s ort_by_show_checkbutton">94 <property name="visible">True</property> 95 <property name="can_focus">True</property> 96 <property name="tooltip" translatable="yes">If checked, Gajim will sort contacts in roster window and groupchats by their status and not by the shown name</property>97 <property name="label" translatable="yes"> _Sort contacts by status</property>93 <widget class="GtkCheckButton" id="show_tunes_in_roster_checkbutton"> 94 <property name="visible">True</property> 95 <property name="can_focus">True</property> 96 <property name="tooltip" translatable="yes">If checked, Gajim will display the tunes of contacts in the roster window</property> 97 <property name="label" translatable="yes">Display _tunes of contacts in roster</property> 98 98 <property name="use_underline">True</property> 99 99 <property name="response_id">0</property> 100 100 <property name="draw_indicator">True</property> 101 <signal name="toggled" handler="on_s ort_by_show_checkbutton_toggled"/>101 <signal name="toggled" handler="on_show_tunes_in_roster_checkbutton_toggled"/> 102 102 </widget> 103 103 <packing> … … 105 105 <property name="fill">False</property> 106 106 <property name="position">3</property> 107 </packing> 108 </child> 109 <child> 110 <widget class="GtkCheckButton" id="sort_by_show_checkbutton"> 111 <property name="visible">True</property> 112 <property name="can_focus">True</property> 113 <property name="tooltip" translatable="yes">If checked, Gajim will sort contacts in roster window and groupchats by their status and not by the shown name</property> 114 <property name="label" translatable="yes">_Sort contacts by status</property> 115 <property name="use_underline">True</property> 116 <property name="response_id">0</property> 117 <property name="draw_indicator">True</property> 118 <signal name="toggled" handler="on_sort_by_show_checkbutton_toggled"/> 119 </widget> 120 <packing> 121 <property name="expand">False</property> 122 <property name="fill">False</property> 123 <property name="position">4</property> 107 124 </packing> 108 125 </child> … … 204 221 <property name="can_focus">True</property> 205 222 <property name="tooltip" translatable="yes">Hide all buttons in chat windows</property> 206 <property name="label" translatable="yes"> _Make message windows compact</property>223 <property name="label" translatable="yes">Ma_ke message windows compact</property> 207 224 <property name="use_underline">True</property> 208 225 <property name="response_id">0</property> -
trunk/src/common/config.py
r10022 r10030 215 215 'show_avatars_in_roster': [opt_bool, True, '', True], 216 216 'show_mood_in_roster': [opt_bool, True, '', True], 217 'show_tunes_in_roster': [opt_bool, True, '', True], 217 218 'avatar_position_in_roster': [opt_str, 'right', _('Define the position of the avatar in roster. Can be left or right'), True], 218 219 'ask_avatars_on_startup': [opt_bool, True, _('If True, Gajim will ask for avatar each contact that did not have an avatar last time or has one cached that is too old.')], -
trunk/src/common/pep.py
r10025 r10030 168 168 del contact.tune['length'] 169 169 170 ctrl = gajim.interface.msg_win_mgr.get_control(user, name) 171 if ctrl: 172 ctrl.update_tune() 170 if jid == gajim.get_jid_from_account(name): 171 gajim.interface.roster.draw_account(name) 172 else: 173 gajim.interface.roster.draw_tune(user, name) 174 ctrl = gajim.interface.msg_win_mgr.get_control(user, name) 175 if ctrl: 176 ctrl.update_tune() 173 177 174 178 def user_geoloc(items, name, jid): -
trunk/src/config.py
r10023 r10030 104 104 st = gajim.config.get('show_mood_in_roster') 105 105 self.xml.get_widget('show_mood_in_roster_checkbutton'). \ 106 set_active(st) 107 108 # Display tunes in roster 109 st = gajim.config.get('show_tunes_in_roster') 110 self.xml.get_widget('show_tunes_in_roster_checkbutton'). \ 106 111 set_active(st) 107 112 … … 536 541 def on_show_mood_in_roster_checkbutton_toggled(self, widget): 537 542 self.on_checkbutton_toggled(widget, 'show_mood_in_roster') 543 gajim.interface.roster.setup_and_draw_roster() 544 545 def on_show_tunes_in_roster_checkbutton_toggled(self, widget): 546 self.on_checkbutton_toggled(widget, 'show_tunes_in_roster') 538 547 gajim.interface.roster.setup_and_draw_roster() 539 548 -
trunk/src/roster_window.py
r10027 r10030 78 78 C_ACCOUNT, # cellrenderer text that holds account name 79 79 C_MOOD_PIXBUF, 80 C_TUNE_PIXBUF, 80 81 C_AVATAR_PIXBUF, # avatar_pixbuf 81 82 C_PADLOCK_PIXBUF, # use for account row only 82 ) = range( 8)83 ) = range(9) 83 84 84 85 class RosterWindow: … … 290 291 gajim.interface.jabber_state_images['16'][show], 291 292 _('Merged accounts'), 'account', '', 'all', 292 None, None, None ])293 None, None, None, None]) 293 294 else: 294 295 show = gajim.SHOW_LIST[gajim.connections[account]. \ … … 306 307 gajim.interface.jabber_state_images['16'][show], 307 308 gobject.markup_escape_text(account), 'account', 308 our_jid, account, None, None, tls_pixbuf])309 our_jid, account, None, None, None, tls_pixbuf]) 309 310 310 311 self.draw_account(account) … … 369 370 it = self.model.append(child_iter, (None, 370 371 contact.get_shown_name(), 'contact', 371 contact.jid, account, None, None, None)) 372 contact.jid, account, None, None, None, 373 None)) 372 374 added_iters.append(it) 373 375 else: … … 388 390 markup_escape_text(group), 389 391 'group', group, account, None, 390 None, None ])392 None, None, None]) 391 393 self.draw_group(group, account) 392 394 … … 402 404 i_ = self.model.append(child_iterG, (None, 403 405 contact.get_shown_name(), typestr, 404 contact.jid, account, None, None, None)) 406 contact.jid, account, None, None, None, 407 None)) 405 408 added_iters.append(i_) 406 409 … … 610 613 self.draw_contact(c.jid, acc) 611 614 self.draw_mood(c.jid, acc) 615 self.draw_tune(c.jid, acc) 612 616 self.draw_avatar(c.jid, acc) 613 617 … … 651 655 child_iterA = self._get_account_iter(account, self.model) 652 656 self.model.append(child_iterA, (None, gajim.nicks[account], 653 'self_contact', jid, account, None, None, None ))657 'self_contact', jid, account, None, None, None, None)) 654 658 655 659 self.draw_contact(jid, account) 656 660 self.draw_mood(jid, account) 661 self.draw_tune(jid, account) 657 662 self.draw_avatar(jid, account) 658 663 self.draw_account(account) … … 713 718 self.draw_contact(c.jid, acc) 714 719 self.draw_mood(c.jid, acc) 720 self.draw_tune(c.jid, acc) 715 721 self.draw_avatar(c.jid, acc) 716 722 for group in contact.get_shown_groups(): … … 770 776 self.draw_contact(c.jid, acc) 771 777 self.draw_mood(c.jid, acc) 778 self.draw_tune(c.jid, acc) 772 779 self.draw_avatar(c.jid, acc) 773 780 … … 989 996 else: 990 997 self.model[child_iter][C_MOOD_PIXBUF] = None 998 999 if gajim.config.get('show_tunes_in_roster') \ 1000 and (gajim.connections[account].tune.has_key('artist') \ 1001 or gajim.connections[account].tune.has_key('title')): 1002 self.model[child_iter][C_TUNE_PIXBUF] = \ 1003 gtk.gdk.pixbuf_new_from_file( 1004 '../data/emoticons/static/music.png') 1005 else: 1006 self.model[child_iter][C_TUNE_PIXBUF] = None 991 1007 992 1008 return False … … 1234 1250 1235 1251 1252 def draw_tune(self, jid, account): 1253 iters = self._get_contact_iter(jid, account, model = self.model) 1254 if not iters or not gajim.config.get('show_tunes_in_roster'): 1255 return 1256 jid = self.model[iters[0]][C_JID] 1257 jid = jid.decode('utf-8') 1258 contact = gajim.contacts.get_contact(account, jid) 1259 if contact.tune.has_key('artist') \ 1260 or contact.tune.has_key('title'): 1261 pixbuf = gtk.gdk.pixbuf_new_from_file( 1262 '../data/emoticons/static/music.png') 1263 else: 1264 pixbuf = None 1265 for child_iter in iters: 1266 self.model[child_iter][C_TUNE_PIXBUF] = pixbuf 1267 return False 1268 1269 1236 1270 def draw_avatar(self, jid, account): 1237 1271 iters = self._get_contact_iter(jid, account, model = self.model) … … 1281 1315 self.draw_contact(jid, account) 1282 1316 self.draw_mood(jid, account) 1317 self.draw_tune(jid, account) 1283 1318 self.draw_avatar(jid, account) 1284 1319 yield True … … 1294 1329 # avatar_pixbuf, padlock_pixbuf) 1295 1330 self.model = gtk.TreeStore(gtk.Image, str, str, str, str, 1296 gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, gtk.gdk.Pixbuf) 1331 gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, 1332 gtk.gdk.Pixbuf) 1297 1333 1298 1334 self.model.set_sort_func(1, self._compareIters) … … 3697 3733 self.draw_contact(c.jid, acc) 3698 3734 self.draw_mood(c.jid, acc) 3735 self.draw_tune(c.jid, acc) 3699 3736 self.draw_avatar(c.jid, acc) 3700 3737 … … 4257 4294 4258 4295 4296 def _fill_tune_pixbuf_rederer(self, column, renderer, model, titer, 4297 data = None): 4298 '''When a row is added, set properties for avatar renderer''' 4299 theme = gajim.config.get('roster_theme') 4300 type_ = model[titer][C_TYPE] 4301 if type_ == 'group': 4302 renderer.set_property('visible', False) 4303 return 4304 4305 # allocate space for the icon only if needed 4306 if model[titer][C_TUNE_PIXBUF]: 4307 renderer.set_property('visible', True) 4308 else: 4309 renderer.set_property('visible', False) 4310 if type_ == 'account': 4311 color = gajim.config.get_per('themes', theme, 4312 'accountbgcolor') 4313 if color: 4314 renderer.set_property('cell-background', color) 4315 else: 4316 self.set_renderer_color(renderer, 4317 gtk.STATE_ACTIVE) 4318 # align pixbuf to the right) 4319 renderer.set_property('xalign', 1) 4320 # prevent type_ = None, see http://trac.gajim.org/ticket/2534 4321 elif type_: 4322 if not model[titer][C_JID] \ 4323 or not model[titer][C_ACCOUNT]: 4324 # This can append at the moment we add the row 4325 return 4326 jid = model[titer][C_JID].decode('utf-8') 4327 account = model[titer][C_ACCOUNT].decode('utf-8') 4328 if jid in gajim.newly_added[account]: 4329 renderer.set_property('cell-background', 4330 gajim.config.get( 4331 'just_connected_bg_color')) 4332 elif jid in gajim.to_be_removed[account]: 4333 renderer.set_property('cell-background', 4334 gajim.config.get( 4335 'just_disconnected_bg_color')) 4336 else: 4337 color = gajim.config.get_per('themes', 4338 theme, 'contactbgcolor') 4339 if color: 4340 renderer.set_property( 4341 'cell-background', color) 4342 else: 4343 renderer.set_property( 4344 'cell-background', None) 4345 # align pixbuf to the right 4346 renderer.set_property('xalign', 1) 4347 4348 4259 4349 def _fill_avatar_pixbuf_rederer(self, column, renderer, model, titer, 4260 4350 data = None): … … 6067 6157 self._fill_mood_pixbuf_rederer, None) 6068 6158 6159 render_pixbuf = gtk.CellRendererPixbuf() 6160 col.pack_start(render_pixbuf, expand = False) 6161 col.add_attribute(render_pixbuf, 'pixbuf', C_TUNE_PIXBUF) 6162 col.set_cell_data_func(render_pixbuf, 6163 self._fill_tune_pixbuf_rederer, None) 6164 6069 6165 if gajim.config.get('avatar_position_in_roster') == 'right': 6070 6166 add_avatar_renderer()
