Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
185e1b93
by lovetox at 2020-07-31T15:02:23+02:00
-
347fbb83
by lovetox at 2020-07-31T15:02:45+02:00
-
309cd5b7
by lovetox at 2020-07-31T15:14:22+02:00
4 changed files:
- gajim/common/config.py
- gajim/data/gui/preferences_window.ui
- gajim/gtk/preferences.py
- gajim/message_window.py
Changes:
| ... | ... | @@ -54,9 +54,6 @@ opt_int = ['integer', 0] |
| 54 | 54 |
opt_str = ['string', 0]
|
| 55 | 55 |
opt_bool = ['boolean', 0]
|
| 56 | 56 |
opt_color = ['color', r'(#[0-9a-fA-F]{6})|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)']
|
| 57 |
-opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype']
|
|
| 58 |
-opt_show_roster_on_startup = ['always', 'never', 'last_state']
|
|
| 59 |
-opt_treat_incoming_messages = ['', 'chat', 'normal']
|
|
| 60 | 57 |
|
| 61 | 58 |
|
| 62 | 59 |
class Config:
|
| ... | ... | @@ -61,24 +61,31 @@ |
| 61 | 61 |
</object>
|
| 62 | 62 |
<object class="GtkListStore" id="one_window_type_liststore">
|
| 63 | 63 |
<columns>
|
| 64 |
- <!-- column-name item -->
|
|
| 64 |
+ <!-- column-name text -->
|
|
| 65 |
+ <column type="gchararray"/>
|
|
| 66 |
+ <!-- column-name setting -->
|
|
| 65 | 67 |
<column type="gchararray"/>
|
| 66 | 68 |
</columns>
|
| 67 | 69 |
<data>
|
| 68 | 70 |
<row>
|
| 69 | 71 |
<col id="0" translatable="yes">Detached contact list with detached chats</col>
|
| 72 |
+ <col id="1">never</col>
|
|
| 70 | 73 |
</row>
|
| 71 | 74 |
<row>
|
| 72 | 75 |
<col id="0" translatable="yes">Detached contact list with single chat</col>
|
| 76 |
+ <col id="1">always</col>
|
|
| 73 | 77 |
</row>
|
| 74 | 78 |
<row>
|
| 75 | 79 |
<col id="0" translatable="yes">Single window for everything</col>
|
| 80 |
+ <col id="1">always_with_roster</col>
|
|
| 76 | 81 |
</row>
|
| 77 | 82 |
<row>
|
| 78 | 83 |
<col id="0" translatable="yes">Detached contact list with chat grouped by account</col>
|
| 84 |
+ <col id="1" translatable="yes">peracct</col>
|
|
| 79 | 85 |
</row>
|
| 80 | 86 |
<row>
|
| 81 | 87 |
<col id="0" translatable="yes">Detached contact list with chat grouped by type</col>
|
| 88 |
+ <col id="1">pertype</col>
|
|
| 82 | 89 |
</row>
|
| 83 | 90 |
</data>
|
| 84 | 91 |
</object>
|
| ... | ... | @@ -112,18 +119,23 @@ |
| 112 | 119 |
</object>
|
| 113 | 120 |
<object class="GtkListStore" id="show_roster_on_startup_liststore">
|
| 114 | 121 |
<columns>
|
| 115 |
- <!-- column-name item -->
|
|
| 122 |
+ <!-- column-name text -->
|
|
| 123 |
+ <column type="gchararray"/>
|
|
| 124 |
+ <!-- column-name setting -->
|
|
| 116 | 125 |
<column type="gchararray"/>
|
| 117 | 126 |
</columns>
|
| 118 | 127 |
<data>
|
| 119 | 128 |
<row>
|
| 120 | 129 |
<col id="0" translatable="yes">Always</col>
|
| 130 |
+ <col id="1">always</col>
|
|
| 121 | 131 |
</row>
|
| 122 | 132 |
<row>
|
| 123 | 133 |
<col id="0" translatable="yes">Never</col>
|
| 134 |
+ <col id="1">never</col>
|
|
| 124 | 135 |
</row>
|
| 125 | 136 |
<row>
|
| 126 | 137 |
<col id="0" translatable="yes">Last state</col>
|
| 138 |
+ <col id="1">last_state</col>
|
|
| 127 | 139 |
</row>
|
| 128 | 140 |
</data>
|
| 129 | 141 |
</object>
|
| ... | ... | @@ -257,6 +269,7 @@ |
| 257 | 269 |
<property name="visible">True</property>
|
| 258 | 270 |
<property name="can_focus">False</property>
|
| 259 | 271 |
<property name="model">one_window_type_liststore</property>
|
| 272 |
+ <property name="id_column">1</property>
|
|
| 260 | 273 |
<signal name="changed" handler="on_one_window_type_combo_changed" swapped="no"/>
|
| 261 | 274 |
<child>
|
| 262 | 275 |
<object class="GtkCellRendererText"/>
|
| ... | ... | @@ -275,6 +288,7 @@ |
| 275 | 288 |
<property name="visible">True</property>
|
| 276 | 289 |
<property name="can_focus">False</property>
|
| 277 | 290 |
<property name="model">show_roster_on_startup_liststore</property>
|
| 291 |
+ <property name="id_column">1</property>
|
|
| 278 | 292 |
<signal name="changed" handler="on_show_roster_on_startup_changed" swapped="no"/>
|
| 279 | 293 |
<child>
|
| 280 | 294 |
<object class="GtkCellRendererText"/>
|
| ... | ... | @@ -29,7 +29,6 @@ except Exception: |
| 29 | 29 |
from gajim.common import app
|
| 30 | 30 |
from gajim.common import configpaths
|
| 31 | 31 |
from gajim.common import helpers
|
| 32 |
-from gajim.common import config as c_config
|
|
| 33 | 32 |
from gajim.common import idle
|
| 34 | 33 |
from gajim.common.nec import NetworkEvent
|
| 35 | 34 |
from gajim.common.i18n import _
|
| ... | ... | @@ -69,20 +68,12 @@ class Preferences(Gtk.ApplicationWindow): |
| 69 | 68 |
### General tab ###
|
| 70 | 69 |
## Behavior of Windows and Tabs
|
| 71 | 70 |
# Set default for single window type
|
| 72 |
- choices = c_config.opt_one_window_types
|
|
| 73 |
- type_ = app.config.get('one_message_window')
|
|
| 74 |
- if type_ in choices:
|
|
| 75 |
- self._ui.one_window_type_combobox.set_active(choices.index(type_))
|
|
| 76 |
- else:
|
|
| 77 |
- self._ui.one_window_type_combobox.set_active(0)
|
|
| 71 |
+ self._ui.one_window_type_combobox.set_active_id(
|
|
| 72 |
+ app.config.get('one_message_window'))
|
|
| 78 | 73 |
|
| 79 | 74 |
# Show roster on startup
|
| 80 |
- choices = c_config.opt_show_roster_on_startup
|
|
| 81 |
- type_ = app.config.get('show_roster_on_startup')
|
|
| 82 |
- if type_ in choices:
|
|
| 83 |
- self._ui.show_roster_on_startup.set_active(choices.index(type_))
|
|
| 84 |
- else:
|
|
| 85 |
- self._ui.show_roster_on_startup.set_active(0)
|
|
| 75 |
+ self._ui.show_roster_on_startup.set_active_id(
|
|
| 76 |
+ app.config.get('show_roster_on_startup'))
|
|
| 86 | 77 |
|
| 87 | 78 |
# Quit on roster x
|
| 88 | 79 |
st = app.config.get('quit_on_roster_x_button')
|
| ... | ... | @@ -499,16 +490,12 @@ class Preferences(Gtk.ApplicationWindow): |
| 499 | 490 |
yield ctrl
|
| 500 | 491 |
|
| 501 | 492 |
### General tab ###
|
| 502 |
- def on_one_window_type_combo_changed(self, widget):
|
|
| 503 |
- active = widget.get_active()
|
|
| 504 |
- config_type = c_config.opt_one_window_types[active]
|
|
| 505 |
- app.config.set('one_message_window', config_type)
|
|
| 493 |
+ def on_one_window_type_combo_changed(self, combobox):
|
|
| 494 |
+ app.config.set('one_message_window', combobox.get_active_id())
|
|
| 506 | 495 |
app.interface.msg_win_mgr.reconfig()
|
| 507 | 496 |
|
| 508 |
- def on_show_roster_on_startup_changed(self, widget):
|
|
| 509 |
- active = widget.get_active()
|
|
| 510 |
- config_type = c_config.opt_show_roster_on_startup[active]
|
|
| 511 |
- app.config.set('show_roster_on_startup', config_type)
|
|
| 497 |
+ def on_show_roster_on_startup_changed(self, combobox):
|
|
| 498 |
+ app.config.set('show_roster_on_startup', combobox.get_active_id())
|
|
| 512 | 499 |
|
| 513 | 500 |
def on_quit_on_roster_x_checkbutton_toggled(self, widget):
|
| 514 | 501 |
self.on_checkbutton_toggled(widget, 'quit_on_roster_x_button')
|
| ... | ... | @@ -31,7 +31,6 @@ from gi.repository import GObject |
| 31 | 31 |
from gi.repository import GLib
|
| 32 | 32 |
from gi.repository import Gio
|
| 33 | 33 |
|
| 34 |
-from gajim import common
|
|
| 35 | 34 |
from gajim.common import app
|
| 36 | 35 |
from gajim.common import ged
|
| 37 | 36 |
from gajim.common.i18n import Q_
|
| ... | ... | @@ -56,7 +55,13 @@ from gajim.gtk.const import ControlType |
| 56 | 55 |
|
| 57 | 56 |
log = logging.getLogger('gajim.message_window')
|
| 58 | 57 |
|
| 59 |
-####################
|
|
| 58 |
+ |
|
| 59 |
+WINDOW_TYPES = ['never',
|
|
| 60 |
+ 'always',
|
|
| 61 |
+ 'always_with_roster',
|
|
| 62 |
+ 'peracct',
|
|
| 63 |
+ 'pertype']
|
|
| 64 |
+ |
|
| 60 | 65 |
|
| 61 | 66 |
class MessageWindow(EventHelper):
|
| 62 | 67 |
"""
|
| ... | ... | @@ -877,7 +882,7 @@ class MessageWindowMgr(GObject.GObject): |
| 877 | 882 |
'window-delete': (GObject.SignalFlags.RUN_LAST, None, (object,)),
|
| 878 | 883 |
}
|
| 879 | 884 |
|
| 880 |
- # These constants map to common.config.opt_one_window_types indices
|
|
| 885 |
+ # These constants map to WINDOW_TYPES indices
|
|
| 881 | 886 |
(
|
| 882 | 887 |
ONE_MSG_WINDOW_NEVER,
|
| 883 | 888 |
ONE_MSG_WINDOW_ALWAYS,
|
| ... | ... | @@ -885,6 +890,7 @@ class MessageWindowMgr(GObject.GObject): |
| 885 | 890 |
ONE_MSG_WINDOW_PERACCT,
|
| 886 | 891 |
ONE_MSG_WINDOW_PERTYPE,
|
| 887 | 892 |
) = range(5)
|
| 893 |
+ |
|
| 888 | 894 |
# A key constant for the main window in ONE_MSG_WINDOW_ALWAYS mode
|
| 889 | 895 |
MAIN_WIN = 'main'
|
| 890 | 896 |
# A key constant for the main window in ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER mode
|
| ... | ... | @@ -904,7 +910,7 @@ class MessageWindowMgr(GObject.GObject): |
| 904 | 910 |
|
| 905 | 911 |
# Map the mode to a int constant for frequent compares
|
| 906 | 912 |
mode = app.config.get('one_message_window')
|
| 907 |
- self.mode = common.config.opt_one_window_types.index(mode)
|
|
| 913 |
+ self.mode = WINDOW_TYPES.index(mode)
|
|
| 908 | 914 |
|
| 909 | 915 |
self.parent_win = parent_window
|
| 910 | 916 |
self.parent_paned = parent_paned
|
| ... | ... | @@ -1198,10 +1204,10 @@ class MessageWindowMgr(GObject.GObject): |
| 1198 | 1204 |
for w in self.windows():
|
| 1199 | 1205 |
self.save_state(w)
|
| 1200 | 1206 |
mode = app.config.get('one_message_window')
|
| 1201 |
- if self.mode == common.config.opt_one_window_types.index(mode):
|
|
| 1207 |
+ if self.mode == WINDOW_TYPES.index(mode):
|
|
| 1202 | 1208 |
# No change
|
| 1203 | 1209 |
return
|
| 1204 |
- self.mode = common.config.opt_one_window_types.index(mode)
|
|
| 1210 |
+ self.mode = WINDOW_TYPES.index(mode)
|
|
| 1205 | 1211 |
|
| 1206 | 1212 |
controls = []
|
| 1207 | 1213 |
for w in self.windows():
|