Philipp Hörist pushed to branch master at gajim / gajim
Commits: 557100e9 by wurstsalat at 2020-08-19T19:13:23+02:00 Preferences: Move 'restore_last_status' to account settings
- - - - - b79430fe by wurstsalat at 2020-08-19T19:18:51+02:00 Preferences: Remove obsolete ListStores
- - - - - f817e7d6 by wurstsalat at 2020-08-19T19:20:37+02:00 Preferences: Remove obsolete per-account config methods
- - - - -
3 changed files:
- gajim/data/gui/preferences_window.ui - gajim/gtk/accounts.py - gajim/gtk/preferences.py
Changes:
===================================== gajim/data/gui/preferences_window.ui ===================================== @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.36.0 --> <interface> <requires lib="gtk+" version="3.22"/> <object class="GtkAdjustment" id="adjustment_status_auto_away"> @@ -16,32 +16,6 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkListStore" id="applications_liststore"> - <columns> - <!-- column-name item --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">Use default applications</col> - </row> - <row> - <col id="0" translatable="yes">Custom</col> - </row> - </data> - </object> - <object class="GtkListStore" id="default_message_liststore"> - <columns> - <!-- column-name status_ --> - <column type="gchararray"/> - <!-- column-name status --> - <column type="gchararray"/> - <!-- column-name defaultmsg --> - <column type="gchararray"/> - <!-- column-name enabled --> - <column type="gboolean"/> - </columns> - </object> <object class="GtkListStore" id="on_event_received_liststore"> <columns> <!-- column-name item --> @@ -139,24 +113,6 @@ </row> </data> </object> - <object class="GtkListStore" id="status_message_liststore"> - <columns> - <!-- column-name name --> - <column type="gchararray"/> - <!-- column-name text --> - <column type="gchararray"/> - <!-- column-name activity --> - <column type="gchararray"/> - <!-- column-name sub_activity --> - <column type="gchararray"/> - <!-- column-name activity_text --> - <column type="gchararray"/> - <!-- column-name mood --> - <column type="gchararray"/> - <!-- column-name mood_text --> - <column type="gchararray"/> - </columns> - </object> <object class="GtkListStore" id="sync_threshold_liststore"> <columns> <!-- column-name days --> @@ -1276,57 +1232,6 @@ <property name="border_width">18</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <child> - <object class="GtkFrame"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> - <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">6</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkCheckButton" id="restore_last_status_checkbutton"> - <property name="label" translatable="yes">_Remember last status</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, the status and status message used in the last session will be restored</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_restore_last_status_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">General</property> - <property name="use_markup">True</property> - <style> - <class name="bold"/> - <class name="margin-top6"/> - </style> - </object> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> <child> <object class="GtkFrame"> <property name="visible">True</property>
===================================== gajim/gtk/accounts.py ===================================== @@ -635,6 +635,11 @@ class GeneralPage(GenericSettingPage): SettingType.ACCOUNT_CONFIG, 'sync_with_global_status', desc=_('Synchronise the status of all accounts')),
+ Setting(SettingKind.SWITCH, _('Remember Last Status'), + SettingType.ACCOUNT_CONFIG, 'restore_last_status', + desc=_('Restore status and status message of your ' + 'last session')), + Setting(SettingKind.SWITCH, _('Use file transfer proxies'), SettingType.ACCOUNT_CONFIG, 'use_ft_proxies'), ]
===================================== gajim/gtk/preferences.py ===================================== @@ -257,13 +257,6 @@ class Preferences(Gtk.ApplicationWindow): if not idle.Monitor.is_available(): self._ui.autoaway_table.set_sensitive(False)
- # Restore last status - st = self.get_per_account_option('restore_last_status') - if st == 'mixed': - self._ui.restore_last_status_checkbutton.set_inconsistent(True) - else: - self._ui.restore_last_status_checkbutton.set_active(st) - # Ask for status when online/offline st = app.config.get('ask_online_status') self._ui.sign_in_status_checkbutton.set_active(st) @@ -427,23 +420,6 @@ class Preferences(Gtk.ApplicationWindow): if event.keyval == Gdk.KEY_Escape: self.destroy()
- def get_per_account_option(self, opt): - """ - Return the value of the option opt if it's the same in all accounts else - returns "mixed" - """ - if not app.connections: - # A non existent key return default value - return app.config.get_per('accounts', '__default__', opt) - val = None - for account in app.connections: - v = app.config.get_per('accounts', account, opt) - if val is None: - val = v - elif val != v: - return 'mixed' - return val - def on_checkbutton_toggled(self, widget, config_name, change_sensitivity_widgets=None): app.config.set(config_name, widget.get_active()) @@ -451,15 +427,6 @@ class Preferences(Gtk.ApplicationWindow): for w in change_sensitivity_widgets: w.set_sensitive(widget.get_active())
- def on_per_account_checkbutton_toggled(self, widget, config_name, - change_sensitivity_widgets=None): - for account in app.connections: - app.config.set_per('accounts', account, config_name, - widget.get_active()) - if change_sensitivity_widgets: - for w in change_sensitivity_widgets: - w.set_sensitive(widget.get_active()) - def _get_all_controls(self): for ctrl in app.interface.msg_win_mgr.get_controls(): yield ctrl @@ -663,10 +630,6 @@ class Preferences(Gtk.ApplicationWindow): def on_auto_xa_message_entry_changed(self, widget): app.config.set('autoxa_message', widget.get_text())
- def on_restore_last_status_checkbutton_toggled(self, widget): - widget.set_inconsistent(False) - self.on_per_account_checkbutton_toggled(widget, 'restore_last_status') - def on_sign_in_status_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'ask_online_status')
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/469c9bef9e91a62935e88d005ae05bf2...