[gnome-tweak-tool] Support using schema paths in GSettings
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Support using schema paths in GSettings
- Date: Mon, 10 Jun 2013 07:09:52 +0000 (UTC)
commit b04ca601f49738f79f066e510ad1b05ef4f5b92b
Author: Joaquim Rocha <jrocha redhat com>
Date: Tue Apr 30 12:51:38 2013 +0200
Support using schema paths in GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=699298
gtweak/gsettings.py | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
index d1b00d5..67e9b89 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -26,6 +26,7 @@ from gi.repository import Gio, GLib
_SCHEMA_CACHE = {}
_GSETTINGS_SCHEMAS = set(Gio.Settings.list_schemas())
+_GSETTINGS_RELOCATABLE_SCHEMAS = set(Gio.Settings.list_relocatable_schemas())
class GSettingsMissingError(Exception):
pass
@@ -111,11 +112,17 @@ class GSettingsFakeSetting:
return noop
class GSettingsSetting(Gio.Settings):
- def __init__(self, schema_name, schema_dir=None, **options):
- if schema_dir is None and schema_name not in _GSETTINGS_SCHEMAS:
- raise GSettingsMissingError(schema_name)
+ def __init__(self, schema_name, schema_dir=None, schema_path=None, **options):
if schema_dir is None:
- Gio.Settings.__init__(self, schema_name)
+ if schema_name not in _GSETTINGS_SCHEMAS and \
+ (schema_path is not None and \
+ schema_name not in _GSETTINGS_RELOCATABLE_SCHEMAS):
+ raise GSettingsMissingError(schema_name)
+
+ if schema_path is None:
+ Gio.Settings.__init__(self, schema_name)
+ else:
+ Gio.Settings.__init__(self, schema_name, path=schema_path)
else:
GioSSS = Gio.SettingsSchemaSource
schema_source = GioSSS.new_from_directory(schema_dir,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]