changeset 3b09dc50a020 in /home/hg/repos/gajim
author: tmolitor thilo@eightysoft.de branches: details:http://hg.gajim.org/gajim?cmd=changeset;node=3b09dc50a020 description: Minimize groupchats by default, fixes #8369
diffstat:
src/chat_control.py | 22 +++++++++++----------- src/common/config.py | 2 +- src/common/optparser.py | 3 +++ src/groupchat_control.py | 8 ++++---- 4 files changed, 19 insertions(+), 16 deletions(-)
diffs (84 lines):
diff -r 0ec7f92a322b -r 3b09dc50a020 src/chat_control.py --- a/src/chat_control.py Mon Sep 05 16:12:23 2016 +0200 +++ b/src/chat_control.py Mon Sep 05 19:02:43 2016 +0200 @@ -1112,19 +1112,19 @@ """ 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() - if minimize and not self.contact.jid in minimized_gc: - minimized_gc.append(self.contact.jid) - if not minimize and self.contact.jid in minimized_gc: - minimized_gc.remove(self.contact.jid) + if not minimize and not self.contact.jid in non_minimized_gc: + non_minimized_gc.append(self.contact.jid) + if minimize and self.contact.jid in non_minimized_gc: + non_minimized_gc.remove(self.contact.jid) if old_value != minimize: - gajim.config.set_per('accounts', self.account, 'minimized_gc', - ' '.join(minimized_gc)) + gajim.config.set_per('accounts', self.account, 'non_minimized_gc', + ' '.join(non_minimized_gc))
def set_control_active(self, state): if state: diff -r 0ec7f92a322b -r 3b09dc50a020 src/common/config.py --- a/src/common/config.py Mon Sep 05 16:12:23 2016 +0200 +++ b/src/common/config.py Mon Sep 05 19:02:43 2016 +0200 @@ -368,7 +368,7 @@ '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')], '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, '' ], 'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')], 'ping_alives_enabled': [ opt_bool, True, _('XMPP ping sent after inactivity')], diff -r 0ec7f92a322b -r 3b09dc50a020 src/common/optparser.py --- a/src/common/optparser.py Mon Sep 05 16:12:23 2016 +0200 +++ b/src/common/optparser.py Mon Sep 05 19:02:43 2016 +0200 @@ -946,6 +946,9 @@ 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')
+ for account in self.old_values['accounts'].keys(): + gajim.config.del_per('accounts', account, 'minimized_gc') + back = os.getcwd() os.chdir(logger.LOG_DB_FOLDER) con = sqlite.connect(logger.LOG_DB_FILE) diff -r 0ec7f92a322b -r 3b09dc50a020 src/groupchat_control.py --- a/src/groupchat_control.py Mon Sep 05 16:12:23 2016 +0200 +++ b/src/groupchat_control.py Mon Sep 05 19:02:43 2016 +0200 @@ -865,8 +865,8 @@ history_menuitem.add_accelerator('activate', ag, Gdk.KEY_h, Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
- if self.contact.jid in gajim.config.get_per('accounts', self.account, - 'minimized_gc').split(' '): + if self.contact.jid not in gajim.config.get_per('accounts', self.account, + 'non_minimized_gc').split(' '): minimize_menuitem.set_active(True) conn = gajim.connections[self.account] if not conn.private_storage_supported and (not conn.pubsub_supported or \ @@ -2038,8 +2038,8 @@ return 'visitor'
def minimizable(self): - if self.contact.jid in gajim.config.get_per('accounts', self.account, - 'minimized_gc').split(' '): + if self.contact.jid not in gajim.config.get_per('accounts', self.account, + 'non_minimized_gc').split(' '): return True return False