Add Option to hide Gajim on pressing close

This also adds that Gajim gets present if Gajim is launched a second time
This commit is contained in:
Philipp Hörist 2017-10-31 17:28:30 +01:00
parent a7e53eb04b
commit 1b9c5066f5
3 changed files with 12 additions and 2 deletions

View File

@ -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],

View File

@ -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()

View File

@ -2406,6 +2406,9 @@ class RosterWindow:
x, y = self.window.get_position()
app.config.set('roster_x-position', x)
app.config.set('roster_y-position', y)
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()
@ -3755,6 +3758,9 @@ 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')):
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: