Commit 062caecf authored by Yann Leboulanger's avatar Yann Leboulanger

ability to show / hide roster from statusicon menu. Fixes #5557

parent abb846f8
......@@ -66,13 +66,11 @@
</child>
<child>
<object class="GtkImageMenuItem" id="show_roster_menuitem">
<property name="label">Show _Roster</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="image">image5</property>
<property name="use_stock">False</property>
<property name="accel_group">accelgroup1</property>
<signal name="activate" handler="on_show_roster_menuitem_activate"/>
</object>
</child>
<child>
......
......@@ -172,6 +172,7 @@ class StatusIcon:
status_menuitem = self.xml.get_object('status_menu')
join_gc_menuitem = self.xml.get_object('join_gc_menuitem')
sounds_mute_menuitem = self.xml.get_object('sounds_mute_menuitem')
show_roster_menuitem = self.xml.get_object('show_roster_menuitem')
if self.single_message_handler_id:
single_message_menuitem.handler_disconnect(
......@@ -316,6 +317,16 @@ class StatusIcon:
sounds_mute_menuitem.set_active(not gajim.config.get('sounds_on'))
win = gajim.interface.roster.window
if win.get_property('has-toplevel-focus'):
show_roster_menuitem.get_children()[0].set_label(_('Hide _Roster'))
show_roster_menuitem.connect('activate',
self.on_hide_roster_menuitem_activate)
else:
show_roster_menuitem.get_children()[0].set_label(_('Show _Roster'))
show_roster_menuitem.connect('activate',
self.on_show_roster_menuitem_activate)
if os.name == 'nt':
if self.added_hide_menuitem is False:
self.systray_context_menu.prepend(gtk.SeparatorMenuItem())
......@@ -342,6 +353,10 @@ class StatusIcon:
win = gajim.interface.roster.window
win.present()
def on_hide_roster_menuitem_activate(self, widget):
win = gajim.interface.roster.window
win.hide()
def on_preferences_menuitem_activate(self, widget):
if 'preferences' in gajim.interface.instances:
gajim.interface.instances['preferences'].window.present()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment