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

View File

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

View File

@ -208,7 +208,7 @@ class RosterWindow:
def add_contact_to_roster(self, jid, account): def add_contact_to_roster(self, jid, account):
'''Add a contact to the roster and add groups if they aren't in roster '''Add a contact to the roster and add groups if they aren't in roster
force is about force to add it, even if it is offline and show offline force is about force to add it, even if it is offline and show offline
is False, because it has online children, so we need to show it. is False, because it has online children, so we need to show it.
If add_children is True, we also add all children, even if they were not If add_children is True, we also add all children, even if they were not
already drawn''' already drawn'''
@ -224,8 +224,12 @@ class RosterWindow:
self.add_self_contact(account) self.add_self_contact(account)
return return
if gajim.jid_is_transport(contact.jid): 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')] contact.groups = [_('Transports')]
# JEP-0162 # JEP-0162
hide = True hide = True
if contact.sub in ('both', 'to'): if contact.sub in ('both', 'to'):
@ -308,25 +312,25 @@ class RosterWindow:
groups = [_('Observers')] groups = [_('Observers')]
elif not groups: elif not groups:
groups = [_('General')] groups = [_('General')]
for g in groups: for group in groups:
iterG = self.get_group_iter(g, account) iterG = self.get_group_iter(group, account)
if not iterG: if not iterG:
IterAcct = self.get_account_iter(account) IterAcct = self.get_account_iter(account)
iterG = model.append(IterAcct, [ iterG = model.append(IterAcct, [
self.jabber_state_images['16']['closed'], self.jabber_state_images['16']['closed'],
gtkgui_helpers.escape_for_pango_markup(g), 'group', g, account, gtkgui_helpers.escape_for_pango_markup(group), 'group',
False, None]) group, account, False, None])
if not gajim.groups[account].has_key(g): # It can probably never append if group not in gajim.groups[account]: # It can probably never append
if account + g in self.collapsed_rows: if account + group in self.collapsed_rows:
ishidden = False ishidden = False
else: else:
ishidden = True ishidden = True
gajim.groups[account][g] = { 'expand': ishidden } gajim.groups[account][group] = {'expand': ishidden}
if not account in self.collapsed_rows: if not account in self.collapsed_rows:
self.tree.expand_row((model.get_path(iterG)[0]), False) self.tree.expand_row((model.get_path(iterG)[0]), False)
typestr = 'contact' typestr = 'contact'
if g == _('Transports'): if group == _('Transports'):
typestr = 'agent' typestr = 'agent'
name = contact.get_shown_name() name = contact.get_shown_name()
@ -334,7 +338,7 @@ class RosterWindow:
model.append(iterG, (None, name, typestr, contact.jid, account, model.append(iterG, (None, name, typestr, contact.jid, account,
False, None)) False, None))
if gajim.groups[account][g]['expand']: if gajim.groups[account][group]['expand']:
self.tree.expand_row(model.get_path(iterG), False) self.tree.expand_row(model.get_path(iterG), False)
self.draw_contact(jid, account) self.draw_contact(jid, account)
self.draw_avatar(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: else:
gajim.interface.instances['file_transfers'].window.show_all() gajim.interface.instances['file_transfers'].window.show_all()
def on_show_transports_menu_activate(self, widget): def on_show_transports_menuitem_activate(self, widget):
#FIXME: implement me gajim.config.set('show_transports_group', widget.get_active())
if widget.get_active(): self.draw_roster()
print 'show transports group IF NEEDED'
else:
print 'hide transports group IF NEEDED'
def on_manage_bookmarks_menuitem_activate(self, widget): def on_manage_bookmarks_menuitem_activate(self, widget):
config.ManageBookmarksWindow() 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( self.xml.get_widget('show_offline_contacts_menuitem').set_active(
showOffline) showOffline)
show_transports_group = gajim.config.get('show_transports_group')
self.xml.get_widget('show_transports_menuitem').set_active(
show_transports_group)
# columns # columns
# this col has 3 cells: # this col has 3 cells: