[folks] core: Port to GSettings
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Port to GSettings
- Date: Mon, 23 Apr 2012 09:44:07 +0000 (UTC)
commit 374beb10e0445f1caba9a12cbf61c21938812215
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date: Fri Sep 16 15:15:03 2011 +0100
core: Port to GSettings
Drops our dependency on GConf, but bumps our GLib dependency to 2.26.0.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=647909
NEWS | 3 ++
configure.ac | 11 +++++--
docs/Makefile.am | 4 --
folks/Makefile.am | 20 ++++++++++--
folks/folks.convert | 2 +
folks/individual-aggregator.vala | 42 ++++++++++---------------
folks/org.freedesktop.folks.gschema.xml.in.in | 12 +++++++
folks/persona-store.vala | 2 +-
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
10 files changed, 62 insertions(+), 36 deletions(-)
---
diff --git a/NEWS b/NEWS
index b901782..d668951 100644
--- a/NEWS
+++ b/NEWS
@@ -3,9 +3,12 @@ Overview of changes from libfolks 0.7.0 to libfolks 0.7.1
Dependencies:
â telepathy-glib â 0.17.5
+â GLib â 2.26.0
+â GConf dependency dropped
Bugs fixed:
â Bug 674256 â telepathy-glib minimal version is insufficient
+â Bug 647909 â Port Folks to GSettings
Overview of changes from libfolks 0.6.9 to libfolks 0.7.0
=========================================================
diff --git a/configure.ac b/configure.ac
index 3733be2..0592fad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,7 @@ AM_PROG_CC_C_O
AC_DISABLE_STATIC
LT_INIT
PKG_PROG_PKG_CONFIG([0.21])
+GLIB_GSETTINGS
AC_SUBST([CFLAGS])
AC_SUBST([CPPFLAGS])
@@ -144,13 +145,12 @@ AM_CONDITIONAL([ENABLE_LIBSOCIALWEB],
# Dependencies
# -----------------------------------------------------------
-GLIB_REQUIRED=2.24.0
+GLIB_REQUIRED=2.26.0
TP_GLIB_REQUIRED=0.17.5
VALA_REQUIRED=0.15.2
VALADOC_REQUIRED=0.3.1
TRACKER_SPARQL_MAJOR=0.14
TRACKER_SPARQL_REQUIRED=0.13.1
-GCONF2_REQUIRED=2.31
EBOOK_REQUIRED=3.1.5
EDATASERVER_REQUIRED=3.1.5
@@ -162,7 +162,6 @@ PKG_CHECK_MODULES([GLIB],
PKG_CHECK_MODULES([GMODULE], [gmodule-no-export-2.0])
PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_REQUIRED])
PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
-PKG_CHECK_MODULES([GCONF2], [gconf-2.0 >= $GCONF2_REQUIRED])
# FIXME: We depend on libgee < 0.7 because 0.7 breaks API. bgo#627746
PKG_CHECK_MODULES([GEE], [gee-1.0 < 0.7],
@@ -507,6 +506,11 @@ AC_SUBST([ERROR_VALAFLAGS])
# Final output
# -----------------------------------------------------------
+# FIXME: We can't remove gconf.path until bgo#635379 is fixed, since we need to
+# safely contain EDS' use of GConf for the EDS backend tests.
+# Note that our use of gconf.path doesn't actually need GConf to be installed,
+# though, so it's not a hard dependency of folks.
+
AC_CONFIG_FILES([
backends/telepathy/lib/folks-telepathy.pc
backends/telepathy/lib/folks-telepathy-uninstalled.pc
@@ -517,6 +521,7 @@ AC_CONFIG_FILES([
backends/eds/lib/folks-eds-uninstalled.pc
folks/folks.pc
folks/folks-uninstalled.pc
+ folks/org.freedesktop.folks.gschema.xml.in
Makefile
backends/Makefile
backends/key-file/Makefile
diff --git a/docs/Makefile.am b/docs/Makefile.am
index ebfda76..f3818fa 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -77,7 +77,6 @@ folks_doc_files = \
$(sort \
$(filter-out $(folks_doc_files_blacklist),$(folks_doc_files_all)))
folks_doc_deps = \
- gconf-2.0 \
gmodule-2.0 \
gio-2.0 \
gee-1.0 \
@@ -109,7 +108,6 @@ folks-gtk-doc: $(folks_doc_files)
# folks-telepathy documentation
folks_telepathy_doc_files = $(top_srcdir)/backends/telepathy/lib/*.vala
folks_telepathy_doc_deps = \
- gconf-2.0 \
gmodule-2.0 \
gio-2.0 \
gee-1.0 \
@@ -171,7 +169,6 @@ $(folksedsgtkdoc_DATA): folks-eds-gtk-doc
folks_eds_doc_files = $(top_srcdir)/backends/eds/lib/*.vala
folks_eds_doc_deps = \
- gconf-2.0 \
gmodule-2.0 \
gio-2.0 \
gee-1.0 \
@@ -241,7 +238,6 @@ $(folkslibsocialwebgtkdoc_DATA): folks-libsocialweb-gtk-doc
folks_libsocialweb_doc_files = $(top_srcdir)/backends/libsocialweb/lib/*.vala
folks_libsocialweb_doc_deps = \
- gconf-2.0 \
gmodule-2.0 \
gio-2.0 \
gee-1.0 \
diff --git a/folks/Makefile.am b/folks/Makefile.am
index c29d7c4..74e2983 100644
--- a/folks/Makefile.am
+++ b/folks/Makefile.am
@@ -102,7 +102,6 @@ libfolks_la_VALAFLAGS = \
--pkg gmodule-2.0 \
--pkg gio-2.0 \
--pkg gee-1.0 \
- --pkg gconf-2.0 \
--includedir folks \
--vapi folks.vapi \
-H folks.h \
@@ -116,7 +115,6 @@ libfolks_la_CFLAGS = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(GEE_CFLAGS) \
- $(GCONF2_CFLAGS) \
$(NULL)
libfolks_la_LIBADD = \
@@ -125,7 +123,6 @@ libfolks_la_LIBADD = \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
$(GEE_LIBS) \
- $(GCONF2_LIBS) \
libfolks-internal.la \
$(NULL)
@@ -205,4 +202,21 @@ MAINTAINERCLEANFILES += \
$(BUILT_SOURCES) \
$(NULL)
+##################################################
+# GSettings
+##################################################
+
+gsettings_SCHEMAS = org.freedesktop.folks.gschema.xml
+
+ GSETTINGS_RULES@
+ INTLTOOL_XML_NOMERGE_RULE@
+
+# Data migration tool
+convertdir = $(datadir)/GConf/gsettings
+convert_DATA = folks.convert
+
+EXTRA_DIST += $(convert_DATA)
+CLEANFILES += $(gsettings_SCHEMAS)
+GITIGNOREFILES += org.freedesktop.folks.gschema.valid
+
-include $(top_srcdir)/git.mk
diff --git a/folks/folks.convert b/folks/folks.convert
new file mode 100644
index 0000000..8e49cc9
--- /dev/null
+++ b/folks/folks.convert
@@ -0,0 +1,2 @@
+[org.freedesktop.folks]
+primary-store = /system/folks/backends/primary_store
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index fabca54..cfeabff 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -86,8 +86,8 @@ public class Folks.IndividualAggregator : Object
private Debug _debug;
private string _configured_primary_store_type_id;
private string _configured_primary_store_id;
- private static const string _FOLKS_CONFIG_KEY =
- "/system/folks/backends/primary_store";
+ private static const string _FOLKS_GSETTINGS_SCHEMA = "org.freedesktop.folks";
+ private static const string _PRIMARY_STORE_CONFIG_KEY = "primary-store";
/* The number of persona stores and backends we're waiting to become
* quiescent. Once these both reach 0, we should be in a quiescent state.
@@ -108,7 +108,7 @@ public class Folks.IndividualAggregator : Object
private static const uint _QUIESCENT_TIMEOUT = 30; /* seconds */
/* We use this to know if the primary PersonaStore has been explicitly
- * set by the user (either via GConf or an env variable). If that is the
+ * set by the user (either via GSettings or an env variable). If that is the
* case, we don't want to override it with other PersonaStores that
* announce themselves as default (i.e.: default address book from e-d-s). */
private bool _user_configured_primary_store = false;
@@ -148,7 +148,7 @@ public class Folks.IndividualAggregator : Object
* by:
*
* - the FOLKS_PRIMARY_STORE env var (mostly for debugging)
- * - the GConf key set in _FOLKS_CONFIG_KEY (system set store)
+ * - the GSettings key set in `_PRIMARY_STORE_CONFIG_KEY` (system set store)
* - going with the `key-file` or `eds` store as the fall-back option
*
* @since 0.5.0
@@ -326,24 +326,12 @@ public class Folks.IndividualAggregator : Object
this._configured_primary_store_id = "";
}
- try
- {
- unowned GConf.Client client = GConf.Client.get_default ();
- GConf.Value? val = client.get (this._FOLKS_CONFIG_KEY);
- if (val != null)
- {
- string? val_str = ((!) val).get_string ();
-
- if (val_str != null)
- {
- debug ("Setting primary store IDs from GConf.");
- this._configure_primary_store ((!) val_str);
- }
- }
- }
- catch (GLib.Error e)
+ var settings = new Settings (this._FOLKS_GSETTINGS_SCHEMA);
+ var val = settings.get_string (this._PRIMARY_STORE_CONFIG_KEY);
+ if (val != null && val != "")
{
- /* We ignore errors and go with the default store */
+ debug ("Setting primary store IDs from GSettings.");
+ this._configure_primary_store ((!) val);
}
}
@@ -1720,9 +1708,11 @@ public class Folks.IndividualAggregator : Object
throw new IndividualAggregatorError.NO_PRIMARY_STORE (
_("Canât link personas with no primary store.") + "\n" +
_("Persona store â%s:%sâ is configured as primary, but could not be found or failed to load.") + "\n" +
- _("Check the service providing the persona store is running, or change the default store in that service or using the â%sâ GConf key."),
+ _("Check the relevant service is running, or change the default store in that service or using the â%sâ GSettings key."),
this._configured_primary_store_type_id,
- this._configured_primary_store_id, this._FOLKS_CONFIG_KEY);
+ this._configured_primary_store_id,
+ "%s %s".printf (this._FOLKS_GSETTINGS_SCHEMA,
+ this._PRIMARY_STORE_CONFIG_KEY));
}
/* Don't bother linking if it's just one Persona */
@@ -1985,9 +1975,11 @@ public class Folks.IndividualAggregator : Object
throw new IndividualAggregatorError.NO_PRIMARY_STORE (
_("Canât add personas with no primary store.") + "\n" +
_("Persona store â%s:%sâ is configured as primary, but could not be found or failed to load.") + "\n" +
- _("Check the service providing the persona store is running, or change the default store in that service or using the â%sâ GConf key."),
+ _("Check the relevant service is running, or change the default store in that service or using the â%sâ GSettings key."),
this._configured_primary_store_type_id,
- this._configured_primary_store_id, this._FOLKS_CONFIG_KEY);
+ this._configured_primary_store_id,
+ "%s %s".printf (this._FOLKS_GSETTINGS_SCHEMA,
+ this._PRIMARY_STORE_CONFIG_KEY));
}
else if (new_persona == null)
{
diff --git a/folks/org.freedesktop.folks.gschema.xml.in.in b/folks/org.freedesktop.folks.gschema.xml.in.in
new file mode 100644
index 0000000..011051a
--- /dev/null
+++ b/folks/org.freedesktop.folks.gschema.xml.in.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema id="org.freedesktop.folks" path="/org/freedesktop/folks/" gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="primary-store" type="s">
+ <default>''</default>
+ <_summary>Primary store ID</_summary>
+ <_description>The ID of the persona store which folks should use as primary (i.e. to store linking data in).
+ The type ID of the store may optionally be prepended, separated by a colon.
+ For example: âeds:systemâ or âkey-fileâ.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/folks/persona-store.vala b/folks/persona-store.vala
index 06d14c4..4b302da 100644
--- a/folks/persona-store.vala
+++ b/folks/persona-store.vala
@@ -418,7 +418,7 @@ public abstract class Folks.PersonaStore : Object
public abstract string type_id
{
/* Note: the type_id must not contain colons because the primary writeable
- * store is configured, either via GConf or the FOLKS_PRIMARY_STORE
+ * store is configured, either via GSettings or the FOLKS_PRIMARY_STORE
* env variable, with a string of the form 'type_id:store_id'. */
get;
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a0d1025..f872a17 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -21,6 +21,7 @@ folks/individual-aggregator.vala
folks/local-id-details.vala
folks/name-details.vala
folks/note-details.vala
+folks/org.freedesktop.folks.gschema.xml.in.in
folks/phone-details.vala
folks/postal-address-details.vala
folks/role-details.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index a27b962..171ae77 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -20,6 +20,7 @@ folks/individual-aggregator.c
folks/local-id-details.c
folks/name-details.c
folks/note-details.c
+folks/org.freedesktop.folks.gschema.xml.in
folks/phone-details.c
folks/postal-address-details.c
folks/role-details.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]