/* settings-daemon.c generated by valac 0.16.1, the Vala compiler * generated from settings-daemon.vala, do not modify */ /* -*- Mode:Vala; indent-tabs-mode:nil; tab-width:4 -*- * * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Michael Terry */ #include #include #include #include #include #define TYPE_SETTINGS_DAEMON (settings_daemon_get_type ()) #define SETTINGS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_DAEMON, SettingsDaemon)) #define SETTINGS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_DAEMON, SettingsDaemonClass)) #define IS_SETTINGS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_DAEMON)) #define IS_SETTINGS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_DAEMON)) #define SETTINGS_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_DAEMON, SettingsDaemonClass)) typedef struct _SettingsDaemon SettingsDaemon; typedef struct _SettingsDaemonClass SettingsDaemonClass; typedef struct _SettingsDaemonPrivate SettingsDaemonPrivate; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) typedef struct _SettingsDaemonStartData SettingsDaemonStartData; #define _g_free0(var) (var = (g_free (var), NULL)) #define __vala_GSettingsSchema_free0(var) ((var == NULL) ? NULL : (var = (_vala_GSettingsSchema_free (var), NULL))) #define __vala_GSettingsSchemaSource_free0(var) ((var == NULL) ? NULL : (var = (_vala_GSettingsSchemaSource_free (var), NULL))) #define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL))) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) typedef struct _SettingsDaemonRunData SettingsDaemonRunData; struct _SettingsDaemon { GObject parent_instance; SettingsDaemonPrivate * priv; }; struct _SettingsDaemonClass { GObjectClass parent_class; }; struct _SettingsDaemonStartData { int _state_; GObject* _source_object_; GAsyncResult* _res_; GSimpleAsyncResult* _async_result; SettingsDaemon* self; }; struct _SettingsDaemonRunData { int _state_; GObject* _source_object_; GAsyncResult* _res_; GSimpleAsyncResult* _async_result; SettingsDaemon* self; GDBusProxy* _tmp0_; GDBusProxy* proxy; GDBusProxy* _tmp1_; GVariant* _tmp2_; GVariant* _tmp3_; GError* e; GError* _tmp4_; const gchar* _tmp5_; GError * _inner_error_; }; static gpointer settings_daemon_parent_class = NULL; GType settings_daemon_get_type (void) G_GNUC_CONST; enum { SETTINGS_DAEMON_DUMMY_PROPERTY }; static void settings_daemon_start_data_free (gpointer _data); void settings_daemon_start (SettingsDaemon* self, GAsyncReadyCallback _callback_, gpointer _user_data_); void settings_daemon_start_finish (SettingsDaemon* self, GAsyncResult* _res_); static gboolean settings_daemon_start_co (SettingsDaemonStartData* _data_); static void settings_daemon_configure (SettingsDaemon* self); static void settings_daemon_run (SettingsDaemon* self, GAsyncReadyCallback _callback_, gpointer _user_data_); static void settings_daemon_run_finish (SettingsDaemon* self, GAsyncResult* _res_); static void settings_daemon_start_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); static void settings_daemon_set_plugin_enabled (SettingsDaemon* self, const gchar* schema_name, gboolean enabled); static GSettingsSchemaSource* _vala_GSettingsSchemaSource_copy (GSettingsSchemaSource* self); static void _vala_GSettingsSchema_free (GSettingsSchema* self); static void _vala_GSettingsSchemaSource_free (GSettingsSchemaSource* self); static void settings_daemon_run_data_free (gpointer _data); static gboolean settings_daemon_run_co (SettingsDaemonRunData* _data_); static void settings_daemon_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); SettingsDaemon* settings_daemon_new (void); SettingsDaemon* settings_daemon_construct (GType object_type); 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 void settings_daemon_start_data_free (gpointer _data) { SettingsDaemonStartData* _data_; _data_ = _data; _g_object_unref0 (_data_->self); g_slice_free (SettingsDaemonStartData, _data_); } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } void settings_daemon_start (SettingsDaemon* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { SettingsDaemonStartData* _data_; SettingsDaemon* _tmp0_; _data_ = g_slice_new0 (SettingsDaemonStartData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, settings_daemon_start); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, settings_daemon_start_data_free); _tmp0_ = _g_object_ref0 (self); _data_->self = _tmp0_; settings_daemon_start_co (_data_); } void settings_daemon_start_finish (SettingsDaemon* self, GAsyncResult* _res_) { SettingsDaemonStartData* _data_; _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); } static void settings_daemon_start_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { SettingsDaemonStartData* _data_; _data_ = _user_data_; _data_->_source_object_ = source_object; _data_->_res_ = _res_; settings_daemon_start_co (_data_); } static gboolean settings_daemon_start_co (SettingsDaemonStartData* _data_) { switch (_data_->_state_) { case 0: goto _state_0; case 1: goto _state_1; default: g_assert_not_reached (); } _state_0: settings_daemon_configure (_data_->self); _data_->_state_ = 1; settings_daemon_run (_data_->self, settings_daemon_start_ready, _data_); return FALSE; _state_1: settings_daemon_run_finish (_data_->self, _data_->_res_); 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; } static void settings_daemon_configure (SettingsDaemon* self) { gchar* _tmp0_; gchar* _tmp1_; gchar* _tmp2_; gchar* _tmp3_; gchar* _tmp4_; gchar* _tmp5_; gchar* _tmp6_; gchar* _tmp7_; gchar* _tmp8_; gchar* _tmp9_; gchar* _tmp10_; gchar* _tmp11_; gchar* _tmp12_; gchar* _tmp13_; gchar* _tmp14_; gchar** _tmp15_ = NULL; gchar** disabled; gint disabled_length1; gint _disabled_size_; gchar* _tmp16_; gchar* _tmp17_; gchar* _tmp18_; gchar* _tmp19_; gchar* _tmp20_; gchar* _tmp21_; gchar** _tmp22_ = NULL; gchar** enabled; gint enabled_length1; gint _enabled_size_; gchar** _tmp23_; gint _tmp23__length1; gchar** _tmp26_; gint _tmp26__length1; g_return_if_fail (self != NULL); _tmp0_ = g_strdup ("org.gnome.settings-daemon.plugins.background"); _tmp1_ = g_strdup ("org.gnome.settings-daemon.plugins.clipboard"); _tmp2_ = g_strdup ("org.gnome.settings-daemon.plugins.font"); _tmp3_ = g_strdup ("org.gnome.settings-daemon.plugins.gconf"); _tmp4_ = g_strdup ("org.gnome.settings-daemon.plugins.gsdwacom"); _tmp5_ = g_strdup ("org.gnome.settings-daemon.plugins.housekeeping"); _tmp6_ = g_strdup ("org.gnome.settings-daemon.plugins.keybindings"); _tmp7_ = g_strdup ("org.gnome.settings-daemon.plugins.keyboard"); _tmp8_ = g_strdup ("org.gnome.settings-daemon.plugins.media-keys"); _tmp9_ = g_strdup ("org.gnome.settings-daemon.plugins.mouse"); _tmp10_ = g_strdup ("org.gnome.settings-daemon.plugins.print-notifications"); _tmp11_ = g_strdup ("org.gnome.settings-daemon.plugins.smartcard"); _tmp12_ = g_strdup ("org.gnome.settings-daemon.plugins.sound"); _tmp13_ = g_strdup ("org.gnome.settings-daemon.plugins.wacom"); _tmp14_ = g_strdup ("org.gnome.settings-daemon.plugins.xsettings"); _tmp15_ = g_new0 (gchar*, 15 + 1); _tmp15_[0] = _tmp0_; _tmp15_[1] = _tmp1_; _tmp15_[2] = _tmp2_; _tmp15_[3] = _tmp3_; _tmp15_[4] = _tmp4_; _tmp15_[5] = _tmp5_; _tmp15_[6] = _tmp6_; _tmp15_[7] = _tmp7_; _tmp15_[8] = _tmp8_; _tmp15_[9] = _tmp9_; _tmp15_[10] = _tmp10_; _tmp15_[11] = _tmp11_; _tmp15_[12] = _tmp12_; _tmp15_[13] = _tmp13_; _tmp15_[14] = _tmp14_; disabled = _tmp15_; disabled_length1 = 15; _disabled_size_ = disabled_length1; _tmp16_ = g_strdup ("org.gnome.settings-daemon.plugins.a11y-keyboard"); _tmp17_ = g_strdup ("org.gnome.settings-daemon.plugins.a11y-settings"); _tmp18_ = g_strdup ("org.gnome.settings-daemon.plugins.color"); _tmp19_ = g_strdup ("org.gnome.settings-daemon.plugins.cursor"); _tmp20_ = g_strdup ("org.gnome.settings-daemon.plugins.power"); _tmp21_ = g_strdup ("org.gnome.settings-daemon.plugins.xrandr"); _tmp22_ = g_new0 (gchar*, 6 + 1); _tmp22_[0] = _tmp16_; _tmp22_[1] = _tmp17_; _tmp22_[2] = _tmp18_; _tmp22_[3] = _tmp19_; _tmp22_[4] = _tmp20_; _tmp22_[5] = _tmp21_; enabled = _tmp22_; enabled_length1 = 6; _enabled_size_ = enabled_length1; _tmp23_ = disabled; _tmp23__length1 = disabled_length1; { gchar** schema_collection = NULL; gint schema_collection_length1 = 0; gint _schema_collection_size_ = 0; gint schema_it = 0; schema_collection = _tmp23_; schema_collection_length1 = _tmp23__length1; for (schema_it = 0; schema_it < _tmp23__length1; schema_it = schema_it + 1) { gchar* _tmp24_; gchar* schema = NULL; _tmp24_ = g_strdup (schema_collection[schema_it]); schema = _tmp24_; { const gchar* _tmp25_; _tmp25_ = schema; settings_daemon_set_plugin_enabled (self, _tmp25_, FALSE); _g_free0 (schema); } } } _tmp26_ = enabled; _tmp26__length1 = enabled_length1; { gchar** schema_collection = NULL; gint schema_collection_length1 = 0; gint _schema_collection_size_ = 0; gint schema_it = 0; schema_collection = _tmp26_; schema_collection_length1 = _tmp26__length1; for (schema_it = 0; schema_it < _tmp26__length1; schema_it = schema_it + 1) { gchar* _tmp27_; gchar* schema = NULL; _tmp27_ = g_strdup (schema_collection[schema_it]); schema = _tmp27_; { const gchar* _tmp28_; _tmp28_ = schema; settings_daemon_set_plugin_enabled (self, _tmp28_, TRUE); _g_free0 (schema); } } } g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "org.gnome.ScreenSaver", G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL))); enabled = (_vala_array_free (enabled, enabled_length1, (GDestroyNotify) g_free), NULL); disabled = (_vala_array_free (disabled, disabled_length1, (GDestroyNotify) g_free), NULL); } static GSettingsSchemaSource* _vala_GSettingsSchemaSource_copy (GSettingsSchemaSource* self) { return g_boxed_copy (g_settings_schema_source_get_type (), self); } static gpointer __vala_GSettingsSchemaSource_copy0 (gpointer self) { return self ? _vala_GSettingsSchemaSource_copy (self) : NULL; } static void _vala_GSettingsSchema_free (GSettingsSchema* self) { g_boxed_free (g_settings_schema_get_type (), self); } static void _vala_GSettingsSchemaSource_free (GSettingsSchemaSource* self) { g_boxed_free (g_settings_schema_source_get_type (), self); } static void settings_daemon_set_plugin_enabled (SettingsDaemon* self, const gchar* schema_name, gboolean enabled) { GSettingsSchemaSource* _tmp0_ = NULL; GSettingsSchemaSource* _tmp1_; GSettingsSchemaSource* source; GSettingsSchemaSource* _tmp2_; const gchar* _tmp3_; GSettingsSchema* _tmp4_ = NULL; GSettingsSchema* schema; GSettingsSchema* _tmp5_; g_return_if_fail (self != NULL); g_return_if_fail (schema_name != NULL); _tmp0_ = g_settings_schema_source_get_default (); _tmp1_ = __vala_GSettingsSchemaSource_copy0 (_tmp0_); source = _tmp1_; _tmp2_ = source; _tmp3_ = schema_name; _tmp4_ = g_settings_schema_source_lookup (_tmp2_, _tmp3_, FALSE); schema = _tmp4_; _tmp5_ = schema; if (_tmp5_ != NULL) { const gchar* _tmp6_; GSettings* _tmp7_; GSettings* settings; GSettings* _tmp8_; gboolean _tmp9_; _tmp6_ = schema_name; _tmp7_ = g_settings_new (_tmp6_); settings = _tmp7_; _tmp8_ = settings; _tmp9_ = enabled; g_settings_set_boolean (_tmp8_, "active", _tmp9_); _g_object_unref0 (settings); } __vala_GSettingsSchema_free0 (schema); __vala_GSettingsSchemaSource_free0 (source); } static void settings_daemon_run_data_free (gpointer _data) { SettingsDaemonRunData* _data_; _data_ = _data; _g_object_unref0 (_data_->self); g_slice_free (SettingsDaemonRunData, _data_); } static void settings_daemon_run (SettingsDaemon* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { SettingsDaemonRunData* _data_; SettingsDaemon* _tmp0_; _data_ = g_slice_new0 (SettingsDaemonRunData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, settings_daemon_run); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, settings_daemon_run_data_free); _tmp0_ = _g_object_ref0 (self); _data_->self = _tmp0_; settings_daemon_run_co (_data_); } static void settings_daemon_run_finish (SettingsDaemon* self, GAsyncResult* _res_) { SettingsDaemonRunData* _data_; _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); } static void settings_daemon_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { SettingsDaemonRunData* _data_; _data_ = _user_data_; _data_->_source_object_ = source_object; _data_->_res_ = _res_; settings_daemon_run_co (_data_); } static gboolean settings_daemon_run_co (SettingsDaemonRunData* _data_) { switch (_data_->_state_) { case 0: goto _state_0; case 1: goto _state_1; default: g_assert_not_reached (); } _state_0: { _data_->_tmp0_ = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon", "org.gnome.SettingsDaemon", NULL, &_data_->_inner_error_); _data_->proxy = _data_->_tmp0_; if (_data_->_inner_error_ != NULL) { goto __catch11_g_error; } _data_->_tmp1_ = _data_->proxy; _data_->_state_ = 1; g_dbus_proxy_call (_data_->_tmp1_, "Awake", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, settings_daemon_run_ready, _data_); return FALSE; _state_1: _data_->_tmp2_ = NULL; _data_->_tmp2_ = g_dbus_proxy_call_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error_); _data_->_tmp3_ = _data_->_tmp2_; _g_variant_unref0 (_data_->_tmp3_); if (_data_->_inner_error_ != NULL) { _g_object_unref0 (_data_->proxy); goto __catch11_g_error; } _g_object_unref0 (_data_->proxy); } goto __finally11; __catch11_g_error: { _data_->e = _data_->_inner_error_; _data_->_inner_error_ = NULL; _data_->_tmp4_ = _data_->e; _data_->_tmp5_ = _data_->_tmp4_->message; g_debug ("settings-daemon.vala:97: Could not start gnome-settings-daemon over DB" \ "us: %s", _data_->_tmp5_); _g_error_free0 (_data_->e); } __finally11: if (_data_->_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); g_clear_error (&_data_->_inner_error_); 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; } SettingsDaemon* settings_daemon_construct (GType object_type) { SettingsDaemon * self = NULL; self = (SettingsDaemon*) g_object_new (object_type, NULL); return self; } SettingsDaemon* settings_daemon_new (void) { return settings_daemon_construct (TYPE_SETTINGS_DAEMON); } static void settings_daemon_class_init (SettingsDaemonClass * klass) { settings_daemon_parent_class = g_type_class_peek_parent (klass); } static void settings_daemon_instance_init (SettingsDaemon * self) { } GType settings_daemon_get_type (void) { static volatile gsize settings_daemon_type_id__volatile = 0; if (g_once_init_enter (&settings_daemon_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (SettingsDaemonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_daemon_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsDaemon), 0, (GInstanceInitFunc) settings_daemon_instance_init, NULL }; GType settings_daemon_type_id; settings_daemon_type_id = g_type_register_static (G_TYPE_OBJECT, "SettingsDaemon", &g_define_type_info, 0); g_once_init_leave (&settings_daemon_type_id__volatile, settings_daemon_type_id); } return settings_daemon_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); }