Minimize groupchats by default, fixes #8369

This commit is contained in:
tmolitor 2016-09-05 19:02:43 +02:00
parent efa8bb6598
commit 7950146105
4 changed files with 19 additions and 16 deletions

View File

@ -1112,19 +1112,19 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
""" """
When a grouchat is minimized, unparent the tab, put it in roster etc When a grouchat is minimized, unparent the tab, put it in roster etc
""" """
old_value = False
minimized_gc = gajim.config.get_per('accounts', self.account,
'minimized_gc').split()
if self.contact.jid in minimized_gc:
old_value = True old_value = True
non_minimized_gc = gajim.config.get_per('accounts', self.account,
'non_minimized_gc').split()
if self.contact.jid in non_minimized_gc:
old_value = False
minimize = widget.get_active() minimize = widget.get_active()
if minimize and not self.contact.jid in minimized_gc: if not minimize and not self.contact.jid in non_minimized_gc:
minimized_gc.append(self.contact.jid) non_minimized_gc.append(self.contact.jid)
if not minimize and self.contact.jid in minimized_gc: if minimize and self.contact.jid in non_minimized_gc:
minimized_gc.remove(self.contact.jid) non_minimized_gc.remove(self.contact.jid)
if old_value != minimize: if old_value != minimize:
gajim.config.set_per('accounts', self.account, 'minimized_gc', gajim.config.set_per('accounts', self.account, 'non_minimized_gc',
' '.join(minimized_gc)) ' '.join(non_minimized_gc))
def set_control_active(self, state): def set_control_active(self, state):
if state: if state:

View File

@ -368,7 +368,7 @@ class Config:
'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')], 'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
'sync_logs_with_server': [ opt_bool, True, _('Download logs stored on server on Gajim startup if server supports XEP-0136 or XEP-0313')], 'sync_logs_with_server': [ opt_bool, True, _('Download logs stored on server on Gajim startup if server supports XEP-0136 or XEP-0313')],
'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')], 'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'minimized_gc': [ opt_str, '' ], 'non_minimized_gc': [ opt_str, '' ],
'attached_gpg_keys': [ opt_str, '' ], 'attached_gpg_keys': [ opt_str, '' ],
'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')], 'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')],
'ping_alives_enabled': [ opt_bool, True, _('XMPP ping sent after inactivity')], 'ping_alives_enabled': [ opt_bool, True, _('XMPP ping sent after inactivity')],

View File

@ -946,6 +946,9 @@ class OptionsParser:
if self.old_values['video_input_device'] == 'videotestsrc is-live=true ! video/x-raw-yuv,framerate=10/1': if self.old_values['video_input_device'] == 'videotestsrc is-live=true ! video/x-raw-yuv,framerate=10/1':
gajim.config.set('video_input_device', 'videotestsrc is-live=true ! video/x-raw,framerate=10/1') gajim.config.set('video_input_device', 'videotestsrc is-live=true ! video/x-raw,framerate=10/1')
for account in self.old_values['accounts'].keys():
gajim.config.del_per('accounts', account, 'minimized_gc')
back = os.getcwd() back = os.getcwd()
os.chdir(logger.LOG_DB_FOLDER) os.chdir(logger.LOG_DB_FOLDER)
con = sqlite.connect(logger.LOG_DB_FILE) con = sqlite.connect(logger.LOG_DB_FILE)

View File

@ -865,8 +865,8 @@ class GroupchatControl(ChatControlBase):
history_menuitem.add_accelerator('activate', ag, Gdk.KEY_h, history_menuitem.add_accelerator('activate', ag, Gdk.KEY_h,
Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE) Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
if self.contact.jid in gajim.config.get_per('accounts', self.account, if self.contact.jid not in gajim.config.get_per('accounts', self.account,
'minimized_gc').split(' '): 'non_minimized_gc').split(' '):
minimize_menuitem.set_active(True) minimize_menuitem.set_active(True)
conn = gajim.connections[self.account] conn = gajim.connections[self.account]
if not conn.private_storage_supported and (not conn.pubsub_supported or \ if not conn.private_storage_supported and (not conn.pubsub_supported or \
@ -2038,8 +2038,8 @@ class GroupchatControl(ChatControlBase):
return 'visitor' return 'visitor'
def minimizable(self): def minimizable(self):
if self.contact.jid in gajim.config.get_per('accounts', self.account, if self.contact.jid not in gajim.config.get_per('accounts', self.account,
'minimized_gc').split(' '): 'non_minimized_gc').split(' '):
return True return True
return False return False