From 1b9c5066f59fab6ac8b967999b155ea0eca31454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 31 Oct 2017 17:28:30 +0100 Subject: [PATCH] Add Option to hide Gajim on pressing close This also adds that Gajim gets present if Gajim is launched a second time --- gajim/common/config.py | 1 + gajim/gajim.py | 3 +++ gajim/roster_window.py | 10 ++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gajim/common/config.py b/gajim/common/config.py index c805f97ae..63256e84b 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -237,6 +237,7 @@ class Config: 'notification_position_y': [opt_int, -1], 'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')], 'quit_on_roster_x_button': [opt_bool, False, _('If True, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if notification icon is used.')], + 'hide_on_roster_x_button': [opt_bool, False, _('If True, Gajim hides the Roster window on pressing the X button instead of minimizing into the Dock.')], 'show_unread_tab_icon': [opt_bool, False, _('If True, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')], 'show_status_msgs_in_roster': [opt_bool, True, _('If True, Gajim will display the status message, if not empty, for every contact under the contact name in roster window.'), True], 'show_avatars_in_roster': [opt_bool, True, '', True], diff --git a/gajim/gajim.py b/gajim/gajim.py index a40814d2f..dcd0998da 100644 --- a/gajim/gajim.py +++ b/gajim/gajim.py @@ -224,6 +224,9 @@ class GajimApplication(Gtk.Application): self.set_menubar(menubar) def _activate(self, application): + if self.interface is not None: + self.interface.roster.window.present() + return from gajim.gui_interface import Interface from gajim import gtkgui_helpers self.interface = Interface() diff --git a/gajim/roster_window.py b/gajim/roster_window.py index 0d09827c0..e64fc767d 100644 --- a/gajim/roster_window.py +++ b/gajim/roster_window.py @@ -2406,7 +2406,10 @@ class RosterWindow: x, y = self.window.get_position() app.config.set('roster_x-position', x) app.config.set('roster_y-position', y) - self.window.iconify() + if app.config.get('hide_on_roster_x_button'): + self.window.hide() + else: + self.window.iconify() elif app.config.get('quit_on_roster_x_button'): self.on_quit_request() else: @@ -3755,7 +3758,10 @@ class RosterWindow: 'quit_on_roster_x_button') and ((app.interface.systray_enabled and\ app.config.get('trayicon') == 'always') or app.config.get( 'allow_hide_roster')): - self.window.iconify() + if app.config.get('hide_on_roster_x_button'): + self.window.hide() + else: + self.window.iconify() elif event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == \ Gdk.KEY_i: treeselection = self.tree.get_selection()