diff --git a/data/gui/preferences_window.ui b/data/gui/preferences_window.ui index 155b5e1a1..eeece3f08 100644 --- a/data/gui/preferences_window.ui +++ b/data/gui/preferences_window.ui @@ -107,6 +107,23 @@ + + + + + + + + Always + + + Never + + + Last state + + + 6 Preferences @@ -332,7 +349,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 + 6 2 6 6 @@ -391,8 +408,8 @@ 2 - 2 - 3 + 3 + 4 GTK_FILL @@ -409,8 +426,8 @@ 2 - 3 - 4 + 4 + 5 GTK_FILL @@ -426,8 +443,8 @@ 2 - 4 - 5 + 5 + 6 GTK_FILL @@ -451,6 +468,41 @@ 2 + + + True + 0 + 1 + _Show roster on startup: + True + show_roster_on_startup + + + 2 + 3 + GTK_FILL + + + + + 50 + True + liststore7 + + + + + 0 + + + + + 1 + 2 + 2 + 3 + + diff --git a/src/common/config.py b/src/common/config.py index 20d4272b2..a5f7b3d58 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -52,6 +52,7 @@ opt_str = [ 'string', 0 ] opt_bool = [ 'boolean', 0 ] opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ] opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype'] +opt_show_roster_on_startup = ['always', 'never', 'last_state'] opt_treat_incoming_messages = ['', 'chat', 'normal'] class Config: @@ -171,7 +172,7 @@ class Config: 'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')], 'muc_autorejoin_on_kick': [opt_bool, False, _('Should autorejoin be activated when we are being kicked from a conference?')], 'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')], - 'show_roster_on_startup': [opt_bool, True], + 'last_roster_visible': [opt_bool, True], 'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')], 'version': [ opt_str, defs.version ], # which version created the config 'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'], @@ -244,6 +245,7 @@ class Config: 'one_message_window': [opt_str, 'always', #always, never, peracct, pertype should not be translated _('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'always_with_roster\' - Like \'always\' but the messages are in a single window along with the roster.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g., chats vs. groupchats) are sent to a specific window.')], + 'show_roster_on_startup':[opt_str, 'always', _('Show roster on startup.\n\'always\' - Always show roster.\n\'never\' - Never show roster.\n\'last_state\' - Restore the last state roster.')], 'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window.')], 'escape_key_closes': [opt_bool, True, _('If True, pressing the escape key closes a tab/window.')], 'compact_view': [opt_bool, False, _('Hides the buttons in chat windows.')], diff --git a/src/config.py b/src/config.py index 45468b185..d9b1dd0ec 100644 --- a/src/config.py +++ b/src/config.py @@ -183,6 +183,15 @@ class PreferencesWindow: else: self.one_window_type_combobox.set_active(0) + # Show roster on startup + show_roster_combobox = self.xml.get_object('show_roster_on_startup') + choices = common.config.opt_show_roster_on_startup + type_ = gajim.config.get('show_roster_on_startup') + if type_ in choices: + show_roster_combobox.set_active(choices.index(type_)) + else: + show_roster_combobox.set_active(0) + # Compact View st = gajim.config.get('compact_view') self.xml.get_object('compact_view_checkbutton').set_active(st) @@ -685,6 +694,12 @@ class PreferencesWindow: gajim.interface.save_config() gajim.interface.msg_win_mgr.reconfig() + def on_show_roster_on_startup_changed(self, widget): + active = widget.get_active() + config_type = common.config.opt_show_roster_on_startup[active] + gajim.config.set('show_roster_on_startup', config_type) + gajim.interface.save_config() + def on_compact_view_checkbutton_toggled(self, widget): active = widget.get_active() for ctrl in self._get_all_controls(): diff --git a/src/roster_window.py b/src/roster_window.py index ada5110b6..6202aa74c 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -2349,7 +2349,7 @@ class RosterWindow: # then we want to save (i.e. the window will grow every startup) # so adjust. msgwin_width_adjust = -1 * width - gajim.config.set('show_roster_on_startup', + gajim.config.set('last_roster_visible', self.window.get_property('visible')) gajim.interface.msg_win_mgr.shutdown(msgwin_width_adjust) @@ -6310,13 +6310,17 @@ class RosterWindow: self._toggeling_row = False self.setup_and_draw_roster() - if gajim.config.get('show_roster_on_startup'): + if gajim.config.get('show_roster_on_startup') == 'always': self.window.show_all() - else: + elif gajim.config.get('show_roster_on_startup') == 'never': if gajim.config.get('trayicon') != 'always': # Without trayicon, user should see the roster! self.window.show_all() - gajim.config.set('show_roster_on_startup', True) + gajim.config.set('last_roster_visible', True) + else: + if gajim.config.get('last_roster_visible') or \ + gajim.config.get('trayicon') != 'always': + self.window.show_all() if len(gajim.connections) == 0: # if we have no account def _open_wizard():