Commit b35bd9c0 authored by Daniel Brötzmann's avatar Daniel Brötzmann
Browse files

Themes: Apply user themes instantly

parent bf697b81
Pipeline #7862 passed with stages
in 6 minutes and 46 seconds
......@@ -40,9 +40,10 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="wrap_mode">word</property>
<property name="label" translatable="yes">Add a setting you would like to change</property>
<style>
<class name="bold"/>
<class name="dim-label"/>
</style>
</object>
......
......@@ -206,12 +206,16 @@ def __init__(self, transient):
self._fill_choose_listbox()
def _on_key_press(self, widget, event):
def _on_key_press(self, _widget, event):
if event.keyval == Gdk.KEY_Escape:
self.destroy()
def _get_themes(self):
current_theme = app.settings.get('roster_theme')
for theme in app.css_config.themes:
if theme == current_theme:
self._ui.theme_store.prepend([theme])
continue
self._ui.theme_store.append([theme])
def _on_theme_name_edit(self, _renderer, path, new_name):
......@@ -255,6 +259,8 @@ def _on_theme_selected(self, tree_selection):
self._ui.remove_theme_button.set_sensitive(True)
self._load_options()
self._apply_theme(theme)
app.nec.push_incoming_event(NetworkEvent('style-changed'))
def _load_options(self):
self._ui.option_listbox.foreach(self._remove_option)
......@@ -321,7 +327,8 @@ def _apply_theme(theme):
app.interface.roster.repaint_themed_widgets()
app.interface.roster.change_roster_style(None)
def _update_preferences_window(self):
@staticmethod
def _update_preferences_window():
window = get_app_window('Preferences')
if window is not None:
window.update_theme_list()
......@@ -343,6 +350,7 @@ def _on_remove_theme(self, *args):
def _remove_theme():
if theme == app.settings.get('roster_theme'):
self._apply_theme('default')
app.nec.push_incoming_event(NetworkEvent('style-changed'))
app.css_config.remove_theme(theme)
self._update_preferences_window()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment