Logo Search packages:      
Sourcecode: d-conf version File versions  Download package

dconf-client.c

/* dconf-client.c generated by valac 0.12.0, the Vala compiler
 * generated from dconf-client.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <dconf-engine.h>
#include <dconf.h>


#define DCONF_TYPE_CLIENT (dconf_client_get_type ())
#define DCONF_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DCONF_TYPE_CLIENT, DConfClient))
#define DCONF_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DCONF_TYPE_CLIENT, DConfClientClass))
#define DCONF_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DCONF_TYPE_CLIENT))
#define DCONF_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DCONF_TYPE_CLIENT))
#define DCONF_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DCONF_TYPE_CLIENT, DConfClientClass))

typedef struct _DConfClient DConfClient;
typedef struct _DConfClientClass DConfClientClass;
typedef struct _DConfClientPrivate DConfClientPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _dconf_engine_free0(var) ((var == NULL) ? NULL : (var = (dconf_engine_free (var), NULL)))
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _DconfClientCallAsyncData DconfClientCallAsyncData;
typedef struct _DconfClientWriteAsyncData DconfClientWriteAsyncData;
typedef struct _DconfClientWatchAsyncData DconfClientWatchAsyncData;
typedef struct _DconfClientUnwatchAsyncData DconfClientUnwatchAsyncData;

typedef void (*DConfWatchFunc) (DConfClient* client, const gchar* path, gchar** items, int items_length1, const gchar* tag, void* user_data);
00035 struct _DConfClient {
      GObject parent_instance;
      DConfClientPrivate * priv;
};

00040 struct _DConfClientClass {
      GObjectClass parent_class;
};

00044 struct _DConfClientPrivate {
      GDBusConnection* session;
      GDBusConnection* system;
      DConfWatchFunc watch_func;
      gpointer watch_func_target;
      GDestroyNotify watch_func_target_destroy_notify;
      DConfEngine* engine;
};

00053 struct _DconfClientCallAsyncData {
      int _state_;
      GObject* _source_object_;
      GAsyncResult* _res_;
      GSimpleAsyncResult* _async_result;
      DConfClient* self;
      DConfEngineMessage dcem;
      gchar* tag;
      GCancellable* cancellable;
      GDBusConnection* connection;
      GDBusConnection* _tmp0_;
      GDBusConnection* _tmp1_;
      GDBusConnection* _tmp2_;
      GDBusConnection* _tmp3_;
      GDBusConnection* _tmp4_;
      GDBusConnection* _tmp5_;
      GVariant** message_collection;
      int message_collection_length1;
      int message_it;
      GVariant* _tmp6_;
      GVariant* message;
      GVariant* _tmp7_;
      GVariant* reply;
      GError * _inner_error_;
};

00079 struct _DconfClientWriteAsyncData {
      int _state_;
      GObject* _source_object_;
      GAsyncResult* _res_;
      GSimpleAsyncResult* _async_result;
      DConfClient* self;
      gchar* key;
      GVariant* value;
      gchar* tag;
      GCancellable* cancellable;
      gboolean result;
      DConfEngineMessage _tmp0_;
      DConfEngineMessage _tmp1_;
      DConfEngineMessage _tmp2_;
      DConfEngineMessage _tmp3_;
      gchar* _tmp4_;
      GError * _inner_error_;
};

00098 struct _DconfClientWatchAsyncData {
      int _state_;
      GObject* _source_object_;
      GAsyncResult* _res_;
      GSimpleAsyncResult* _async_result;
      DConfClient* self;
      gchar* name;
      GCancellable* cancellable;
      gboolean result;
      DConfEngineMessage _tmp0_;
      DConfEngineMessage _tmp1_;
      DConfEngineMessage _tmp2_;
      GError * _inner_error_;
};

00113 struct _DconfClientUnwatchAsyncData {
      int _state_;
      GObject* _source_object_;
      GAsyncResult* _res_;
      GSimpleAsyncResult* _async_result;
      DConfClient* self;
      gchar* name;
      GCancellable* cancellable;
      gboolean result;
      DConfEngineMessage _tmp0_;
      DConfEngineMessage _tmp1_;
      DConfEngineMessage _tmp2_;
      GError * _inner_error_;
};


static gpointer dconf_client_parent_class = NULL;

GType dconf_client_get_type (void) G_GNUC_CONST;
#define DCONF_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DCONF_TYPE_CLIENT, DConfClientPrivate))
enum  {
      DCONF_CLIENT_DUMMY_PROPERTY
};
static void dconf_client_got_signal (DConfClient* self, GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters);
static void dconf_client_call_sync (DConfClient* self, DConfEngineMessage* dcem, gchar** tag, GCancellable* cancellable, GError** error);
static void _dconf_client_got_signal_gd_bus_signal_callback (GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters, gpointer self);
static void dconf_client_call_async_data_free (gpointer _data);
static void dconf_client_call_async (DConfClient* self, DConfEngineMessage* dcem, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void dconf_client_call_finish (DConfClient* self, GAsyncResult* _res_, gchar** tag, GError** error);
static gboolean dconf_client_call_async_co (DconfClientCallAsyncData* data);
static void dconf_client_call_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
gboolean dconf_client_is_writable (DConfClient* self, const gchar* key);
gboolean dconf_client_write (DConfClient* self, const gchar* key, GVariant* value, gchar** tag, GCancellable* cancellable, GError** error);
static void dconf_client_write_async_data_free (gpointer _data);
void dconf_client_write_async (DConfClient* self, const gchar* key, GVariant* value, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
gboolean dconf_client_write_finish (DConfClient* self, GAsyncResult* _res_, gchar** tag, GError** error);
static gboolean dconf_client_write_async_co (DconfClientWriteAsyncData* data);
static void dconf_client_write_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
gboolean dconf_client_write_many (DConfClient* self, const gchar* dir, gchar** rels, GVariant** values, int values_length1, gchar** tag, GCancellable* cancellable, GError** error);
GVariant* dconf_client_read (DConfClient* self, const gchar* key);
GVariant* dconf_client_read_default (DConfClient* self, const gchar* key);
GVariant* dconf_client_read_no_default (DConfClient* self, const gchar* key);
gchar** dconf_client_list (DConfClient* self, const gchar* dir, int* result_length1);
gboolean dconf_client_watch (DConfClient* self, const gchar* path, GCancellable* cancellable, GError** error);
static void dconf_client_watch_async_data_free (gpointer _data);
void dconf_client_watch_async (DConfClient* self, const gchar* name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
gboolean dconf_client_watch_finish (DConfClient* self, GAsyncResult* _res_, GError** error);
static gboolean dconf_client_watch_async_co (DconfClientWatchAsyncData* data);
static void dconf_client_watch_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
gboolean dconf_client_unwatch (DConfClient* self, const gchar* name, GCancellable* cancellable, GError** error);
static void dconf_client_unwatch_async_data_free (gpointer _data);
void dconf_client_unwatch_async (DConfClient* self, const gchar* name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
gboolean dconf_client_unwatch_finish (DConfClient* self, GAsyncResult* _res_, GError** error);
static gboolean dconf_client_unwatch_async_co (DconfClientUnwatchAsyncData* data);
static void dconf_client_unwatch_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
DConfClient* dconf_client_new (const gchar* profile, DConfWatchFunc watch_func, void* watch_func_target, GDestroyNotify watch_func_target_destroy_notify);
DConfClient* dconf_client_construct (GType object_type, const gchar* profile, DConfWatchFunc watch_func, void* watch_func_target, GDestroyNotify watch_func_target_destroy_notify);
static void dconf_client_finalize (GObject* obj);
gboolean dconf_is_path (const gchar* str, GError** _error_);
gboolean dconf_is_key (const gchar* str, GError** _error_);
gboolean dconf_is_dir (const gchar* str, GError** _error_);
gboolean dconf_is_rel_path (const gchar* str, GError** _error_);
gboolean dconf_is_rel_key (const gchar* str, GError** _error_);
gboolean dconf_is_rel_dir (const gchar* str, GError** _error_);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static void dconf_client_got_signal (DConfClient* self, GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters) {
      const gchar* path = NULL;
      const gchar* tag = NULL;
      gchar** items = NULL;
      gint items_length1 = 0;
      gint _items_size_ = 0;
      gboolean _tmp0_ = FALSE;
      g_return_if_fail (self != NULL);
      g_return_if_fail (connection != NULL);
      g_return_if_fail (sender_name != NULL);
      g_return_if_fail (object_path != NULL);
      g_return_if_fail (interface_name != NULL);
      g_return_if_fail (signal_name != NULL);
      g_return_if_fail (parameters != NULL);
      if (g_strcmp0 (signal_name, "Notify") == 0) {
            gboolean _tmp1_;
            _tmp1_ = g_variant_is_of_type (parameters, (const GVariantType*) "(sass)");
            _tmp0_ = _tmp1_;
      } else {
            _tmp0_ = FALSE;
      }
      if (_tmp0_) {
            GVariantIter* iter = NULL;
            gsize _tmp2_;
            gchar** _tmp3_ = NULL;
            g_variant_get (parameters, "(&sas&s)", &path, &iter, &tag, NULL);
            _tmp2_ = g_variant_iter_n_children (iter);
            _tmp3_ = g_new0 (gchar*, _tmp2_ + 1);
            items = (_vala_array_free (items, items_length1, (GDestroyNotify) g_free), NULL);
            items = _tmp3_;
            items_length1 = _tmp2_;
            _items_size_ = _tmp2_;
            {
                  gint i;
                  i = 0;
                  {
                        gboolean _tmp4_;
                        _tmp4_ = TRUE;
                        while (TRUE) {
                              if (!_tmp4_) {
                                    i++;
                              }
                              _tmp4_ = FALSE;
                              if (!(i < items_length1)) {
                                    break;
                              }
                              g_variant_iter_next (iter, "s", &items[i], NULL);
                        }
                  }
            }
            _g_variant_iter_free0 (iter);
      } else {
            gboolean _tmp5_ = FALSE;
            if (g_strcmp0 (signal_name, "WritabilityNotify") == 0) {
                  gboolean _tmp6_;
                  _tmp6_ = g_variant_is_of_type (parameters, (const GVariantType*) "(s)");
                  _tmp5_ = _tmp6_;
            } else {
                  _tmp5_ = FALSE;
            }
            if (_tmp5_) {
                  gchar** _tmp7_ = NULL;
                  g_variant_get (parameters, "(&s)", &path, NULL);
                  _tmp7_ = g_new0 (gchar*, 0 + 1);
                  items = (_vala_array_free (items, items_length1, (GDestroyNotify) g_free), NULL);
                  items = _tmp7_;
                  items_length1 = 0;
                  _items_size_ = 0;
                  tag = "";
            } else {
                  g_assert_not_reached ();
            }
      }
      self->priv->watch_func (self, path, items, items_length1, tag, self->priv->watch_func_target);
      items = (_vala_array_free (items, items_length1, (GDestroyNotify) g_free), NULL);
}


static void _dconf_client_got_signal_gd_bus_signal_callback (GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters, gpointer self) {
      dconf_client_got_signal (self, connection, sender_name, object_path, interface_name, signal_name, parameters);
}


static gpointer _g_object_ref0 (gpointer self) {
      return self ? g_object_ref (self) : NULL;
}


static gpointer _g_variant_ref0 (gpointer self) {
      return self ? g_variant_ref (self) : NULL;
}


static void dconf_client_call_sync (DConfClient* self, DConfEngineMessage* dcem, gchar** tag, GCancellable* cancellable, GError** error) {
      gchar* _tag = NULL;
      GDBusConnection* connection = NULL;
      GError * _inner_error_ = NULL;
      g_return_if_fail (self != NULL);
      if ((*dcem).bus_types[0] == 'e') {
            GDBusConnection* _tmp2_;
            if (self->priv->session == NULL) {
                  GDBusConnection* _tmp0_ = NULL;
                  GDBusConnection* _tmp1_;
                  _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, &_inner_error_);
                  _tmp1_ = _tmp0_;
                  if (_inner_error_ != NULL) {
                        g_propagate_error (error, _inner_error_);
                        _g_object_unref0 (connection);
                        return;
                  }
                  _g_object_unref0 (self->priv->session);
                  self->priv->session = _tmp1_;
                  if (self->priv->watch_func != NULL) {
                        g_dbus_connection_signal_subscribe (self->priv->session, NULL, "ca.desrt.dconf.Writer", NULL, NULL, NULL, G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE, _dconf_client_got_signal_gd_bus_signal_callback, g_object_ref (self), g_object_unref);
                  }
            }
            _tmp2_ = _g_object_ref0 (self->priv->session);
            _g_object_unref0 (connection);
            connection = _tmp2_;
      } else {
            GDBusConnection* _tmp5_;
            g_assert ((*dcem).bus_types[0] == 'y');
            if (self->priv->system == NULL) {
                  GDBusConnection* _tmp3_ = NULL;
                  GDBusConnection* _tmp4_;
                  _tmp3_ = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, &_inner_error_);
                  _tmp4_ = _tmp3_;
                  if (_inner_error_ != NULL) {
                        g_propagate_error (error, _inner_error_);
                        _g_object_unref0 (connection);
                        return;
                  }
                  _g_object_unref0 (self->priv->system);
                  self->priv->system = _tmp4_;
                  if (self->priv->watch_func != NULL) {
                        g_dbus_connection_signal_subscribe (self->priv->system, NULL, "ca.desrt.dconf.Writer", NULL, NULL, NULL, G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE, _dconf_client_got_signal_gd_bus_signal_callback, g_object_ref (self), g_object_unref);
                  }
            }
            _tmp5_ = _g_object_ref0 (self->priv->system);
            _g_object_unref0 (connection);
            connection = _tmp5_;
      }
      {
            GVariant** message_collection;
            int message_collection_length1;
            int message_it;
            message_collection = (*dcem).parameters;
            message_collection_length1 = (*dcem).n_messages;
            for (message_it = 0; message_it < (*dcem).n_messages; message_it = message_it + 1) {
                  GVariant* _tmp6_;
                  GVariant* message;
                  _tmp6_ = _g_variant_ref0 (message_collection[message_it]);
                  message = _tmp6_;
                  {
                        GVariant* _tmp7_ = NULL;
                        GVariant* reply;
                        gboolean _tmp8_;
                        _tmp7_ = g_dbus_connection_call_sync (connection, (*dcem).bus_name, (*dcem).object_path, (*dcem).interface_name, (*dcem).method_name, message, (*dcem).reply_type, G_DBUS_CALL_FLAGS_NONE, -1, cancellable, &_inner_error_);
                        reply = _tmp7_;
                        if (_inner_error_ != NULL) {
                              g_propagate_error (error, _inner_error_);
                              _g_variant_unref0 (message);
                              _g_object_unref0 (connection);
                              return;
                        }
                        _tmp8_ = g_variant_type_equal ((*dcem).reply_type, G_VARIANT_TYPE_UNIT);
                        if (!_tmp8_) {
                              g_variant_get (reply, "(s)", &_tag, NULL);
                        }
                        _g_variant_unref0 (reply);
                        _g_variant_unref0 (message);
                  }
            }
      }
      _g_object_unref0 (connection);
      if (tag) {
            *tag = _tag;
      } else {
            _g_free0 (_tag);
      }
}


static void dconf_client_call_async_data_free (gpointer _data) {
      DconfClientCallAsyncData* data;
      data = _data;
      dconf_engine_message_destroy (&data->dcem);
      _g_object_unref0 (data->cancellable);
      _g_object_unref0 (data->self);
      g_slice_free (DconfClientCallAsyncData, data);
}


static void dconf_client_call_async (DConfClient* self, DConfEngineMessage* dcem, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
      DconfClientCallAsyncData* _data_;
      DConfEngineMessage _tmp0_ = {0};
      _data_ = g_slice_new0 (DconfClientCallAsyncData);
      _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, dconf_client_call_async);
      g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, dconf_client_call_async_data_free);
      _data_->self = _g_object_ref0 (self);
      dconf_engine_message_copy (dcem, &_tmp0_);
      _data_->dcem = _tmp0_;
      _data_->cancellable = _g_object_ref0 (cancellable);
      dconf_client_call_async_co (_data_);
}


static void dconf_client_call_finish (DConfClient* self, GAsyncResult* _res_, gchar** tag, GError** error) {
      DconfClientCallAsyncData* _data_;
      if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
            return;
      }
      _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
      *tag = _data_->tag;
      _data_->tag = NULL;
}


static void dconf_client_call_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
      DconfClientCallAsyncData* data;
      data = _user_data_;
      data->_source_object_ = source_object;
      data->_res_ = _res_;
      dconf_client_call_async_co (data);
}


static gboolean dconf_client_call_async_co (DconfClientCallAsyncData* data) {
      switch (data->_state_) {
            case 0:
            goto _state_0;
            case 1:
            goto _state_1;
            case 2:
            goto _state_2;
            case 3:
            goto _state_3;
            default:
            g_assert_not_reached ();
      }
      _state_0:
      if (data->dcem.bus_types[0] == 'e') {
            if (data->self->priv->session == NULL) {
                  data->_state_ = 1;
                  g_bus_get (G_BUS_TYPE_SESSION, data->cancellable, dconf_client_call_async_ready, data);
                  return FALSE;
                  _state_1:
                  data->_tmp0_ = NULL;
                  data->_tmp0_ = g_bus_get_finish (data->_res_, &data->_inner_error_);
                  data->_tmp1_ = data->_tmp0_;
                  if (data->_inner_error_ != NULL) {
                        g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
                        g_error_free (data->_inner_error_);
                        _g_object_unref0 (data->connection);
                        if (data->_state_ == 0) {
                              g_simple_async_result_complete_in_idle (data->_async_result);
                        } else {
                              g_simple_async_result_complete (data->_async_result);
                        }
                        g_object_unref (data->_async_result);
                        return FALSE;
                  }
                  _g_object_unref0 (data->self->priv->session);
                  data->self->priv->session = data->_tmp1_;
            }
            data->_tmp2_ = _g_object_ref0 (data->self->priv->session);
            _g_object_unref0 (data->connection);
            data->connection = data->_tmp2_;
      } else {
            g_assert (data->dcem.bus_types[0] == 'y');
            if (data->self->priv->system == NULL) {
                  data->_state_ = 2;
                  g_bus_get (G_BUS_TYPE_SYSTEM, data->cancellable, dconf_client_call_async_ready, data);
                  return FALSE;
                  _state_2:
                  data->_tmp3_ = NULL;
                  data->_tmp3_ = g_bus_get_finish (data->_res_, &data->_inner_error_);
                  data->_tmp4_ = data->_tmp3_;
                  if (data->_inner_error_ != NULL) {
                        g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
                        g_error_free (data->_inner_error_);
                        _g_object_unref0 (data->connection);
                        if (data->_state_ == 0) {
                              g_simple_async_result_complete_in_idle (data->_async_result);
                        } else {
                              g_simple_async_result_complete (data->_async_result);
                        }
                        g_object_unref (data->_async_result);
                        return FALSE;
                  }
                  _g_object_unref0 (data->self->priv->system);
                  data->self->priv->system = data->_tmp4_;
            }
            data->_tmp5_ = _g_object_ref0 (data->self->priv->system);
            _g_object_unref0 (data->connection);
            data->connection = data->_tmp5_;
      }
      {
            data->message_collection = data->dcem.parameters;
            data->message_collection_length1 = data->dcem.n_messages;
            for (data->message_it = 0; data->message_it < data->dcem.n_messages; data->message_it = data->message_it + 1) {
                  data->_tmp6_ = _g_variant_ref0 (data->message_collection[data->message_it]);
                  data->message = data->_tmp6_;
                  {
                        data->_state_ = 3;
                        g_dbus_connection_call (data->connection, data->dcem.bus_name, data->dcem.object_path, data->dcem.interface_name, data->dcem.method_name, data->message, data->dcem.reply_type, G_DBUS_CALL_FLAGS_NONE, -1, data->cancellable, dconf_client_call_async_ready, data);
                        return FALSE;
                        _state_3:
                        data->_tmp7_ = NULL;
                        data->_tmp7_ = g_dbus_connection_call_finish (data->connection, data->_res_, &data->_inner_error_);
                        data->reply = data->_tmp7_;
                        if (data->_inner_error_ != NULL) {
                              g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
                              g_error_free (data->_inner_error_);
                              _g_variant_unref0 (data->message);
                              _g_object_unref0 (data->connection);
                              if (data->_state_ == 0) {
                                    g_simple_async_result_complete_in_idle (data->_async_result);
                              } else {
                                    g_simple_async_result_complete (data->_async_result);
                              }
                              g_object_unref (data->_async_result);
                              return FALSE;
                        }
                        if (data->dcem.reply_type != G_VARIANT_TYPE_UNIT) {
                              g_variant_get (data->reply, "(s)", &data->tag, NULL);
                        }
                        _g_variant_unref0 (data->reply);
                        _g_variant_unref0 (data->message);
                  }
            }
      }
      _g_object_unref0 (data->connection);
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
}


/**
 * dconf_client_is_writable:
 * @client: a #DConfClient
 * @key: a dconf key
 * Returns: %TRUE is @key is writable
 *
 * Checks if @key is writable (ie: the key has no mandatory setting).
 *
 * This call does not verify that writing to the key will actually be successful.  It only checks for
 * the existence of mandatory keys/locks that might affect writing to @key.  Other issues (such as a
 * full disk or an inability to connect to the bus and start the service) may cause the write to fail.
 **/
gboolean dconf_client_is_writable (DConfClient* self, const gchar* key) {
      gboolean result = FALSE;
      gboolean _tmp0_;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (key != NULL, FALSE);
      _tmp0_ = dconf_engine_is_writable (self->priv->engine, key);
      result = _tmp0_;
      return result;
}


/**
 * dconf_client_write:
 * @client: a #DConfClient
 * @key: a dconf key
 * @value: (allow-none): a #GVariant, or %NULL
 * @tag: (out) (allow-none): the tag from this write
 * @cancellable: a #GCancellable, or %NULL
 * @error: a pointer to a #GError, or %NULL
 * Returns: %TRUE if the write is successful
 *
 * Write a value to the given @key, or reset @key to its default value.
 *
 * If @value is %NULL then @key is reset to its default value (which may
 * be completely unset), otherwise @value becomes the new value.
 *
 * If @tag is non-%NULL then it is set to the unique tag associated with this write.  This is the same
 * tag that appears in change notifications.
 **/
gboolean dconf_client_write (DConfClient* self, const gchar* key, GVariant* value, gchar** tag, GCancellable* cancellable, GError** error) {
      gchar* _tag = NULL;
      gboolean result = FALSE;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (key != NULL, FALSE);
      if ((&_tag) == NULL) {
            gchar* junk = NULL;
            DConfEngineMessage _tmp0_ = {0};
            DConfEngineMessage _tmp1_ = {0};
            DConfEngineMessage _tmp2_;
            DConfEngineMessage _tmp3_;
            gchar* _tmp4_ = NULL;
            dconf_engine_write (self->priv->engine, key, value, &_tmp0_, &_inner_error_);
            _tmp1_ = _tmp0_;
            _tmp2_ = _tmp1_;
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  _g_free0 (junk);
                  return FALSE;
            }
            _tmp3_ = _tmp2_;
            dconf_client_call_sync (self, &_tmp3_, &_tmp4_, cancellable, &_inner_error_);
            _g_free0 (junk);
            junk = _tmp4_;
            dconf_engine_message_destroy (&_tmp3_);
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  _g_free0 (junk);
                  return FALSE;
            }
            _g_free0 (junk);
      } else {
            DConfEngineMessage _tmp5_ = {0};
            DConfEngineMessage _tmp6_ = {0};
            DConfEngineMessage _tmp7_;
            DConfEngineMessage _tmp8_;
            gchar* _tmp9_ = NULL;
            dconf_engine_write (self->priv->engine, key, value, &_tmp5_, &_inner_error_);
            _tmp6_ = _tmp5_;
            _tmp7_ = _tmp6_;
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  return FALSE;
            }
            _tmp8_ = _tmp7_;
            dconf_client_call_sync (self, &_tmp8_, &_tmp9_, cancellable, &_inner_error_);
            _g_free0 (_tag);
            _tag = _tmp9_;
            dconf_engine_message_destroy (&_tmp8_);
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  return FALSE;
            }
      }
      result = TRUE;
      if (tag) {
            *tag = _tag;
      } else {
            _g_free0 (_tag);
      }
      return result;
}


static void dconf_client_write_async_data_free (gpointer _data) {
      DconfClientWriteAsyncData* data;
      data = _data;
      _g_free0 (data->key);
      _g_variant_unref0 (data->value);
      _g_object_unref0 (data->cancellable);
      _g_object_unref0 (data->self);
      g_slice_free (DconfClientWriteAsyncData, data);
}


void dconf_client_write_async (DConfClient* self, const gchar* key, GVariant* value, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
      DconfClientWriteAsyncData* _data_;
      _data_ = g_slice_new0 (DconfClientWriteAsyncData);
      _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, dconf_client_write_async);
      g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, dconf_client_write_async_data_free);
      _data_->self = _g_object_ref0 (self);
      _data_->key = g_strdup (key);
      _data_->value = _g_variant_ref0 (value);
      _data_->cancellable = _g_object_ref0 (cancellable);
      dconf_client_write_async_co (_data_);
}


gboolean dconf_client_write_finish (DConfClient* self, GAsyncResult* _res_, gchar** tag, GError** error) {
      gboolean result;
      DconfClientWriteAsyncData* _data_;
      if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
            return FALSE;
      }
      _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
      *tag = _data_->tag;
      _data_->tag = NULL;
      result = _data_->result;
      return result;
}


/**
 * dconf_client_write_async:
 * @client: a #DConfClient
 * @key: a dconf key
 * @value: (allow-none): a #GVariant, or %NULL
 * @cancellable: a #GCancellable, or %NULL
 * @callback: the function to call when complete
 * @user_data: the user data for @callback
 *
 * Write a value to the given @key, or reset @key to its default value.
 *
 * This is the asynchronous version of dconf_client_write().  You should call
 * dconf_client_write_finish() from @callback to collect the result.
 **/
static void dconf_client_write_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
      DconfClientWriteAsyncData* data;
      data = _user_data_;
      data->_source_object_ = source_object;
      data->_res_ = _res_;
      dconf_client_write_async_co (data);
}


static gboolean dconf_client_write_async_co (DconfClientWriteAsyncData* data) {
      switch (data->_state_) {
            case 0:
            goto _state_0;
            case 1:
            goto _state_1;
            default:
            g_assert_not_reached ();
      }
      _state_0:
      memset (&data->_tmp0_, 0, sizeof (DConfEngineMessage));
      dconf_engine_write (data->self->priv->engine, data->key, data->value, &data->_tmp0_, &data->_inner_error_);
      memset (&data->_tmp1_, 0, sizeof (DConfEngineMessage));
      data->_tmp1_ = data->_tmp0_;
      data->_tmp2_ = data->_tmp1_;
      if (data->_inner_error_ != NULL) {
            g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
            g_error_free (data->_inner_error_);
            if (data->_state_ == 0) {
                  g_simple_async_result_complete_in_idle (data->_async_result);
            } else {
                  g_simple_async_result_complete (data->_async_result);
            }
            g_object_unref (data->_async_result);
            return FALSE;
      }
      data->_tmp3_ = data->_tmp2_;
      data->_tmp4_ = NULL;
      data->_state_ = 1;
      dconf_client_call_async (data->self, &data->_tmp3_, data->cancellable, dconf_client_write_async_ready, data);
      return FALSE;
      _state_1:
      dconf_client_call_finish (data->self, data->_res_, &data->_tmp4_, &data->_inner_error_);
      _g_free0 (data->tag);
      data->tag = data->_tmp4_;
      dconf_engine_message_destroy (&data->_tmp3_);
      if (data->_inner_error_ != NULL) {
            g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
            g_error_free (data->_inner_error_);
            if (data->_state_ == 0) {
                  g_simple_async_result_complete_in_idle (data->_async_result);
            } else {
                  g_simple_async_result_complete (data->_async_result);
            }
            g_object_unref (data->_async_result);
            return FALSE;
      }
      data->result = TRUE;
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
}


/**
 * dconf_client_write_many:
 * @client: a #DConfClient
 * @dir: the dconf directory under which to make the writes
 * @rels: a %NULL-terminated array of relative keys
 * @values: an array of possibly-%NULL #GVariant pointers
 * @n_values: the length of @values, which must be equal to the length of @rels
 * @tag: (out) (allow-none): the tag from this write
 * @cancellable: a #GCancellable, or %NULL
 * @error: a pointer to a #GError, or %NULL
 * Returns: %TRUE if the write is successful
 *
 * Write multiple values at once.
 *
 * For each pair of items from @rels and @values, the value is written to the result of concatenating
 * @dir with the relative path.  As with dconf_client_write(), if a given value is %NULL then the effect
 * is that the specified key is reset.
 *
 * If @tag is non-%NULL then it is set to the unique tag associated with this write.  This is the same
 * tag that appears in change notifications.
 **/
gboolean dconf_client_write_many (DConfClient* self, const gchar* dir, gchar** rels, GVariant** values, int values_length1, gchar** tag, GCancellable* cancellable, GError** error) {
      gchar* _tag = NULL;
      gboolean result = FALSE;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (dir != NULL, FALSE);
      if ((&_tag) == NULL) {
            gchar* junk = NULL;
            DConfEngineMessage _tmp0_ = {0};
            DConfEngineMessage _tmp1_ = {0};
            DConfEngineMessage _tmp2_;
            DConfEngineMessage _tmp3_;
            gchar* _tmp4_ = NULL;
            dconf_engine_write_many (self->priv->engine, dir, (const gchar * const *) rels, values, &_tmp0_, &_inner_error_);
            _tmp1_ = _tmp0_;
            _tmp2_ = _tmp1_;
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  _g_free0 (junk);
                  return FALSE;
            }
            _tmp3_ = _tmp2_;
            dconf_client_call_sync (self, &_tmp3_, &_tmp4_, cancellable, &_inner_error_);
            _g_free0 (junk);
            junk = _tmp4_;
            dconf_engine_message_destroy (&_tmp3_);
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  _g_free0 (junk);
                  return FALSE;
            }
            _g_free0 (junk);
      } else {
            DConfEngineMessage _tmp5_ = {0};
            DConfEngineMessage _tmp6_ = {0};
            DConfEngineMessage _tmp7_;
            DConfEngineMessage _tmp8_;
            gchar* _tmp9_ = NULL;
            dconf_engine_write_many (self->priv->engine, dir, (const gchar * const *) rels, values, &_tmp5_, &_inner_error_);
            _tmp6_ = _tmp5_;
            _tmp7_ = _tmp6_;
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  return FALSE;
            }
            _tmp8_ = _tmp7_;
            dconf_client_call_sync (self, &_tmp8_, &_tmp9_, cancellable, &_inner_error_);
            _g_free0 (_tag);
            _tag = _tmp9_;
            dconf_engine_message_destroy (&_tmp8_);
            if (_inner_error_ != NULL) {
                  g_propagate_error (error, _inner_error_);
                  return FALSE;
            }
      }
      result = TRUE;
      if (tag) {
            *tag = _tag;
      } else {
            _g_free0 (_tag);
      }
      return result;
}


/**
 * dconf_client_read:
 * @client: a #DConfClient
 * @key: a valid dconf key
 * Returns: the value corresponding to @key, or %NULL if there is none
 *
 * Reads the value named by @key from dconf.  If no such value exists, %NULL is returned.
 **/
GVariant* dconf_client_read (DConfClient* self, const gchar* key) {
      GVariant* result = NULL;
      GVariant* _tmp0_ = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (key != NULL, NULL);
      _tmp0_ = dconf_engine_read (self->priv->engine, key);
      result = _tmp0_;
      return result;
}


/**
 * dconf_client_read_default:
 * @client: a #DConfClient
 * @key: a valid dconf key
 * Returns: the default value corresponding to @key, or %NULL if there is none
 *
 * Reads the value named by @key from any existing default/mandatory databases but ignoring any value
 * set by the user.  The result is as if the named key had just been reset.
 **/
GVariant* dconf_client_read_default (DConfClient* self, const gchar* key) {
      GVariant* result = NULL;
      GVariant* _tmp0_ = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (key != NULL, NULL);
      _tmp0_ = dconf_engine_read_default (self->priv->engine, key);
      result = _tmp0_;
      return result;
}


/**
 * dconf_client_read_no_default:
 * @client: a #DConfClient
 * @key: a valid dconf key
 * Returns: the user value corresponding to @key, or %NULL if there is none
 *
 * Reads the value named by @key as set by the user, ignoring any default/mandatory databases.  Normal
 * applications will never want to do this, but it may be useful for administrative or configuration
 * tweaking utilities to have access to this information.
 *
 * Note that in the case of mandatory keys, the result of dconf_client_read_no_default() with a fallback
 * to dconf_client_read_default() is not necessarily the same as the result of a dconf_client_read().
 * This is because the user may have set a value before the key became marked as mandatory, in which
 * case this call will see the user's (otherwise inaccessible) key.
 **/
GVariant* dconf_client_read_no_default (DConfClient* self, const gchar* key) {
      GVariant* result = NULL;
      GVariant* _tmp0_ = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (key != NULL, NULL);
      _tmp0_ = dconf_engine_read_no_default (self->priv->engine, key);
      result = _tmp0_;
      return result;
}


/**
 * dconf_client_list:
 * @client: a #DConfClient
 * @dir: a dconf dir
 * @length: the number of items that were returned
 * Returns: (array length=length): the paths located directly below @dir
 *
 * Lists the keys and dirs located directly below @dir.
 *
 * You should free the return result with g_strfreev() when it is no longer needed.
 **/
gchar** dconf_client_list (DConfClient* self, const gchar* dir, int* result_length1) {
      gchar** result = NULL;
      gint _tmp0_;
      gchar** _tmp1_ = NULL;
      gchar** _tmp2_;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (dir != NULL, NULL);
      _tmp1_ = dconf_engine_list (self->priv->engine, dir, NULL, &_tmp0_);
      _tmp2_ = _tmp1_;
      *result_length1 = _tmp0_;
      result = _tmp2_;
      return result;
}


/**
 * dconf_client_watch:
 * @client: a #DConfClient
 * @path: a dconf path
 * @cancellable: a #GCancellable, or %NULL
 * @error: a pointer to a %NULL #GError, or %NULL
 * Returns: %TRUE on success, else %FALSE with @error set
 *
 * Requests monitoring of a portion of the dconf database.
 *
 * If @path is a key (ie: doesn't end with a slash) then a single key is monitored for changes.  If
 * @path is a dir (ie: sending with a slash) then all keys that have @path as a prefix are monitored.
 *
 * This function blocks until the watch has definitely been established with the bus daemon.  If you
 * would like a non-blocking version of this call, see dconf_client_watch_async().
 **/
gboolean dconf_client_watch (DConfClient* self, const gchar* path, GCancellable* cancellable, GError** error) {
      gboolean result = FALSE;
      DConfEngineMessage _tmp0_ = {0};
      DConfEngineMessage _tmp1_ = {0};
      DConfEngineMessage _tmp2_;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (path != NULL, FALSE);
      dconf_engine_watch (self->priv->engine, path, &_tmp0_);
      _tmp1_ = _tmp0_;
      _tmp2_ = _tmp1_;
      dconf_client_call_sync (self, &_tmp2_, NULL, cancellable, &_inner_error_);
      dconf_engine_message_destroy (&_tmp2_);
      if (_inner_error_ != NULL) {
            g_propagate_error (error, _inner_error_);
            return FALSE;
      }
      result = TRUE;
      return result;
}


static void dconf_client_watch_async_data_free (gpointer _data) {
      DconfClientWatchAsyncData* data;
      data = _data;
      _g_free0 (data->name);
      _g_object_unref0 (data->cancellable);
      _g_object_unref0 (data->self);
      g_slice_free (DconfClientWatchAsyncData, data);
}


void dconf_client_watch_async (DConfClient* self, const gchar* name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
      DconfClientWatchAsyncData* _data_;
      _data_ = g_slice_new0 (DconfClientWatchAsyncData);
      _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, dconf_client_watch_async);
      g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, dconf_client_watch_async_data_free);
      _data_->self = _g_object_ref0 (self);
      _data_->name = g_strdup (name);
      _data_->cancellable = _g_object_ref0 (cancellable);
      dconf_client_watch_async_co (_data_);
}


gboolean dconf_client_watch_finish (DConfClient* self, GAsyncResult* _res_, GError** error) {
      gboolean result;
      DconfClientWatchAsyncData* _data_;
      if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
            return FALSE;
      }
      _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
      result = _data_->result;
      return result;
}


/**
 * dconf_client_watch_async:
 * @client: a #DConfClient
 * @path: a dconf path
 * @cancellable: a #GCancellable, or %NULL
 * @callback: a #GAsyncReadyCallback to call when finished
 * @user_data: a pointer to pass as the last argument to @callback
 *
 * Requests monitoring of a portion of the dconf database.
 *
 * This is the asynchronous version of dconf_client_watch().  You should call
 * dconf_client_watch_finish() from @callback to collect the result.
 **/
static void dconf_client_watch_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
      DconfClientWatchAsyncData* data;
      data = _user_data_;
      data->_source_object_ = source_object;
      data->_res_ = _res_;
      dconf_client_watch_async_co (data);
}


static gboolean dconf_client_watch_async_co (DconfClientWatchAsyncData* data) {
      switch (data->_state_) {
            case 0:
            goto _state_0;
            case 1:
            goto _state_1;
            default:
            g_assert_not_reached ();
      }
      _state_0:
      memset (&data->_tmp0_, 0, sizeof (DConfEngineMessage));
      dconf_engine_watch (data->self->priv->engine, data->name, &data->_tmp0_);
      memset (&data->_tmp1_, 0, sizeof (DConfEngineMessage));
      data->_tmp1_ = data->_tmp0_;
      data->_tmp2_ = data->_tmp1_;
      data->_state_ = 1;
      dconf_client_call_async (data->self, &data->_tmp2_, data->cancellable, dconf_client_watch_async_ready, data);
      return FALSE;
      _state_1:
      dconf_client_call_finish (data->self, data->_res_, NULL, &data->_inner_error_);
      dconf_engine_message_destroy (&data->_tmp2_);
      if (data->_inner_error_ != NULL) {
            g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
            g_error_free (data->_inner_error_);
            if (data->_state_ == 0) {
                  g_simple_async_result_complete_in_idle (data->_async_result);
            } else {
                  g_simple_async_result_complete (data->_async_result);
            }
            g_object_unref (data->_async_result);
            return FALSE;
      }
      data->result = TRUE;
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
}


/**
 * dconf_client_unwatch:
 * @client: a #DConfClient
 * @path: a dconf path
 * @cancellable: a #GCancellable, or %NULL
 * @error: a pointer to a %NULL #GError, or %NULL
 * Returns: %TRUE on success, else %FALSE with @error set
 *
 * Cancels the effect of a previous call to dconf_client_watch().
 *
 * If the same path has been watched multiple times then only one of the watches is cancelled and the
 * net effect is that the path is still watched.
 *
 * This function blocks until the watch has definitely been removed from the bus daemon.  It is possible
 * that notifications in transit will arrive after this call returns.  For an asynchronous version of
 * this call, see dconf_client_unwatch_async().
 **/
gboolean dconf_client_unwatch (DConfClient* self, const gchar* name, GCancellable* cancellable, GError** error) {
      gboolean result = FALSE;
      DConfEngineMessage _tmp0_ = {0};
      DConfEngineMessage _tmp1_ = {0};
      DConfEngineMessage _tmp2_;
      GError * _inner_error_ = NULL;
      g_return_val_if_fail (self != NULL, FALSE);
      g_return_val_if_fail (name != NULL, FALSE);
      dconf_engine_unwatch (self->priv->engine, name, &_tmp0_);
      _tmp1_ = _tmp0_;
      _tmp2_ = _tmp1_;
      dconf_client_call_sync (self, &_tmp2_, NULL, cancellable, &_inner_error_);
      dconf_engine_message_destroy (&_tmp2_);
      if (_inner_error_ != NULL) {
            g_propagate_error (error, _inner_error_);
            return FALSE;
      }
      result = TRUE;
      return result;
}


static void dconf_client_unwatch_async_data_free (gpointer _data) {
      DconfClientUnwatchAsyncData* data;
      data = _data;
      _g_free0 (data->name);
      _g_object_unref0 (data->cancellable);
      _g_object_unref0 (data->self);
      g_slice_free (DconfClientUnwatchAsyncData, data);
}


void dconf_client_unwatch_async (DConfClient* self, const gchar* name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
      DconfClientUnwatchAsyncData* _data_;
      _data_ = g_slice_new0 (DconfClientUnwatchAsyncData);
      _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, dconf_client_unwatch_async);
      g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, dconf_client_unwatch_async_data_free);
      _data_->self = _g_object_ref0 (self);
      _data_->name = g_strdup (name);
      _data_->cancellable = _g_object_ref0 (cancellable);
      dconf_client_unwatch_async_co (_data_);
}


gboolean dconf_client_unwatch_finish (DConfClient* self, GAsyncResult* _res_, GError** error) {
      gboolean result;
      DconfClientUnwatchAsyncData* _data_;
      if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
            return FALSE;
      }
      _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
      result = _data_->result;
      return result;
}


/**
 * dconf_client_unwatch_async:
 * @client: a #DConfClient
 * @path: a dconf path
 * @cancellable: a #GCancellable, or %NULL
 * @callback: a #GAsyncReadyCallback to call when finished
 * @user_data: a pointer to pass as the last argument to @callback
 *
 * Cancels the effect of a previous call to dconf_client_watch().
 *
 * This is the asynchronous version of dconf_client_unwatch().  You should call
 * dconf_client_unwatch_finish() from @callback to collect the result.  No additional notifications will
 * be delivered for this watch after @callback is called.
 **/
static void dconf_client_unwatch_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
      DconfClientUnwatchAsyncData* data;
      data = _user_data_;
      data->_source_object_ = source_object;
      data->_res_ = _res_;
      dconf_client_unwatch_async_co (data);
}


static gboolean dconf_client_unwatch_async_co (DconfClientUnwatchAsyncData* data) {
      switch (data->_state_) {
            case 0:
            goto _state_0;
            case 1:
            goto _state_1;
            default:
            g_assert_not_reached ();
      }
      _state_0:
      memset (&data->_tmp0_, 0, sizeof (DConfEngineMessage));
      dconf_engine_unwatch (data->self->priv->engine, data->name, &data->_tmp0_);
      memset (&data->_tmp1_, 0, sizeof (DConfEngineMessage));
      data->_tmp1_ = data->_tmp0_;
      data->_tmp2_ = data->_tmp1_;
      data->_state_ = 1;
      dconf_client_call_async (data->self, &data->_tmp2_, data->cancellable, dconf_client_unwatch_async_ready, data);
      return FALSE;
      _state_1:
      dconf_client_call_finish (data->self, data->_res_, NULL, &data->_inner_error_);
      dconf_engine_message_destroy (&data->_tmp2_);
      if (data->_inner_error_ != NULL) {
            g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
            g_error_free (data->_inner_error_);
            if (data->_state_ == 0) {
                  g_simple_async_result_complete_in_idle (data->_async_result);
            } else {
                  g_simple_async_result_complete (data->_async_result);
            }
            g_object_unref (data->_async_result);
            return FALSE;
      }
      data->result = TRUE;
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
      if (data->_state_ == 0) {
            g_simple_async_result_complete_in_idle (data->_async_result);
      } else {
            g_simple_async_result_complete (data->_async_result);
      }
      g_object_unref (data->_async_result);
      return FALSE;
}


/**
 * dconf_client_new:
 * @profile: the dconf profile to use, or %NULL
 * @watch_func: the function to call when changes occur
 * @user_data: the user_data to pass to @watch_func
 * @notify: the function to free @user_data when no longer needed
 * Returns: a new #DConfClient
 *
 * Creates a new #DConfClient for the given context.
 *
 * If @profile is non-%NULL then it specifies the name of the profile to use.  If @profile is %NULL then
 * the DCONF_PROFILE environment variable is consulted.  If that is unset then the default profile of
 * "user" is used.  If a profile named "user" is not installed then the dconf client is setup to access
 * ~/.config/dconf/user.
 **/
DConfClient* dconf_client_construct (GType object_type, const gchar* profile, DConfWatchFunc watch_func, void* watch_func_target, GDestroyNotify watch_func_target_destroy_notify) {
      DConfClient * self = NULL;
      DConfEngine* _tmp0_ = NULL;
      DConfWatchFunc _tmp1_;
      self = (DConfClient*) g_object_new (object_type, NULL);
      _tmp0_ = dconf_engine_new (profile);
      _dconf_engine_free0 (self->priv->engine);
      self->priv->engine = _tmp0_;
      _tmp1_ = watch_func;
      (self->priv->watch_func_target_destroy_notify == NULL) ? NULL : (self->priv->watch_func_target_destroy_notify (self->priv->watch_func_target), NULL);
      self->priv->watch_func = NULL;
      self->priv->watch_func_target = NULL;
      self->priv->watch_func_target_destroy_notify = NULL;
      self->priv->watch_func = _tmp1_;
      self->priv->watch_func_target = watch_func_target;
      self->priv->watch_func_target_destroy_notify = NULL;
      (watch_func_target_destroy_notify == NULL) ? NULL : (watch_func_target_destroy_notify (watch_func_target), NULL);
      watch_func = NULL;
      watch_func_target = NULL;
      watch_func_target_destroy_notify = NULL;
      return self;
}


DConfClient* dconf_client_new (const gchar* profile, DConfWatchFunc watch_func, void* watch_func_target, GDestroyNotify watch_func_target_destroy_notify) {
      return dconf_client_construct (DCONF_TYPE_CLIENT, profile, watch_func, watch_func_target, watch_func_target_destroy_notify);
}


static void dconf_client_class_init (DConfClientClass * klass) {
      dconf_client_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (DConfClientPrivate));
      G_OBJECT_CLASS (klass)->finalize = dconf_client_finalize;
}


static void dconf_client_instance_init (DConfClient * self) {
      self->priv = DCONF_CLIENT_GET_PRIVATE (self);
}


static void dconf_client_finalize (GObject* obj) {
      DConfClient * self;
      self = DCONF_CLIENT (obj);
      _g_object_unref0 (self->priv->session);
      _g_object_unref0 (self->priv->system);
      (self->priv->watch_func_target_destroy_notify == NULL) ? NULL : (self->priv->watch_func_target_destroy_notify (self->priv->watch_func_target), NULL);
      self->priv->watch_func = NULL;
      self->priv->watch_func_target = NULL;
      self->priv->watch_func_target_destroy_notify = NULL;
      _dconf_engine_free0 (self->priv->engine);
      G_OBJECT_CLASS (dconf_client_parent_class)->finalize (obj);
}


GType dconf_client_get_type (void) {
      static volatile gsize dconf_client_type_id__volatile = 0;
      if (g_once_init_enter (&dconf_client_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (DConfClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dconf_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DConfClient), 0, (GInstanceInitFunc) dconf_client_instance_init, NULL };
            GType dconf_client_type_id;
            dconf_client_type_id = g_type_register_static (G_TYPE_OBJECT, "DConfClient", &g_define_type_info, 0);
            g_once_init_leave (&dconf_client_type_id__volatile, dconf_client_type_id);
      }
      return dconf_client_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      if ((array != NULL) && (destroy_func != NULL)) {
            int i;
            for (i = 0; i < array_length; i = i + 1) {
                  if (((gpointer*) array)[i] != NULL) {
                        destroy_func (((gpointer*) array)[i]);
                  }
            }
      }
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
      _vala_array_destroy (array, array_length, destroy_func);
      g_free (array);
}


static gint _vala_array_length (gpointer array) {
      int length;
      length = 0;
      if (array) {
            while (((gpointer*) array)[length]) {
                  length++;
            }
      }
      return length;
}




Generated by  Doxygen 1.6.0   Back to index