add code for [] show transports menuitem to work

This commit is contained in:
Nikos Kouremenos 2006-09-29 15:37:46 +00:00
parent d72a1ef9b1
commit c118ce3ad6
3 changed files with 35 additions and 29 deletions

View File

@ -56,7 +56,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1578">
<widget class="GtkImage" id="image1605">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -76,7 +76,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1579">
<widget class="GtkImage" id="image1606">
<property name="visible">True</property>
<property name="stock">gtk-connect</property>
<property name="icon_size">1</property>
@ -102,7 +102,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1580">
<widget class="GtkImage" id="image1607">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -122,7 +122,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1581">
<widget class="GtkImage" id="image1608">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -158,7 +158,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1582">
<widget class="GtkImage" id="image1609">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -194,7 +194,7 @@
<accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1583">
<widget class="GtkImage" id="image1610">
<property name="visible">True</property>
<property name="stock">gtk-network</property>
<property name="icon_size">1</property>
@ -214,7 +214,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1584">
<widget class="GtkImage" id="image1611">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
<property name="icon_size">1</property>
@ -242,7 +242,7 @@
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1585">
<widget class="GtkImage" id="image1612">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -281,12 +281,12 @@
</child>
<child>
<widget class="GtkCheckMenuItem" id="show_transports_menu">
<widget class="GtkCheckMenuItem" id="show_transports_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Show Trans_ports</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_show_transports_menu_activate" last_modification_time="Fri, 29 Sep 2006 15:04:53 GMT"/>
<signal name="activate" handler="on_show_transports_menuitem_activate" last_modification_time="Fri, 29 Sep 2006 15:35:28 GMT"/>
</widget>
</child>
@ -305,7 +305,7 @@
<accelerator key="T" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1586">
<widget class="GtkImage" id="image1613">
<property name="visible">True</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
@ -340,7 +340,7 @@
<signal name="activate" handler="on_contents_menuitem_activate" last_modification_time="Thu, 06 Oct 2005 23:29:10 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1587">
<widget class="GtkImage" id="image1614">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>

View File

@ -52,7 +52,8 @@ class Config:
'autopopupaway': [ opt_bool, False ],
'use_notif_daemon': [ opt_bool, True , _('Use D-Bus and Notification-Daemon to show notifications') ],
'ignore_unknown_contacts': [ opt_bool, False ],
'showoffline': [ opt_bool, False, '', True ],
'showoffline': [ opt_bool, False ],
'show_transports_group': [ opt_bool, True ],
'autoaway': [ opt_bool, True ],
'autoawaytime': [ opt_int, 5, _('Time in minutes, after which your status changes to away.') ],
'autoaway_message': [ opt_str, _('Away as a result of being idle') ],

View File

@ -224,8 +224,12 @@ class RosterWindow:
self.add_self_contact(account)
return
if gajim.jid_is_transport(contact.jid):
# if jid is transport, check if we wanna show it in roster
if not gajim.config.get('show_transports_group'):
return
contact.groups = [_('Transports')]
# JEP-0162
hide = True
if contact.sub in ('both', 'to'):
@ -308,25 +312,25 @@ class RosterWindow:
groups = [_('Observers')]
elif not groups:
groups = [_('General')]
for g in groups:
iterG = self.get_group_iter(g, account)
for group in groups:
iterG = self.get_group_iter(group, account)
if not iterG:
IterAcct = self.get_account_iter(account)
iterG = model.append(IterAcct, [
self.jabber_state_images['16']['closed'],
gtkgui_helpers.escape_for_pango_markup(g), 'group', g, account,
False, None])
if not gajim.groups[account].has_key(g): # It can probably never append
if account + g in self.collapsed_rows:
gtkgui_helpers.escape_for_pango_markup(group), 'group',
group, account, False, None])
if group not in gajim.groups[account]: # It can probably never append
if account + group in self.collapsed_rows:
ishidden = False
else:
ishidden = True
gajim.groups[account][g] = { 'expand': ishidden }
gajim.groups[account][group] = {'expand': ishidden}
if not account in self.collapsed_rows:
self.tree.expand_row((model.get_path(iterG)[0]), False)
typestr = 'contact'
if g == _('Transports'):
if group == _('Transports'):
typestr = 'agent'
name = contact.get_shown_name()
@ -334,7 +338,7 @@ class RosterWindow:
model.append(iterG, (None, name, typestr, contact.jid, account,
False, None))
if gajim.groups[account][g]['expand']:
if gajim.groups[account][group]['expand']:
self.tree.expand_row(model.get_path(iterG), False)
self.draw_contact(jid, account)
self.draw_avatar(jid, account)
@ -2699,12 +2703,9 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
else:
gajim.interface.instances['file_transfers'].window.show_all()
def on_show_transports_menu_activate(self, widget):
#FIXME: implement me
if widget.get_active():
print 'show transports group IF NEEDED'
else:
print 'hide transports group IF NEEDED'
def on_show_transports_menuitem_activate(self, widget):
gajim.config.set('show_transports_group', widget.get_active())
self.draw_roster()
def on_manage_bookmarks_menuitem_activate(self, widget):
config.ManageBookmarksWindow()
@ -3866,6 +3867,10 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
self.xml.get_widget('show_offline_contacts_menuitem').set_active(
showOffline)
show_transports_group = gajim.config.get('show_transports_group')
self.xml.get_widget('show_transports_menuitem').set_active(
show_transports_group)
# columns
# this col has 3 cells: