[shotwell] Remove deprecated GSettings calls
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Remove deprecated GSettings calls
- Date: Sat, 8 Oct 2016 14:29:41 +0000 (UTC)
commit 1b73d9e16be8a73193062507c01877a937b305fc
Author: Jens Georg <mail jensge org>
Date: Tue Oct 4 22:29:45 2016 +0200
Remove deprecated GSettings calls
Signed-off-by: Jens Georg <mail jensge org>
common.am | 2 +-
configure.ac | 2 +-
src/config/GSettingsEngine.vala | 26 ++++++--------------------
3 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/common.am b/common.am
index 353b181..20a66c6 100644
--- a/common.am
+++ b/common.am
@@ -1,7 +1,7 @@
# --enable-checking needs to come first to not trigger
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18734
COMMON_VALAFLAGS = \
- --enable-checking --target-glib=2.32 --thread --fatal-warnings \
+ --enable-checking --target-glib=2.40 --thread --fatal-warnings \
--enable-experimental --enable-deprecated
COMMON_CFLAGS = \
diff --git a/configure.ac b/configure.ac
index 05364a3..0108f6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,7 @@ PKG_CHECK_MODULES(SHOTWELL, [
gee-0.8 >= 0.8.5
gexiv2 >= 0.10.4
gio-unix-2.0 >= 2.20
- glib-2.0 >= 2.30.0
+ glib-2.0 >= 2.40.0
gmodule-2.0 >= 2.24.0
gstreamer-1.0 >= 1.0.0
gstreamer-base-1.0 >= 1.0.0
diff --git a/src/config/GSettingsEngine.vala b/src/config/GSettingsEngine.vala
index 6329b78..daee354 100644
--- a/src/config/GSettingsEngine.vala
+++ b/src/config/GSettingsEngine.vala
@@ -22,16 +22,10 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private const string PLUGINS_ENABLE_DISABLE_SCHEMA_NAME = ROOT_SCHEMA_NAME +
".plugins.enable-state";
- private Gee.Set<string> known_schemas;
private string[] schema_names;
private string[] key_names;
public GSettingsConfigurationEngine() {
- known_schemas = new Gee.HashSet<string>();
-
- foreach (string current_schema in Settings.list_schemas())
- known_schemas.add(current_schema);
-
schema_names = new string[ConfigurableProperty.NUM_PROPERTIES];
schema_names[ConfigurableProperty.AUTO_IMPORT_FROM_LIBRARY] = FILES_PREFS_SCHEMA_NAME;
@@ -164,23 +158,15 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names[ConfigurableProperty.USE_LOWERCASE_FILENAMES] = "use-lowercase-filenames";
key_names[ConfigurableProperty.VIDEO_INTERPRETER_STATE_COOKIE] = "interpreter-state-cookie";
}
-
- private bool schema_has_key(Settings schema_object, string key) {
- foreach (string current_key in schema_object.list_keys()) {
- if (current_key == key)
- return true;
- }
-
- return false;
- }
-
+
private void check_key_valid(string schema, string key) throws ConfigurationError {
- if (!known_schemas.contains(schema))
+ var schema_source = SettingsSchemaSource.get_default ();
+ var settings_scheme = schema_source.lookup (schema, true);
+ if (settings_scheme == null) {
throw new ConfigurationError.ENGINE_ERROR("schema '%s' is not installed".printf(schema));
+ }
- Settings schema_object = new Settings(schema);
-
- if (!schema_has_key(schema_object, key))
+ if (!settings_scheme.has_key (key))
throw new ConfigurationError.ENGINE_ERROR("schema '%s' does not define key '%s'".printf(
schema, key));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]