[meld] settings: Better support loading of arbitrary sub-schemas
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] settings: Better support loading of arbitrary sub-schemas
- Date: Fri, 30 Sep 2016 23:28:46 +0000 (UTC)
commit 9dd06adaee3571e957ff90b204f3a809967727ad
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Oct 1 08:39:57 2016 +1000
settings: Better support loading of arbitrary sub-schemas
We want this so that we can put window state into a subtree.
meld/settings.py | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/meld/settings.py b/meld/settings.py
index 04e49fc..b144aaf 100644
--- a/meld/settings.py
+++ b/meld/settings.py
@@ -81,13 +81,13 @@ class MeldSettings(GObject.GObject):
return Pango.FontDescription(font_string)
-def find_schema():
+def find_schema(schema_id):
schema_source = Gio.SettingsSchemaSource.new_from_directory(
meld.conf.DATADIR,
Gio.SettingsSchemaSource.get_default(),
False,
)
- return schema_source.lookup(MELD_SCHEMA, False)
+ return schema_source.lookup(schema_id, False)
def check_backend():
@@ -100,18 +100,22 @@ def check_backend():
return None
-def create_settings(uninstalled=False):
- global settings, interface_settings, meldsettings
-
+def load_settings_schema(schema_id, uninstalled=False):
backend = check_backend()
if uninstalled:
- schema = find_schema()
+ schema = find_schema(schema_id)
settings = Gio.Settings.new_full(schema, backend, None)
elif backend:
- settings = Gio.Settings.new_with_backend(MELD_SCHEMA, backend)
+ settings = Gio.Settings.new_with_backend(schema_id, backend)
else:
- settings = Gio.Settings.new(MELD_SCHEMA)
+ settings = Gio.Settings.new(schema_id)
+ return settings
+
+
+def create_settings(uninstalled=False):
+ global settings, interface_settings, meldsettings
+ settings = load_settings_schema(MELD_SCHEMA, uninstalled)
interface_settings = Gio.Settings.new('org.gnome.desktop.interface')
meldsettings = MeldSettings()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]