Port remaining bits from GConf to GSettings
authorMilan Crha <mcrha@redhat.com>
Thu, 14 Jun 2012 08:40:10 +0000 (10:40 +0200)
committerMilan Crha <mcrha@redhat.com>
Thu, 14 Jun 2012 08:41:28 +0000 (10:41 +0200)
19 files changed:
addressbook/libebook/Makefile.am
addressbook/libebook/e-book-client.c
addressbook/libebook/e-book.c
calendar/backends/caldav/e-cal-backend-caldav.c
calendar/backends/contacts/e-cal-backend-contacts.c
calendar/backends/http/e-cal-backend-http.c
configure.ac
data/Makefile.am
data/evolution-data-server.convert [new file with mode: 0644]
data/org.gnome.Evolution.DefaultSources.gschema.xml.in [moved from data/org.gnome.Evolution.DefaultSources.gschema.xml with 100% similarity]
data/org.gnome.evolution-data-server.addressbook.gschema.xml.in [new file with mode: 0644]
data/org.gnome.evolution-data-server.calendar.gschema.xml.in [new file with mode: 0644]
libedataserver/libedataserver.pc.in
libedataserverui/e-name-selector-entry.c
libedataserverui/e-name-selector-entry.h
po/POTFILES.in
services/evolution-addressbook-factory/evolution-addressbook-factory.c
services/evolution-calendar-factory/evolution-calendar-factory.c
tests/libedataserverui/test-contact-store.c

index 1ac744c..d7dd438 100644 (file)
@@ -105,10 +105,8 @@ EBook_1_2_gir_INCLUDES = GObject-2.0 GLib-2.0 libxml2-2.0 \
        Gio-2.0 \
        $(NULL)
 libxml_include = `$(PKG_CONFIG) --cflags libxml-2.0`
-gconf_include = `$(PKG_CONFIG) --cflags gconf-2.0`
 EBook_1_2_gir_CFLAGS = $(INCLUDES) \
                       $(libxml_include) \
-                      $(gconf_include) \
                       -I$(top_srcdir) \
                       -I$(top_builddir) \
                       -I$(top_srcdir)/addressbook/ \
index 3400605..ccf5db1 100644 (file)
@@ -26,8 +26,6 @@
 #include <glib/gi18n-lib.h>
 #include <gio/gio.h>
 
-#include <gconf/gconf-client.h>
-
 #include <libedataserver/libedataserver.h>
 #include <libedataserver/e-client-private.h>
 
@@ -550,7 +548,8 @@ e_book_client_new (ESource *source,
        return client;
 }
 
-#define SELF_UID_KEY "/apps/evolution/addressbook/self/self_uid"
+#define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook"
+#define SELF_UID_KEY "self-contact-uid"
 
 static EContact *
 make_me_card (void)
@@ -611,7 +610,7 @@ e_book_client_get_self (ESourceRegistry *registry,
 {
        ESource *source;
        GError *local_error = NULL;
-       GConfClient *gconf;
+       GSettings *settings;
        gchar *uid;
 
        g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
@@ -635,9 +634,9 @@ e_book_client_get_self (ESourceRegistry *registry,
                return FALSE;
        }
 
-       gconf = gconf_client_get_default ();
-       uid = gconf_client_get_string (gconf, SELF_UID_KEY, NULL);
-       g_object_unref (gconf);
+       settings = g_settings_new (SELF_UID_PATH_ID);
+       uid = g_settings_get_string (settings, SELF_UID_KEY);
+       g_object_unref (settings);
 
        if (uid) {
                gboolean got;
@@ -688,15 +687,15 @@ e_book_client_set_self (EBookClient *client,
                         EContact *contact,
                         GError **error)
 {
-       GConfClient *gconf;
+       GSettings *settings;
 
        g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
        g_return_val_if_fail (contact != NULL, FALSE);
        g_return_val_if_fail (e_contact_get_const (contact, E_CONTACT_UID) != NULL, FALSE);
 
-       gconf = gconf_client_get_default ();
-       gconf_client_set_string (gconf, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID), NULL);
-       g_object_unref (gconf);
+       settings = g_settings_new (SELF_UID_PATH_ID);
+       g_settings_set_string (settings, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID));
+       g_object_unref (settings);
 
        return TRUE;
 }
@@ -714,15 +713,15 @@ e_book_client_set_self (EBookClient *client,
 gboolean
 e_book_client_is_self (EContact *contact)
 {
-       GConfClient *gconf;
+       GSettings *settings;
        gchar *uid;
        gboolean is_self;
 
        g_return_val_if_fail (contact && E_IS_CONTACT (contact), FALSE);
 
-       gconf = gconf_client_get_default ();
-       uid = gconf_client_get_string (gconf, SELF_UID_KEY, NULL);
-       g_object_unref (gconf);
+       settings = g_settings_new (SELF_UID_PATH_ID);
+       uid = g_settings_get_string (settings, SELF_UID_KEY);
+       g_object_unref (settings);
 
        is_self = uid && !g_strcmp0 (uid, e_contact_get_const (contact, E_CONTACT_UID));
 
index e1d9423..16df768 100644 (file)
@@ -38,7 +38,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
 #include "e-book.h"
 #include "e-error.h"
 #include "e-contact.h"
@@ -2721,7 +2720,8 @@ e_book_is_online (EBook *book)
        return book->priv->connected;
 }
 
-#define SELF_UID_KEY "/apps/evolution/addressbook/self/self_uid"
+#define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook"
+#define SELF_UID_KEY "self-contact-uid"
 
 static EContact *
 make_me_card (void)
@@ -2782,7 +2782,7 @@ e_book_get_self (ESourceRegistry *registry,
 {
        ESource *source;
        GError *e = NULL;
-       GConfClient *gconf;
+       GSettings *settings;
        gboolean status;
        gchar *uid;
 
@@ -2807,9 +2807,9 @@ e_book_get_self (ESourceRegistry *registry,
                return FALSE;
        }
 
-       gconf = gconf_client_get_default ();
-       uid = gconf_client_get_string (gconf, SELF_UID_KEY, NULL);
-       g_object_unref (gconf);
+       settings = g_settings_new (SELF_UID_PATH_ID);
+       uid = g_settings_get_string (settings, SELF_UID_KEY);
+       g_object_unref (settings);
 
        if (uid) {
                gboolean got;
@@ -2856,14 +2856,14 @@ e_book_set_self (EBook *book,
                  EContact *contact,
                  GError **error)
 {
-       GConfClient *gconf;
+       GSettings *settings;
 
        g_return_val_if_fail (E_IS_BOOK (book), FALSE);
        g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
 
-       gconf = gconf_client_get_default ();
-       gconf_client_set_string (gconf, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID), NULL);
-       g_object_unref (gconf);
+       settings = g_settings_new (SELF_UID_PATH_ID);
+       g_settings_set_string (settings, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID));
+       g_object_unref (settings);
 
        return TRUE;
 }
@@ -2881,7 +2881,7 @@ e_book_set_self (EBook *book,
 gboolean
 e_book_is_self (EContact *contact)
 {
-       GConfClient *gconf;
+       GSettings *settings;
        gchar *uid;
        gboolean rv;
 
@@ -2889,9 +2889,9 @@ e_book_is_self (EContact *contact)
         * need a GError arg for that */
        g_return_val_if_fail (contact && E_IS_CONTACT (contact), FALSE);
 
-       gconf = gconf_client_get_default ();
-       uid = gconf_client_get_string (gconf, SELF_UID_KEY, NULL);
-       g_object_unref (gconf);
+       settings = g_settings_new (SELF_UID_PATH_ID);
+       uid = g_settings_get_string (settings, SELF_UID_KEY);
+       g_object_unref (settings);
 
        rv = (uid && !strcmp (uid, e_contact_get_const (contact, E_CONTACT_UID)));
 
index 91a9c58..a1e4db6 100644 (file)
@@ -25,7 +25,6 @@
 #include <config.h>
 #include <string.h>
 #include <unistd.h>
-#include <gconf/gconf-client.h>
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
index 62077f5..c46cd5c 100644 (file)
@@ -31,7 +31,6 @@
 #include "e-cal-backend-contacts.h"
 
 #include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
 #include <libsoup/soup.h>
 
 #include <libebook/libebook.h>
@@ -69,10 +68,8 @@ struct _ECalBackendContactsPrivate {
        GHashTable *zones;
 
        /* properties related to track alarm settings for this backend */
-       GConfClient *conf_client;
-       guint notifyid1;
-       guint notifyid2;
-       guint notifyid3;
+       GSettings *settings;
+       guint notifyid;
        guint update_alarms_id;
        gboolean alarm_enabled;
        gint alarm_interval;
@@ -743,16 +740,24 @@ update_tracked_alarms_cb (gpointer user_data)
        return FALSE;
 }
 
+#define BA_CONF_ENABLED                "contacts-reminder-enabled"
+#define BA_CONF_INTERVAL       "contacts-reminder-interval"
+#define BA_CONF_UNITS          "contacts-reminder-units"
+
 static void
-alarm_config_changed_cb (GConfClient *client,
-                         guint cnxn_id,
-                         GConfEntry *entry,
+alarm_config_changed_cb (GSettings *settings,
+                         const gchar *key,
                          gpointer user_data)
 {
        ECalBackendContacts *cbc = user_data;
 
        g_return_if_fail (cbc != NULL);
 
+       if (g_strcmp0 (key, BA_CONF_ENABLED) != 0 &&
+           g_strcmp0 (key, BA_CONF_INTERVAL) != 0 &&
+           g_strcmp0 (key, BA_CONF_UNITS) != 0)
+               return;
+
        setup_alarm (cbc, NULL);
 
        if (!cbc->priv->update_alarms_id)
@@ -773,23 +778,16 @@ setup_alarm (ECalBackendContacts *cbc,
        if (!comp || cbc->priv->alarm_interval == -1) {
                gchar *str;
 
-               #define BA_CONF_DIR             "/apps/evolution/calendar/other"
-               #define BA_CONF_ENABLED         BA_CONF_DIR "/use_ba_reminder"
-               #define BA_CONF_INTERVAL        BA_CONF_DIR "/ba_reminder_interval"
-               #define BA_CONF_UNITS           BA_CONF_DIR "/ba_reminder_units"
-
                if (cbc->priv->alarm_interval == -1) {
                        /* initial setup, hook callback for changes too */
-                       gconf_client_add_dir (cbc->priv->conf_client, BA_CONF_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
-                       cbc->priv->notifyid1 = gconf_client_notify_add (cbc->priv->conf_client, BA_CONF_ENABLED,  alarm_config_changed_cb, cbc, NULL, NULL);
-                       cbc->priv->notifyid2 = gconf_client_notify_add (cbc->priv->conf_client, BA_CONF_INTERVAL, alarm_config_changed_cb, cbc, NULL, NULL);
-                       cbc->priv->notifyid3 = gconf_client_notify_add (cbc->priv->conf_client, BA_CONF_UNITS,    alarm_config_changed_cb, cbc, NULL, NULL);
+                       cbc->priv->notifyid = g_signal_connect (cbc->priv->settings,
+                               "changed", G_CALLBACK (alarm_config_changed_cb), cbc);
                }
 
-               cbc->priv->alarm_enabled = gconf_client_get_bool (cbc->priv->conf_client, BA_CONF_ENABLED, NULL);
-               cbc->priv->alarm_interval = gconf_client_get_int (cbc->priv->conf_client, BA_CONF_INTERVAL, NULL);
+               cbc->priv->alarm_enabled = g_settings_get_boolean (cbc->priv->settings, BA_CONF_ENABLED);
+               cbc->priv->alarm_interval = g_settings_get_int (cbc->priv->settings, BA_CONF_INTERVAL);
 
-               str = gconf_client_get_string (cbc->priv->conf_client, BA_CONF_UNITS, NULL);
+               str = g_settings_get_string (cbc->priv->settings, BA_CONF_UNITS);
                if (str && !strcmp (str, "days"))
                        cbc->priv->alarm_units = CAL_DAYS;
                else if (str && !strcmp (str, "hours"))
@@ -804,11 +802,6 @@ setup_alarm (ECalBackendContacts *cbc,
 
                if (!comp)
                        return;
-
-               #undef BA_CONF_DIR
-               #undef BA_CONF_ENABLED
-               #undef BA_CONF_INTERVAL
-               #undef BA_CONF_UNITS
        }
 
        /* ensure no alarms left */
@@ -853,6 +846,10 @@ setup_alarm (ECalBackendContacts *cbc,
        e_cal_component_alarm_free (alarm);
 }
 
+#undef BA_CONF_ENABLED
+#undef BA_CONF_INTERVAL
+#undef BA_CONF_UNITS
+
 /* Contact -> Event creator */
 static ECalComponent *
 create_component (ECalBackendContacts *cbc,
@@ -1325,14 +1322,10 @@ e_cal_backend_contacts_finalize (GObject *object)
        g_hash_table_destroy (priv->addressbooks);
        g_hash_table_destroy (priv->tracked_contacts);
        g_hash_table_destroy (priv->zones);
-       if (priv->notifyid1)
-               gconf_client_notify_remove (priv->conf_client, priv->notifyid1);
-       if (priv->notifyid2)
-               gconf_client_notify_remove (priv->conf_client, priv->notifyid2);
-       if (priv->notifyid3)
-               gconf_client_notify_remove (priv->conf_client, priv->notifyid3);
-
-       g_object_unref (priv->conf_client);
+       if (priv->notifyid)
+               g_signal_handler_disconnect (priv->settings, priv->notifyid);
+
+       g_object_unref (priv->settings);
        g_mutex_free (priv->mutex);
 
        /* Chain up to parent's finalize() method. */
@@ -1353,6 +1346,7 @@ e_cal_backend_contacts_constructed (GObject *object)
        /* Chain up to parent's constructed() method. */
        G_OBJECT_CLASS (e_cal_backend_contacts_parent_class)->
                constructed (object);
+       setup_alarm (object, NULL);
 }
 
 /* Object initialization function for the contacts backend */
@@ -1381,10 +1375,8 @@ e_cal_backend_contacts_init (ECalBackendContacts *cbc)
                (GDestroyNotify) g_free,
                (GDestroyNotify) free_zone);
 
-       cbc->priv->conf_client = gconf_client_get_default ();
-       cbc->priv->notifyid1 = 0;
-       cbc->priv->notifyid2 = 0;
-       cbc->priv->notifyid3 = 0;
+       cbc->priv->settings = g_settings_new ("org.gnome.evolution-data-server.calendar");
+       cbc->priv->notifyid = 0;
        cbc->priv->update_alarms_id = 0;
        cbc->priv->alarm_enabled = FALSE;
        cbc->priv->alarm_interval = -1;
index 97f05a9..4cfdf37 100644 (file)
@@ -24,7 +24,6 @@
 #include <config.h>
 #include <string.h>
 #include <unistd.h>
-#include <gconf/gconf-client.h>
 #include <glib/gi18n-lib.h>
 
 #include <libsoup/soup.h>
index d4e764a..b11f9cb 100644 (file)
@@ -35,7 +35,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 dnl Required Package Versions
 m4_define([glib_minimum_version], [2.32])
 m4_define([gtk_minimum_version], [3.2])
-m4_define([gconf_minimum_version], [2.0.0])            dnl XXX Just a Guess
 m4_define([gcr_minimum_version], [3.4])
 m4_define([gnome_keyring_minimum_version], [2.20.1])
 m4_define([libxml_minimum_version], [2.0.0])           dnl XXX Just a Guess
@@ -345,7 +344,6 @@ PKG_CHECK_MODULES(GNOME_PLATFORM,
        [gio-2.0 >= glib_minimum_version
        gmodule-2.0 >= glib_minimum_version
        gtk+-3.0 >= gtk_minimum_version
-       gconf-2.0 >= gconf_minimum_version
        libxml-2.0 >= libxml_minimum_version
        libsoup-2.4 >= libsoup_minimum_version
        libgdata >= libgdata_minimum_version])
@@ -354,15 +352,6 @@ if test x$os_win32 = xno; then
        PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
 fi
 
-dnl ******************************
-dnl DBus-glib stuff, to initialize thread for GConf, which is using it
-dnl this is returned back only temporarily and wil lbe removed as soon
-dnl as eds will stop using GConf completely
-dnl ******************************
-PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.6)
-AC_SUBST(DBUS_GLIB_CFLAGS)
-AC_SUBST(DBUS_GLIB_LIBS)
-
 dnl *******************************
 dnl Check for GNOME Online Accounts
 dnl *******************************
@@ -1312,7 +1301,7 @@ PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= sqlite_minimum_version])
 dnl ******************************
 dnl libedataserver flags
 dnl ******************************
-E_DATA_SERVER_DEPS="gio-2.0 gmodule-2.0 gnome-keyring-1 libxml-2.0 libsoup-2.4 gconf-2.0 $mozilla_nspr"
+E_DATA_SERVER_DEPS="gio-2.0 gmodule-2.0 gnome-keyring-1 libxml-2.0 libsoup-2.4 $mozilla_nspr"
 
 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER, $E_DATA_SERVER_DEPS, $MANUAL_NSPR_CFLAGS, $MANUAL_NSPR_LIBS)
 AC_SUBST(E_DATA_SERVER_CFLAGS)
@@ -1321,7 +1310,7 @@ AC_SUBST(E_DATA_SERVER_LIBS)
 dnl ******************************
 dnl libedataserverui
 dnl ******************************
-E_DATA_SERVER_UI_DEPS="gtk+-3.0 libxml-2.0 gconf-2.0 libsoup-2.4"
+E_DATA_SERVER_UI_DEPS="gtk+-3.0 libxml-2.0 libsoup-2.4"
 
 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER_UI, $E_DATA_SERVER_UI_DEPS, , )
 AC_SUBST(E_DATA_SERVER_UI_CFLAGS)
@@ -1334,7 +1323,7 @@ if test "x$enable_maintainer_mode" = "xyes" ; then
        AC_SUBST(FACTORY_GTK_LIBS)
 fi
 
-E_BACKEND_DEPS="gio-2.0 gmodule-2.0 gnome-keyring-1 libsoup-2.4 libxml-2.0 gconf-2.0"
+E_BACKEND_DEPS="gio-2.0 gmodule-2.0 gnome-keyring-1 libsoup-2.4 libxml-2.0"
 
 dnl ******************************
 dnl libebackend flags
@@ -1346,7 +1335,7 @@ AC_SUBST(E_BACKEND_LIBS)
 dnl ******************************
 dnl evolution-addressbook flags
 dnl ******************************
-EVOLUTION_ADDRESSBOOK_DEPS="gio-2.0 libxml-2.0 gconf-2.0 libsoup-2.4 gnome-keyring-1"
+EVOLUTION_ADDRESSBOOK_DEPS="gio-2.0 libxml-2.0 libsoup-2.4 gnome-keyring-1"
 
 EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
 AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
@@ -1355,7 +1344,7 @@ AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
 dnl ******************************
 dnl evolution-calendar flags
 dnl ******************************
-EVOLUTION_CALENDAR_DEPS="gio-2.0 libical >= libical_minimum_version libsoup-2.4 libxml-2.0 gconf-2.0 gnome-keyring-1"
+EVOLUTION_CALENDAR_DEPS="gio-2.0 libical >= libical_minimum_version libsoup-2.4 libxml-2.0 gnome-keyring-1"
 
 dnl *****
 dnl libical.pc from libical-0.43 has a bug in it's CFlags.
@@ -1530,12 +1519,6 @@ EVO_SUBST_SERVICE_RULE='%.service: %.service.in Makefile ; $(AM_V_GEN) sed -e "s
 AC_SUBST(EVO_SUBST_SERVICE_RULE)
 
 dnl ******************************
-dnl GConf stuff
-dnl ******************************
-AC_PATH_PROG(GCONFTOOL, gconftool-2, [no])
-AM_GCONF_SOURCE_2
-
-dnl ******************************
 dnl GLib stuff
 dnl ******************************
 GLIB_GSETTINGS
index a31232a..f209552 100644 (file)
@@ -1,12 +1,20 @@
 SUBDIRS = sources
 
-gsettings_SCHEMAS = \
-       org.gnome.Evolution.DefaultSources.gschema.xml
+gsettings_SCHEMAS =                                            \
+       org.gnome.Evolution.DefaultSources.gschema.xml          \
+       org.gnome.evolution-data-server.calendar.gschema.xml    \
+       org.gnome.evolution-data-server.addressbook.gschema.xml
+
+@INTLTOOL_XML_NOMERGE_RULE@
 
 @GSETTINGS_RULES@
 
-EXTRA_DIST = $(gsettings_SCHEMAS)
+convertdir = $(datadir)/GConf/gsettings
+convert_DATA = evolution-data-server.convert
+
+EXTRA_DIST = $(gsettings_SCHEMAS:.xml=.xml.in) \
+            $(convert_DATA)
 
-CLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
+CLEANFILES = $(gsettings_SCHEMAS)
 
 -include $(top_srcdir)/git.mk
diff --git a/data/evolution-data-server.convert b/data/evolution-data-server.convert
new file mode 100644 (file)
index 0000000..1c39848
--- /dev/null
@@ -0,0 +1,7 @@
+[org.gnome.evolution-data-server.addressbook]
+self-contact-uid = /apps/evolution/addressbook/self/self_uid
+
+[org.gnome.evolution-data-server.calendar]
+contacts-reminder-enabled = /apps/evolution/calendar/other/use_ba_reminder
+contacts-reminder-interval = /apps/evolution/calendar/other/ba_reminder_interval
+contacts-reminder-units = /apps/evolution/calendar/other/ba_reminder_units
diff --git a/data/org.gnome.evolution-data-server.addressbook.gschema.xml.in b/data/org.gnome.evolution-data-server.addressbook.gschema.xml.in
new file mode 100644 (file)
index 0000000..f010d31
--- /dev/null
@@ -0,0 +1,8 @@
+<schemalist>
+  <schema gettext-domain="evolution-data-server" id="org.gnome.evolution-data-server.addressbook" path="/org/gnome/evolution-data-server/addressbook/">
+    <key name="self-contact-uid" type="s">
+      <default>''</default>
+      <_summary>Contact UID of a user</_summary>
+    </key>
+  </schema>
+</schemalist>
diff --git a/data/org.gnome.evolution-data-server.calendar.gschema.xml.in b/data/org.gnome.evolution-data-server.calendar.gschema.xml.in
new file mode 100644 (file)
index 0000000..4f65e01
--- /dev/null
@@ -0,0 +1,19 @@
+<schemalist>
+  <schema gettext-domain="evolution-data-server" id="org.gnome.evolution-data-server.calendar" path="/org/gnome/evolution-data-server/calendar/">
+    <key name="contacts-reminder-enabled" type="b">
+      <default>false</default>
+      <_summary>Birthday and anniversary reminder</_summary>
+      <_description>Whether to set a reminder for birthdays and anniversaries</_description>
+    </key>
+    <key name="contacts-reminder-interval" type="i">
+      <default>15</default>
+      <_summary>Birthday and anniversary reminder value</_summary>
+      <_description>Number of units for determining a birthday or anniversary reminder</_description>
+    </key>
+    <key name="contacts-reminder-units" type="s">
+      <default>'minutes'</default>
+      <_summary>Birthday and anniversary reminder units</_summary>
+      <_description>Units for a birthday or anniversary reminder, "minutes", "hours" or "days"</_description>
+    </key>
+  </schema>
+</schemalist>
index 4cd47bc..d746a19 100644 (file)
@@ -10,6 +10,6 @@ privincludedir=@privincludedir@
 Name: libedataserver
 Description: Utility library for Evolution Data Server
 Version: @VERSION@
-Requires: gio-2.0 gmodule-2.0 camel-1.2 gnome-keyring-1 libxml-2.0 gconf-2.0 libsoup-2.4
+Requires: gio-2.0 gmodule-2.0 camel-1.2 gnome-keyring-1 libxml-2.0 libsoup-2.4
 Libs: -L${libdir} -ledataserver-@API_VERSION@
 Cflags: -I${privincludedir}
index 3abec38..bb3f6b9 100644 (file)
@@ -24,7 +24,6 @@
 #include <config.h>
 #include <string.h>
 #include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
 
 #include <camel/camel.h>
 #include <libebackend/libebackend.h>
@@ -40,6 +39,8 @@
 struct _ENameSelectorEntryPrivate {
 
        ESourceRegistry *registry;
+       gint minimum_query_length;
+       gboolean show_address;
 
        PangoAttrList *attr_list;
        EContactStore *contact_store;
@@ -71,7 +72,9 @@ struct _ENameSelectorEntryPrivate {
 
 enum {
        PROP_0,
-       PROP_REGISTRY
+       PROP_REGISTRY,
+       PROP_MINIMUM_QUERY_LENGTH,
+       PROP_SHOW_ADDRESS
 };
 
 enum {
@@ -80,8 +83,6 @@ enum {
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
-static guint COMPLETION_CUE_MIN_LEN = 0;
-static gboolean COMPLETION_FORCE_SHOW_ADDRESS = FALSE;
 #define ENS_DEBUG(x)
 
 G_DEFINE_TYPE_WITH_CODE (
@@ -122,6 +123,18 @@ name_selector_entry_set_property (GObject *object,
                                E_NAME_SELECTOR_ENTRY (object),
                                g_value_get_object (value));
                        return;
+
+               case PROP_MINIMUM_QUERY_LENGTH:
+                       e_name_selector_entry_set_minimum_query_length (
+                               E_NAME_SELECTOR_ENTRY (object),
+                               g_value_get_int (value));
+                       return;
+
+               case PROP_SHOW_ADDRESS:
+                       e_name_selector_entry_set_show_address (
+                               E_NAME_SELECTOR_ENTRY (object),
+                               g_value_get_boolean (value));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -140,6 +153,20 @@ name_selector_entry_get_property (GObject *object,
                                e_name_selector_entry_get_registry (
                                E_NAME_SELECTOR_ENTRY (object)));
                        return;
+
+               case PROP_MINIMUM_QUERY_LENGTH:
+                       g_value_set_int (
+                               value,
+                               e_name_selector_entry_get_minimum_query_length (
+                               E_NAME_SELECTOR_ENTRY (object)));
+                       return;
+
+               case PROP_SHOW_ADDRESS:
+                       g_value_set_boolean (
+                               value,
+                               e_name_selector_entry_get_show_address (
+                               E_NAME_SELECTOR_ENTRY (object)));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -310,6 +337,29 @@ e_name_selector_entry_class_init (ENameSelectorEntryClass *class)
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
 
+       g_object_class_install_property (
+               object_class,
+               PROP_MINIMUM_QUERY_LENGTH,
+               g_param_spec_int (
+                       "minimum-query-length",
+                       "Minimum Query Length",
+                       NULL,
+                       1, G_MAXINT,
+                       3,
+                       G_PARAM_READWRITE |
+                       G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (
+               object_class,
+               PROP_SHOW_ADDRESS,
+               g_param_spec_boolean (
+                       "show-address",
+                       "Show Address",
+                       NULL,
+                       FALSE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_STATIC_STRINGS));
+
        signals[UPDATED] = g_signal_new (
                "updated",
                E_TYPE_NAME_SELECTOR_ENTRY,
@@ -818,7 +868,8 @@ build_textrep_for_contact (EContact *contact,
 }
 
 static gboolean
-contact_match_cue (EContact *contact,
+contact_match_cue (ENameSelectorEntry *name_selector_entry,
+                  EContact *contact,
                    const gchar *cue_str,
                    EContactField *matched_field,
                    gint *matched_field_rank)
@@ -834,7 +885,7 @@ contact_match_cue (EContact *contact,
        g_assert (contact);
        g_assert (cue_str);
 
-       if (g_utf8_strlen (cue_str, -1) < COMPLETION_CUE_MIN_LEN)
+       if (g_utf8_strlen (cue_str, -1) < name_selector_entry->priv->minimum_query_length)
                return FALSE;
 
        cue_len = strlen (cue_str);
@@ -916,7 +967,7 @@ find_existing_completion (ENameSelectorEntry *name_selector_entry,
                if (!current_contact)
                        continue;
 
-               matches = contact_match_cue (current_contact, cue_str, &current_field, &current_field_rank);
+               matches = contact_match_cue (name_selector_entry, current_contact, cue_str, &current_field, &current_field_rank);
                if (matches && current_field_rank < best_field_rank) {
                        best_contact    = current_contact;
                        best_field_rank = current_field_rank;
@@ -1025,7 +1076,7 @@ type_ahead_complete (ENameSelectorEntry *name_selector_entry)
        text = gtk_entry_get_text (GTK_ENTRY (name_selector_entry));
        get_range_at_position (text, cursor_pos, &range_start, &range_end);
        range_len = range_end - range_start;
-       if (range_len < COMPLETION_CUE_MIN_LEN)
+       if (range_len < priv->minimum_query_length)
                return;
 
        destination = find_destination_at_position (name_selector_entry, cursor_pos);
@@ -1112,7 +1163,7 @@ update_completion_model (ENameSelectorEntry *name_selector_entry)
        if (cursor_pos >= 0)
                get_range_at_position (text, cursor_pos, &range_start, &range_end);
 
-       if (range_end - range_start >= COMPLETION_CUE_MIN_LEN && cursor_pos == range_end) {
+       if (range_end - range_start >= name_selector_entry->priv->minimum_query_length && cursor_pos == range_end) {
                gchar *cue_str;
 
                cue_str = get_entry_substring (name_selector_entry, range_start, range_end);
@@ -1196,9 +1247,10 @@ modify_destination_at_position (ENameSelectorEntry *name_selector_entry,
 }
 
 static gchar *
-get_destination_textrep (EDestination *destination)
+get_destination_textrep (ENameSelectorEntry *name_selector_entry,
+                        EDestination *destination)
 {
-       gboolean show_email = COMPLETION_FORCE_SHOW_ADDRESS;
+       gboolean show_email = e_name_selector_entry_get_show_address (name_selector_entry);
        EContact *contact;
 
        g_return_val_if_fail (destination != NULL, NULL);
@@ -1215,7 +1267,7 @@ get_destination_textrep (EDestination *destination)
                }
        }
 
-       /* do not show emails for contact lists even user forces it in gconf */
+       /* do not show emails for contact lists even user forces it */
        if (show_email && contact && e_contact_get (contact, E_CONTACT_IS_LIST))
                show_email = FALSE;
 
@@ -1245,7 +1297,7 @@ sync_destination_at_position (ENameSelectorEntry *name_selector_entry,
                return;
        }
 
-       address = get_destination_textrep (destination);
+       address = get_destination_textrep (name_selector_entry, destination);
        address_len = g_utf8_strlen (address, -1);
 
        if (cursor_pos) {
@@ -1718,7 +1770,7 @@ entry_activate (ENameSelectorEntry *name_selector_entry)
                return;
 
        range_len = range_end - range_start;
-       if (range_len < COMPLETION_CUE_MIN_LEN)
+       if (range_len < priv->minimum_query_length)
                return;
 
        destination = find_destination_at_position (name_selector_entry, cursor_pos);
@@ -1806,7 +1858,7 @@ sanitize_entry (ENameSelectorEntry *name_selector_entry)
                else {
                        gchar *text;
 
-                       text = get_destination_textrep (dest);
+                       text = get_destination_textrep (name_selector_entry, dest);
                        if (text) {
                                if (str->str && str->str[0])
                                        g_string_append (str, ", ");
@@ -1852,7 +1904,7 @@ user_focus_in (ENameSelectorEntry *name_selector_entry,
                if (dest) {
                        gchar *text;
 
-                       text = get_destination_textrep (dest);
+                       text = get_destination_textrep (name_selector_entry, dest);
                        if (text) {
                                if (str->str && str->str[0])
                                        g_string_append (str, ", ");
@@ -2240,7 +2292,7 @@ destination_row_changed (ENameSelectorEntry *name_selector_entry,
 
        gtk_editable_delete_text (GTK_EDITABLE (name_selector_entry), range_start, range_end);
 
-       text = get_destination_textrep (destination);
+       text = get_destination_textrep (name_selector_entry, destination);
        gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), text, -1, &range_start);
        g_free (text);
 
@@ -2294,7 +2346,7 @@ destination_row_inserted (ENameSelectorEntry *name_selector_entry,
        if (comma_before)
                gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), ", ", -1, &insert_pos);
 
-       text = get_destination_textrep (destination);
+       text = get_destination_textrep (name_selector_entry, destination);
        gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), text, -1, &insert_pos);
        g_free (text);
 
@@ -3068,22 +3120,14 @@ static void
 e_name_selector_entry_init (ENameSelectorEntry *name_selector_entry)
 {
        GtkCellRenderer *renderer;
-       GConfClient *gconf;
 
        name_selector_entry->priv =
                E_NAME_SELECTOR_ENTRY_GET_PRIVATE (name_selector_entry);
 
        g_queue_init (&name_selector_entry->priv->cancellables);
 
-       /* read minimum_query_length from gconf*/
-       gconf = gconf_client_get_default ();
-       if (COMPLETION_CUE_MIN_LEN == 0) {
-               if ((COMPLETION_CUE_MIN_LEN = gconf_client_get_int (gconf, MINIMUM_QUERY_LENGTH, NULL)))
-                       ;
-               else COMPLETION_CUE_MIN_LEN = 3;
-       }
-       COMPLETION_FORCE_SHOW_ADDRESS = gconf_client_get_bool (gconf, FORCE_SHOW_ADDRESS, NULL);
-       g_object_unref (G_OBJECT (gconf));
+       name_selector_entry->priv->minimum_query_length = 3;
+       name_selector_entry->priv->show_address = FALSE;
 
        /* Edit signals */
 
@@ -3242,6 +3286,87 @@ e_name_selector_entry_set_registry (ENameSelectorEntry *name_selector_entry,
 }
 
 /**
+ * e_name_selector_entry_get_minimum_query_length:
+ * @name_selector_entry: an #ENameSelectorEntry
+ *
+ * Returns: Minimum length of query before completion starts
+ *
+ * Since: 3.6
+ **/
+gint
+e_name_selector_entry_get_minimum_query_length (ENameSelectorEntry *name_selector_entry)
+{
+       g_return_val_if_fail (E_IS_NAME_SELECTOR_ENTRY (name_selector_entry), -1);
+
+       return name_selector_entry->priv->minimum_query_length;
+}
+
+/**
+ * e_name_selector_entry_set_minimum_query_length:
+ * @name_selector_entry: an #ENameSelectorEntry
+ * @length: minimum query length
+ *
+ * Sets minimum length of query before completion starts.
+ *
+ * Since: 3.6
+ **/
+void
+e_name_selector_entry_set_minimum_query_length (ENameSelectorEntry *name_selector_entry,
+                                               gint length)
+{
+       g_return_if_fail (E_IS_NAME_SELECTOR_ENTRY (name_selector_entry));
+       g_return_if_fail (length > 0);
+
+       if (name_selector_entry->priv->minimum_query_length == length)
+               return;
+
+       name_selector_entry->priv->minimum_query_length = length;
+
+       g_object_notify (G_OBJECT (name_selector_entry), "minimum-query-length");
+}
+
+/**
+ * e_name_selector_entry_get_show_address:
+ * @name_selector_entry: an #ENameSelectorEntry
+ *
+ * Returns: Whether always show email address for an auto-completed contact.
+ *
+ * Since: 3.6
+ **/
+gboolean
+e_name_selector_entry_get_show_address (ENameSelectorEntry *name_selector_entry)
+{
+       g_return_val_if_fail (E_IS_NAME_SELECTOR_ENTRY (name_selector_entry), FALSE);
+
+       return name_selector_entry->priv->show_address;
+}
+
+/**
+ * e_name_selector_entry_set_show_address:
+ * @name_selector_entry: an #ENameSelectorEntry
+ * @show: new value to set
+ *
+ * Sets whether always show email address for an auto-completed contact.
+ *
+ * Since: 3.6
+ **/
+void
+e_name_selector_entry_set_show_address (ENameSelectorEntry *name_selector_entry,
+                                       gboolean show)
+{
+       g_return_if_fail (E_IS_NAME_SELECTOR_ENTRY (name_selector_entry));
+
+       if ((name_selector_entry->priv->show_address ? 1 : 0) == (show ? 1 : 0))
+               return;
+
+       name_selector_entry->priv->show_address = show;
+
+       sanitize_entry (name_selector_entry);
+
+       g_object_notify (G_OBJECT (name_selector_entry), "show-address");
+}
+
+/**
  * e_name_selector_entry_peek_contact_store:
  * @name_selector_entry: an #ENameSelectorEntry
  *
index ce77a67..1ceb5e0 100644 (file)
        (G_TYPE_INSTANCE_GET_CLASS \
        ((obj), E_TYPE_NAME_SELECTOR_ENTRY, ENameSelectorEntryClass))
 
-#define MINIMUM_QUERY_LENGTH "/apps/evolution/addressbook/completion/minimum_query_length"
-
-/**
- * FORCE_SHOW_ADDRESS:
- *
- * Since: 2.24
- **/
-#define FORCE_SHOW_ADDRESS   "/apps/evolution/addressbook/completion/show_address"
-
 G_BEGIN_DECLS
 
 typedef struct _ENameSelectorEntry ENameSelectorEntry;
@@ -92,6 +83,16 @@ ESourceRegistry *
 void           e_name_selector_entry_set_registry
                                                (ENameSelectorEntry *name_selector_entry,
                                                 ESourceRegistry *registry);
+gint           e_name_selector_entry_get_minimum_query_length
+                                               (ENameSelectorEntry *name_selector_entry);
+void           e_name_selector_entry_set_minimum_query_length
+                                               (ENameSelectorEntry *name_selector_entry,
+                                                gint length);
+gboolean       e_name_selector_entry_get_show_address
+                                               (ENameSelectorEntry *name_selector_entry);
+void           e_name_selector_entry_set_show_address
+                                               (ENameSelectorEntry *name_selector_entry,
+                                                gboolean show);
 EContactStore *        e_name_selector_entry_peek_contact_store
                                                (ENameSelectorEntry *name_selector_entry);
 void           e_name_selector_entry_set_contact_store
index a3c7f55..987da09 100644 (file)
@@ -179,6 +179,8 @@ camel/providers/sendmail/camel-sendmail-provider.c
 camel/providers/sendmail/camel-sendmail-transport.c
 camel/providers/smtp/camel-smtp-provider.c
 camel/providers/smtp/camel-smtp-transport.c
+data/org.gnome.evolution-data-server.addressbook.gschema.xml.in
+data/org.gnome.evolution-data-server.calendar.gschema.xml.in
 libebackend/e-authentication-mediator.c
 libebackend/e-authentication-session.c
 libebackend/e-server-side-source.c
index f99da5c..ffb69b7 100644 (file)
@@ -21,8 +21,6 @@
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
-#include <dbus/dbus-glib.h>
-
 #ifdef ENABLE_MAINTAINER_MODE
 #include <gtk/gtk.h>
 #endif
@@ -102,9 +100,6 @@ main (gint argc,
        g_type_init ();
 #endif
 
-       /* this is to initialize threading for dbus-glib used by GConf */
-       dbus_g_thread_init ();
-
        context = g_option_context_new (NULL);
        g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
        g_option_context_parse (context, &argc, &argv, &error);
index 36fa064..a80731b 100644 (file)
@@ -21,8 +21,6 @@
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
-#include <dbus/dbus-glib.h>
-
 #ifdef ENABLE_MAINTAINER_MODE
 #include <gtk/gtk.h>
 #endif
@@ -106,9 +104,6 @@ main (gint argc,
        g_type_init ();
 #endif
 
-       /* this is to initialize threading for dbus-glib used by GConf */
-       dbus_g_thread_init ();
-
        context = g_option_context_new (NULL);
        g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
        g_option_context_parse (context, &argc, &argv, &error);
index 5be64ae..2e19214 100644 (file)
@@ -55,7 +55,7 @@ create_text_column_for_field (EContactField field_id)
 }
 
 static gint
-start_test (const gchar *gconf_path)
+start_test (const gchar *param)
 {
        EContactStore *contact_store;
        GtkTreeModel *model_sort;
@@ -117,16 +117,16 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       const gchar *gconf_path;
+       const gchar *param;
 
        gtk_init (&argc, &argv);
 
        if (argc < 2)
-               gconf_path = "/apps/evolution/addressbook/sources";
+               param = "???";
        else
-               gconf_path = argv[1];
+               param = argv[1];
 
-       g_idle_add ((GSourceFunc) start_test, (gpointer) gconf_path);
+       g_idle_add ((GSourceFunc) start_test, (gpointer) param);
 
        gtk_main ();