ibus_dconf_SOURCES = \
main.c \
config.c \
- config.h \
+ config-private.h \
$(NULL)
ibus_dconf_CFLAGS = \
@GLIB2_CFLAGS@ \
--- /dev/null
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* vim:set et sts=4: */
+/* ibus - The Input Bus
+ * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __CONFIG_DCONF_H__
+#define __CONFIG_DCONF_H__
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ibus.h>
+#ifdef DCONF_0_13_4
+# include <client/dconf-client.h>
+# include <common/dconf-paths.h>
+#else
+# include <dconf/dconf.h>
+#endif
+
+#define IBUS_TYPE_CONFIG_DCONF \
+ (ibus_config_dconf_get_type ())
+#define IBUS_CONFIG_DCONF(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_CONFIG_DCONF, IBusConfigDConf))
+#define IBUS_CONFIG_DCONF_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_CONFIG_DCONF, IBusConfigDConfClass))
+#define IBUS_IS_CONFIG_DCONF(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_CONFIG_DCONF))
+#define IBUS_IS_CONFIG_DCONF_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_CONFIG_DCONF))
+#define IBUS_CONFIG_DCONF_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_CONFIG_DCONF, IBusConfigDConfClass))
+
+typedef struct _IBusConfigDConf IBusConfigDConf;
+typedef struct _IBusConfigDConfClass IBusConfigDConfClass;
+
+GType ibus_config_dconf_get_type (void);
+IBusConfigDConf *ibus_config_dconf_new (GDBusConnection *connection);
+
+#endif
#include <string.h>
#include <ibus.h>
-#include "config.h"
+#include "config-private.h"
#define DCONF_PREFIX "/desktop/ibus"
#define DCONF_PRESERVE_NAME_PREFIXES_KEY \
_watch_func (DConfClient *client,
const gchar *gpath,
const gchar * const *items,
+#ifndef DCONF_0_13_4
gint n_items,
+#endif
const gchar *tag,
IBusConfigDConf *config)
{
gchar **gkeys = NULL;
gint i;
+#ifdef DCONF_0_13_4
+ gint n_items;
+
+ n_items = g_strv_length ((gchar **)items);
+#endif
g_return_if_fail (gpath != NULL);
g_return_if_fail (n_items >= 0);
ibus_config_dconf_init (IBusConfigDConf *config)
{
GVariant *variant;
+#ifdef DCONF_0_13_4
+ config->client = dconf_client_new ();
+
+ g_signal_connect (config->client, "changed",
+ G_CALLBACK (_watch_func), config);
+
+ dconf_client_watch_fast (config->client, DCONF_PREFIX"/");
+#else
GError *error;
config->client = dconf_client_new ("ibus",
error = NULL;
if (!dconf_client_watch (config->client, DCONF_PREFIX"/", NULL, &error))
g_warning ("Can not watch dconf path %s", DCONF_PREFIX"/");
+#endif
config->preserve_name_prefixes = NULL;
variant = dconf_client_read (config->client,
ibus_config_dconf_destroy (IBusConfigDConf *config)
{
if (config->client) {
+#ifdef DCONF_0_13_4
+ dconf_client_unwatch_fast (config->client, DCONF_PREFIX"/");
+#else
GError *error = NULL;
if (!dconf_client_unwatch (config->client, DCONF_PREFIX"/", NULL, &error))
g_warning ("Can not unwatch dconf path %s", DCONF_PREFIX"/");
+#endif
g_object_unref (config->client);
config->client = NULL;
g_free (gname);
}
+#ifdef DCONF_0_13_4
+ retval = dconf_client_write_fast (client, gkey, value, error);
+#else
retval = dconf_client_write (client,
gkey,
value,
NULL, /* tag */
NULL, /* cancellable */
error);
+#endif
g_free (gkey);
return retval;
+++ /dev/null
-/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
-/* vim:set et sts=4: */
-/* ibus - The Input Bus
- * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2008-2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __CONFIG_DCONF_H__
-#define __CONFIG_DCONF_H__
-
-#include <ibus.h>
-#include <dconf/dconf.h>
-
-#define IBUS_TYPE_CONFIG_DCONF \
- (ibus_config_dconf_get_type ())
-#define IBUS_CONFIG_DCONF(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_CONFIG_DCONF, IBusConfigDConf))
-#define IBUS_CONFIG_DCONF_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_CONFIG_DCONF, IBusConfigDConfClass))
-#define IBUS_IS_CONFIG_DCONF(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_CONFIG_DCONF))
-#define IBUS_IS_CONFIG_DCONF_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_CONFIG_DCONF))
-#define IBUS_CONFIG_DCONF_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_CONFIG_DCONF, IBusConfigDConfClass))
-
-typedef struct _IBusConfigDConf IBusConfigDConf;
-typedef struct _IBusConfigDConfClass IBusConfigDConfClass;
-
-GType ibus_config_dconf_get_type (void);
-IBusConfigDConf *ibus_config_dconf_new (GDBusConnection *connection);
-
-#endif
#include <ibus.h>
#include <stdlib.h>
#include <locale.h>
-#include "config.h"
+#include "config-private.h"
static IBusBus *bus = NULL;
static IBusConfigDConf *config = NULL;
[dconf >= 0.7.5], ,
enable_dconf=no
)
+ PKG_CHECK_EXISTS([dconf >= 0.13.4],
+ [AC_DEFINE(DCONF_0_13_4, TRUE, [dconf is 0.13.4 or later])],
+ [])
# check glib-compile-schemas
GLIB_GSETTINGS
fi