NULL);
error = NULL;
- if (!dconf_client_watch (config->client, DCONF_PREFIX"/", NULL, &error))
- g_warning ("Can not watch dconf path %s", DCONF_PREFIX"/");
+ if (!dconf_client_watch (config->client, DCONF_PREFIX"/", NULL, &error)) {
+ g_warning ("Can not watch dconf path %s: %s",
+ DCONF_PREFIX"/", error->message);
+ g_error_free (error);
+ }
#endif
config->preserve_name_prefixes = NULL;
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"/");
+ if (!dconf_client_unwatch (config->client, DCONF_PREFIX"/", NULL, &error)) {
+ g_warning ("Can not unwatch dconf path %s: %s",
+ DCONF_PREFIX"/", error->message);
+ g_error_free (error);
+ }
#endif
g_object_unref (config->client);
g_free (gkey);
if (variant == NULL) {
- *error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
- "Config value [%s:%s] does not exist.", section, name);
+ g_set_error (error,
+ G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Config value [%s:%s] does not exist.",
+ section, name);
return NULL;
}
gv = _to_gconf_value (value);
if (gv == NULL) {
gchar *str = g_variant_print (value, TRUE);
- *error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
- "Can not set config value [%s:%s] to %s.",
- section, name, str);
+ g_set_error (error,
+ G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+ "Can not set config value [%s:%s] to %s.",
+ section, name, str);
g_free (str);
return FALSE;
}
g_free (key);
if (gv == NULL) {
- *error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
- "Config value [%s:%s] does not exist.", section, name);
+ g_set_error (error,
+ G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+ "Config value [%s:%s] does not exist.", section, name);
return NULL;
}
{
gchar *key = g_strdup_printf (GCONF_PREFIX"/%s/%s", section, name);
- gconf_client_unset (((IBusConfigGConf *)config)->client, key, error);
+ gboolean retval = gconf_client_unset (((IBusConfigGConf *)config)->client, key, error);
g_free (key);
- if (*error != NULL) {
- return FALSE;
- }
- return TRUE;
+ return retval;
}
IBusConfigGConf *
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_print ("Option parsing failed: %s\n", error->message);
+ g_error_free (error);
exit (-1);
}
g_variant_new_tuple (NULL, 0));
}
else {
- if (error && *error) {
- *error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
- "Config value [%s:%s] does not exist.", section, name);
- }
+ g_set_error (error,
+ G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+ "Config value [%s:%s] does not exist.",
+ section, name);
}
return retval;
}
{
gboolean retval;
guint timeout_id;
+ GVariant *var;
data->section = NULL;
data->name = NULL;
/* Unset won't notify value-changed signal. */
- retval = ibus_config_unset (config, section, name);
- g_assert (retval);
+ var = ibus_config_get_values (config, section);
+ if (var != NULL) {
+ GVariant *value = g_variant_lookup_value (var, name,
+ G_VARIANT_TYPE_VARIANT);
+ if (value != NULL) {
+ ibus_config_unset (config, section, name);
+ g_variant_unref (value);
+ }
+ g_variant_unref (var);
+ }
timeout_id = g_timeout_add (1, timeout_cb, data);
g_main_loop_run (data->loop);