summaryrefslogtreecommitdiff
path: root/caribou/settings
diff options
context:
space:
mode:
authorEitan Isaacson <eitan@monotonous.org>2011-05-03 16:29:57 -0700
committerEitan Isaacson <eitan@monotonous.org>2011-05-05 15:29:06 -0400
commit39ded91b1ab0cd88a2700c3391a4dfc1d20bb1ed (patch)
treecbab21f60a3c7585851e664e9011041215c5c4ce /caribou/settings
parent66ca73770cb01cd1c48839ca4eeef6bb24a2f300 (diff)
downloadcaribou-39ded91b1ab0cd88a2700c3391a4dfc1d20bb1ed.tar.gz
Add ability to add more than one settings manager
Diffstat (limited to 'caribou/settings')
-rw-r--r--caribou/settings/preferences_window.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/caribou/settings/preferences_window.py b/caribou/settings/preferences_window.py
index 9ca57de..2b6d3ca 100644
--- a/caribou/settings/preferences_window.py
+++ b/caribou/settings/preferences_window.py
@@ -25,17 +25,16 @@ from gi.repository import Gdk
from gi.repository import Gtk
class AbstractPreferencesUI:
- def populate_settings(self, groups):
- notebook = Gtk.Notebook()
- self._populate_settings(notebook, groups)
- if notebook.get_n_pages() == 1:
- notebook.set_show_tabs(False)
-
- return notebook
+ def populate_settings(self, settings_manager):
+ if getattr(self, "notebook", None) is None:
+ self.notebook = Gtk.Notebook()
+ self._populate_settings(self.notebook, settings_manager.groups)
+ self.notebook.set_show_tabs(self.notebook.get_n_pages() != 1)
+
+ return self.notebook
def _populate_settings(self, parent, setting, level=0):
if level == 0:
- self.set_title(setting.label)
for s in setting:
vbox = Gtk.VBox()
parent.append_page(vbox, Gtk.Label(label=s.label))
@@ -234,8 +233,9 @@ class PreferencesDialog(Gtk.Dialog, AbstractPreferencesUI):
gobject.GObject.__init__(self)
self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.set_border_width(6)
+ self.set_title(settings_manager.groups.label)
- notebook = self.populate_settings(settings_manager.groups)
+ notebook = self.populate_settings(settings_manager)
vbox = self.get_content_area()
vbox.add(notebook)
@@ -245,8 +245,9 @@ class PreferencesWindow(Gtk.Window, AbstractPreferencesUI):
def __init__(self, settings_manager):
gobject.GObject.__init__(self)
self.set_border_width(6)
+ self.set_title(settings_manager.groups.label)
- notebook = self.populate_settings(settings_manager.groups)
+ notebook = self.populate_settings(settings_manager)
self.add(notebook)
if __name__ == "__main__":