From 611eb69e7325d9a9e1d3153ab44763a3a6a0d54f Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sun, 24 Jul 2011 10:54:43 +0200
Subject: [PATCH] add an option to allow hidding roster even if systray is not
 shown. Fixes #6930

---
 src/common/config.py |  3 ++-
 src/roster_window.py | 12 +++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/common/config.py b/src/common/config.py
index ec522c8646..3a83be6e13 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -86,7 +86,8 @@ class Config:
             'autoxa_message': [ opt_str, _('$S (Not available as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoxa time.') ],
             'ask_online_status': [ opt_bool, False ],
             'ask_offline_status': [ opt_bool, False ],
-            'trayicon': [opt_str, 'always', _("When to show notification area icon. Can be 'never', 'on_event', 'always'."), True],
+            'trayicon': [opt_str, 'always', _("When to show notification area icon. Can be 'never', 'on_event', 'always'."), False],
+            'allow_hide_roster': [opt_bool, False, _("Allow to hide the roster window even if the tray icon is not shown."), False],
             'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
             'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ],
             'activity_iconset': [ opt_str, DEFAULT_ACTIVITY_ICONSET, '', True ],
diff --git a/src/roster_window.py b/src/roster_window.py
index a5ccbaa63b..77d41987bd 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -2310,9 +2310,9 @@ class RosterWindow:
         """
         Main window X button was clicked
         """
-        if gajim.interface.systray_enabled and not gajim.config.get(
-        'quit_on_roster_x_button') and gajim.config.get('trayicon') != \
-        'on_event':
+        if not gajim.config.get('quit_on_roster_x_button') and (
+        (gajim.interface.systray_enabled and gajim.config.get('trayicon') != \
+        'on_event') or gajim.config.get('allow_hide_roster')):
             self.tooltip.hide_tooltip()
             if gajim.config.get('save-roster-position'):
                 x, y = self.window.get_position()
@@ -3878,8 +3878,10 @@ class RosterWindow:
                 # let message window close the tab
                 return
             list_of_paths = self.tree.get_selection().get_selected_rows()[1]
-            if not len(list_of_paths) and gajim.interface.systray_enabled and \
-            not gajim.config.get('quit_on_roster_x_button'):
+            if not len(list_of_paths) and not gajim.config.get(
+            'quit_on_roster_x_button') and ((gajim.interface.systray_enabled and\
+            gajim.config.get('trayicon') == 'always') or gajim.config.get(
+            'allow_hide_roster')):
                 self.tooltip.hide_tooltip()
                 self.window.hide()
         elif event.state & gtk.gdk.CONTROL_MASK and event.keyval == \
-- 
GitLab