Commit e089f9f6 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist

Themes: Make Add Setting button sensivite in all circumstances

This enabled the user to directly add a setting without having to add
a theme first.
parent 5e018f61
Pipeline #4588 passed with stages
in 2 minutes and 52 seconds
......@@ -185,13 +185,10 @@ class Themes(Gtk.ApplicationWindow):
widgets = ['option_listbox', 'remove_theme_button', 'theme_store',
'theme_treeview', 'choose_option_listbox',
'add_option_button', 'placeholder', 'option_popover']
'placeholder', 'option_popover']
for widget in widgets:
setattr(self, '_%s' % widget, self.builder.get_object(widget))
# Doesnt work if we set it in Glade
self._add_option_button.set_sensitive(False)
self._get_themes()
self._option_listbox.set_placeholder(self._placeholder)
......@@ -243,7 +240,6 @@ class Themes(Gtk.ApplicationWindow):
theme = store[iter_][Column.THEME]
app.css_config.change_preload_theme(theme)
self._add_option_button.set_sensitive(True)
self._remove_theme_button.set_sensitive(True)
self._load_options(theme)
......@@ -260,6 +256,12 @@ class Themes(Gtk.ApplicationWindow):
self._option_listbox.add(row)
def _add_option(self, listbox, row):
# Add theme if there is none
store, iter_ = self._theme_treeview.get_selection().get_selected()
first = store.get_iter_first()
if first is None:
self._on_add_new_theme()
for option in self._option_listbox.get_children():
if option == row:
return
......@@ -326,7 +328,6 @@ class Themes(Gtk.ApplicationWindow):
first = store.get_iter_first()
if first is None:
self._remove_theme_button.set_sensitive(False)
self._add_option_button.set_sensitive(False)
self._clear_options()
text = _('Do you want to delete this theme?')
......
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