Ejemplo n.º 1
0
gboolean ibus_config_backend_write_value(MkdgBackend * backend,
                                         GValue * value,
                                         const gchar * section,
                                         const gchar * key, gpointer userData)
{
    gboolean result = FALSE;
    IBusConfig *config = (IBusConfig *) backend->config;
    gchar confSection[KEY_BUFFER_SIZE];

    to_real_section(confSection, backend, section);
#if IBUS_CHECK_VERSION(1, 4, 0)
    GVariant *gVar = g_variant_ref_sink(mkdg_g_value_to_g_variant(value));

    if (gVar != NULL) {
        result = ibus_config_set_value(config, confSection, key, gVar);
    }
#else
    result = ibus_config_set_value(config, confSection, key, value);
#endif

    if (result == FALSE) {
        mkdg_log(WARN,
                 "ibus_config_backend_write_value(-, %s, -) %s %s",
                 key, "Failed to set variable", key);
        return FALSE;
    }

    if (!config) {
        mkdg_log(WARN,
                 "ibus_config_backend_write_value(-, %s, -) %s",
                 key, "Failed to connect to IBusService");
        return FALSE;
    }
    return TRUE;
}
Ejemplo n.º 2
0
void preferences_save (Preferences* self) {
	GeeMap* _tmp0_;
	GeeMapIterator* _tmp1_ = NULL;
	GeeMapIterator* iter;
	GeeMapIterator* _tmp2_;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current;
	_tmp1_ = gee_map_map_iterator (_tmp0_);
	iter = _tmp1_;
	_tmp2_ = iter;
	_tmp3_ = gee_map_iterator_first (_tmp2_);
	if (_tmp3_) {
		{
			gboolean _tmp4_;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp5_;
				IBusConfig* _tmp8_;
				GeeMapIterator* _tmp9_;
				gpointer _tmp10_ = NULL;
				gchar* _tmp11_;
				GeeMapIterator* _tmp12_;
				gpointer _tmp13_ = NULL;
				GVariant* _tmp14_;
				_tmp5_ = _tmp4_;
				if (!_tmp5_) {
					GeeMapIterator* _tmp6_;
					gboolean _tmp7_ = FALSE;
					_tmp6_ = iter;
					_tmp7_ = gee_map_iterator_next (_tmp6_);
					if (!_tmp7_) {
						break;
					}
				}
				_tmp4_ = FALSE;
				_tmp8_ = self->priv->config;
				_tmp9_ = iter;
				_tmp10_ = gee_map_iterator_get_key (_tmp9_);
				_tmp11_ = (gchar*) _tmp10_;
				_tmp12_ = iter;
				_tmp13_ = gee_map_iterator_get_value (_tmp12_);
				_tmp14_ = (GVariant*) _tmp13_;
				ibus_config_set_value (_tmp8_, "engine/skk", _tmp11_, _tmp14_);
				_g_variant_unref0 (_tmp14_);
				_g_free0 (_tmp11_);
			}
		}
	}
	_g_object_unref0 (iter);
}