Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revisione 1281)
+++ src/Makefile.am	(copia locale)
@@ -90,8 +90,12 @@
 libdevhelp_1_la_CPPFLAGS += -xobjective-c
 endif
 if HAVE_PLATFORM_X11
+if HAVE_GCONF
 conf_platform_sources = ige-conf-gconf.c
+else
+conf_platform_sources = ige-conf-key-file.c
 endif
+endif
 
 MARSHAL=dh
 
Index: src/ige-conf-key-file.c
===================================================================
--- src/ige-conf-key-file.c	(revisione 0)
+++ src/ige-conf-key-file.c	(revisione 0)
@@ -0,0 +1,421 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "ige-conf-private.h"
+
+#define KEYFILE_NAME    PACKAGE_TARNAME ".conf"
+#define KEYFILE_FLAGS   (G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS)
+#define GROUP_NAME      "Defaults"
+
+typedef struct {
+        GKeyFile          *key_file;
+} IgeConfPriv;
+
+typedef struct {
+        IgeConf           *conf;
+        IgeConfNotifyFunc  func;
+        gpointer           user_data;
+} IgeConfNotifyData;
+
+G_DEFINE_TYPE (IgeConf, ige_conf, G_TYPE_OBJECT);
+
+#define GET_PRIVATE(instance) G_TYPE_INSTANCE_GET_PRIVATE \
+  (instance, IGE_TYPE_CONF, IgeConfPriv);
+
+static IgeConf *global_conf = NULL;
+
+static void
+conf_close (IgeConf *ige_conf)
+{
+        IgeConfPriv *priv;
+        gchar       *data;
+        gsize        length;
+
+        priv = GET_PRIVATE (ige_conf);
+
+        if (priv->key_file == NULL) {
+                return;
+        }
+
+        data = g_key_file_to_data (priv->key_file, &length, NULL);
+
+        if (data != NULL) {
+                gchar *file;
+
+                file = g_build_path (G_DIR_SEPARATOR_S,
+                                     g_get_user_config_dir (),
+                                     KEYFILE_NAME, NULL);
+
+                g_file_set_contents (file, data, length, NULL);
+                g_free (file);
+
+                g_free (data);
+        }
+
+        g_key_file_free (priv->key_file);
+        priv->key_file = NULL;
+}
+
+static void
+conf_finalize (GObject *object)
+{
+        IgeConf *ige_conf = IGE_CONF (object);
+
+        conf_close (ige_conf);
+
+        if (ige_conf == global_conf) {
+                global_conf = NULL;
+        }
+
+        G_OBJECT_CLASS (ige_conf_parent_class)->finalize (object);
+}
+
+static void
+ige_conf_class_init (IgeConfClass *class)
+{
+        GObjectClass *object_class;
+
+        object_class = G_OBJECT_CLASS (class);
+
+        object_class->finalize = conf_finalize;
+
+        g_type_class_add_private (object_class, sizeof (IgeConfPriv));
+}
+
+static void
+ige_conf_init (IgeConf *conf)
+{
+        IgeConfPriv *priv;
+        const gchar *user_config_dirs[2];
+        
+        priv = GET_PRIVATE (conf);
+        priv->key_file = g_key_file_new ();
+
+        /* First, try in the user config dir */
+        user_config_dirs[0] = g_get_user_config_dir ();
+        user_config_dirs[1] = NULL;
+        if (!g_key_file_load_from_dirs (priv->key_file, KEYFILE_NAME,
+                                        user_config_dirs,
+                                        NULL, KEYFILE_FLAGS, NULL)) {
+                /* No user key-file found: try in system config dirs */
+                g_key_file_load_from_dirs (priv->key_file, KEYFILE_NAME,
+                                           (const gchar **) g_get_system_config_dirs (),
+                                           NULL, KEYFILE_FLAGS, NULL);
+        }
+}
+
+static void
+conf_atexit (void)
+{
+        if (global_conf) {
+                conf_close (global_conf);
+                global_conf = NULL;
+        }
+}
+
+IgeConf *
+ige_conf_get (void)
+{
+        if (!global_conf) {
+                global_conf = g_object_new (IGE_TYPE_CONF, NULL);
+                g_atexit (conf_atexit);
+        }
+
+        return global_conf;
+}
+
+void
+ige_conf_add_defaults (IgeConf     *conf,
+                       const gchar *path)
+{
+        IgeConfPriv        *priv;
+        IgeConfDefaultItem *item;
+        GList              *defaults, *l;
+
+        priv = GET_PRIVATE (conf);
+
+        defaults = _ige_conf_defaults_read_file (path, NULL);
+        for (l = defaults; l; l = l->next) {
+                item = l->data;
+
+                /* Check if a user-specific value is yet defined */
+                if (!g_key_file_has_key (priv->key_file, GROUP_NAME,
+                                         item->key, NULL)) {
+                        g_key_file_set_value (priv->key_file, GROUP_NAME,
+                                              item->key, item->value);
+                }
+        }
+
+        _ige_conf_defaults_free_list (defaults);
+}
+
+gboolean
+ige_conf_set_int (IgeConf     *conf,
+                  const gchar *key,
+                  gint         value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        g_key_file_set_integer (priv->key_file, GROUP_NAME, key, value);
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_int (IgeConf     *conf,
+                  const gchar *key,
+                  gint        *value)
+{
+        IgeConfPriv *priv;
+        GError      *error;
+        gint         result;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+        error = NULL;
+
+        result = g_key_file_get_integer (priv->key_file, GROUP_NAME,
+                                         key, &error);
+        if (error != NULL) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        *value = result;
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_bool (IgeConf     *conf,
+                   const gchar *key,
+                   gboolean     value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        g_key_file_set_boolean (priv->key_file, GROUP_NAME,
+                                key, value);
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_bool (IgeConf     *conf,
+                   const gchar *key,
+                   gboolean    *value)
+{
+        IgeConfPriv *priv;
+        GError      *error;
+        gboolean     result;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+        error = NULL;
+
+        result = g_key_file_get_boolean (priv->key_file, GROUP_NAME,
+                                         key, &error);
+        if (error != NULL) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        *value = result;
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_string (IgeConf     *conf,
+                     const gchar *key,
+                     const gchar *value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        g_key_file_set_string (priv->key_file, GROUP_NAME, key, value);
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_string (IgeConf      *conf,
+                     const gchar  *key,
+                     gchar       **value)
+{
+        IgeConfPriv *priv;
+        GError      *error;
+        gchar       *result;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+        error = NULL;
+
+        result = g_key_file_get_string (priv->key_file, GROUP_NAME,
+                                        key, &error);
+        if (error != NULL) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        *value = result;
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_string_list (IgeConf     *conf,
+                          const gchar *key,
+                          GSList      *value)
+{
+        IgeConfPriv  *priv;
+        gsize         length;
+        const gchar **list;
+        gint          n;
+        GSList       *iterator;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+        length = g_slist_length (value);
+        list = g_new (const gchar *, length);
+        iterator = value;
+
+        for (n = 0; n < length; ++ n) {
+                list[n] = iterator->data;
+                iterator = g_slist_next (iterator);
+        }
+
+        g_key_file_set_string_list (priv->key_file, GROUP_NAME,
+                                    key, list, length);
+
+        g_free (list);
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_string_list (IgeConf      *conf,
+                          const gchar  *key,
+                          GSList      **value)
+{
+        IgeConfPriv  *priv;
+        GError       *error;
+        gchar       **result;
+        gsize         length;
+        gint          n;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+        error = NULL;
+
+        result = g_key_file_get_string_list (priv->key_file, GROUP_NAME,
+                                             key, &length, &error);
+        if (error != NULL) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        *value = NULL;
+        for (n = 0; n < length; ++ n) {
+                *value = g_slist_append (*value, result[n]);
+        }
+
+        g_strfreev (result);
+
+        return TRUE;
+}
+
+/*
+static void
+conf_notify_data_free (IgeConfNotifyData *data)
+{
+        g_object_unref (data->conf);
+        g_slice_free (IgeConfNotifyData, data);
+}
+
+static void
+conf_notify_func (GConfClient *client,
+                  guint        id,
+                  GConfEntry  *entry,
+                  gpointer     user_data)
+{
+        IgeConfNotifyData *data;
+
+        data = user_data;
+
+        data->func (data->conf,
+                    gconf_entry_get_key (entry),
+                    data->user_data);
+}
+*/
+
+guint
+ige_conf_notify_add (IgeConf           *conf,
+                     const gchar       *key,
+                     IgeConfNotifyFunc  func,
+                     gpointer           user_data)
+{
+        IgeConfPriv       *priv;
+        guint              id;
+        IgeConfNotifyData *data;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), 0);
+
+        priv = GET_PRIVATE (conf);
+
+        data = g_slice_new (IgeConfNotifyData);
+        data->func = func;
+        data->user_data = user_data;
+        data->conf = g_object_ref (conf);
+
+        id = 0; /*gconf_client_notify_add (priv->gconf_client,
+                                      key,
+                                      conf_notify_func,
+                                      data,
+                                      (GFreeFunc) conf_notify_data_free,
+                                      NULL);
+        */
+        return id;
+}
+
+gboolean
+ige_conf_notify_remove (IgeConf *conf,
+                        guint    id)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        /*gconf_client_notify_remove (priv->gconf_client, id);*/
+
+        return TRUE;
+}
Index: configure.ac
===================================================================
--- configure.ac	(revisione 1281)
+++ configure.ac	(copia locale)
@@ -25,7 +25,11 @@
 dnl -----------------------------------------------------------
 IGE_PLATFORM_CHECK
 if test "x$IGE_PLATFORM" = xx11; then
-   gconf_pkgconfig="gconf-2.0 >= 2.6.0"
+   PKG_CHECK_EXISTS([gconf-2.0 >= 2.6.0],
+                    [gconf_pkgconfig="gconf-2.0 >= 2.6.0"],
+                    [gconf_pkgconfig=
+                     IGE_PLATFORM="x11bis"
+                     IGE_PLATFORM_NAME="GTK+ X11 (without GConf)"])
    libwnck_pkgconfig="libwnck-1.0 >= 2.10.0"
    igemacintegration_pkgconfig=
    REQUIRES_LIBWNCK=libwnck-1.0
@@ -39,6 +43,7 @@
    PLATFORM_CFLAGS=
    PLATFORM_LDFLAGS=
 fi
+AM_CONDITIONAL(HAVE_GCONF, test "x$IGE_PLATFORM" = xx11)
 AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x$IGE_PLATFORM" = xx11)
 AC_SUBST(PLATFORM_CFLAGS)
 AC_SUBST(PLATFORM_LDFLAGS)
