[gnome-settings-daemon] test-plugin.h: Stop using deprecated GSettings API
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] test-plugin.h: Stop using deprecated GSettings API
- Date: Mon, 26 May 2014 16:10:39 +0000 (UTC)
commit 044c471fae836e9c545e49eeed82bf3e05de664f
Author: Rui Matos <tiagomatos gmail com>
Date: Mon May 26 17:32:53 2014 +0200
test-plugin.h: Stop using deprecated GSettings API
plugins/common/test-plugin.h | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 deletions(-)
---
diff --git a/plugins/common/test-plugin.h b/plugins/common/test-plugin.h
index f2ee501..37ad112 100644
--- a/plugins/common/test-plugin.h
+++ b/plugins/common/test-plugin.h
@@ -34,17 +34,39 @@ static GOptionEntry entries[] = {
};
static gboolean
-has_settings (void)
+contained (char **items,
+ const char *item)
{
- const gchar * const * list;
- guint i;
+ while (*items) {
+ if (g_strcmp0 (*items++, item) == 0) {
+ return TRUE;
+ }
+ }
- list = g_settings_list_schemas ();
- for (i = 0; list[i] != NULL; i++) {
- if (g_str_equal (list[i], "org.gnome.settings-daemon.plugins." SCHEMA_NAME))
- return TRUE;
- }
- return FALSE;
+ return FALSE;
+}
+
+static gboolean
+is_schema (const char *schema)
+{
+ GSettingsSchemaSource *source = NULL;
+ gchar **non_relocatable = NULL;
+ gchar **relocatable = NULL;
+
+ source = g_settings_schema_source_get_default ();
+ if (!source)
+ return FALSE;
+
+ g_settings_schema_source_list_schemas (source, TRUE, &non_relocatable, &relocatable);
+
+ return (contained (non_relocatable, schema) ||
+ contained (relocatable, schema));
+}
+
+static gboolean
+has_settings (void)
+{
+ return is_schema ("org.gnome.settings-daemon.plugins." SCHEMA_NAME);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]