Ejemplo n.º 1
0
void preferences_load (Preferences* self) {
	IBusConfig* _tmp0_;
	GVariant* _tmp1_ = NULL;
	GVariant* _tmp2_;
	GVariant* values;
	GVariant* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->config;
	_tmp1_ = ibus_config_get_values (_tmp0_, "engine/skk");
	_tmp2_ = _g_variant_ref0 (_tmp1_);
	values = _tmp2_;
	_tmp3_ = values;
	if (_tmp3_ != NULL) {
		GVariant* _tmp4_;
		GVariantIter* _tmp5_ = NULL;
		GVariantIter* iter;
		GVariant* entry;
		_tmp4_ = values;
		_tmp5_ = g_variant_iter_new (_tmp4_);
		iter = _tmp5_;
		entry = NULL;
		while (TRUE) {
			GVariantIter* _tmp6_;
			GVariant* _tmp7_ = NULL;
			GVariant* _tmp8_;
			gchar* name = NULL;
			GVariant* value = NULL;
			GVariant* _tmp9_;
			GeeMap* _tmp10_;
			const gchar* _tmp11_;
			GVariant* _tmp12_;
			_tmp6_ = iter;
			_tmp7_ = g_variant_iter_next_value (_tmp6_);
			_g_variant_unref0 (entry);
			entry = _tmp7_;
			_tmp8_ = entry;
			if (!(_tmp8_ != NULL)) {
				break;
			}
			_tmp9_ = entry;
			g_variant_get (_tmp9_, "{sv}", &name, &value, NULL);
			_tmp10_ = self->priv->current;
			_tmp11_ = name;
			_tmp12_ = value;
			gee_map_set (_tmp10_, _tmp11_, _tmp12_);
			_g_variant_unref0 (value);
			_g_free0 (name);
		}
		_g_variant_unref0 (entry);
		_g_variant_iter_free0 (iter);
	}
	_g_variant_unref0 (values);
}
Ejemplo n.º 2
0
void deja_dup_simple_settings_set_value (DejaDupSimpleSettings* self, const gchar* k, GVariant* v) {
	const gchar* _tmp0_;
	GVariant* _tmp1_ = NULL;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	g_return_if_fail (v != NULL);
	_tmp0_ = k;
	_tmp1_ = g_settings_get_value ((GSettings*) self, _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = v;
	_tmp4_ = g_variant_equal (_tmp2_, _tmp3_);
	_tmp5_ = !_tmp4_;
	_g_variant_unref0 (_tmp2_);
	if (_tmp5_) {
		const gchar* _tmp6_;
		GVariant* _tmp7_;
		_tmp6_ = k;
		_tmp7_ = v;
		g_settings_set_value (G_SETTINGS (self), _tmp6_, _tmp7_);
	}
}
Ejemplo n.º 3
0
GVariant* preferences_get (Preferences* self, const gchar* name) {
	GVariant* result = NULL;
	GeeMap* _tmp0_;
	const gchar* _tmp1_;
	gpointer _tmp2_ = NULL;
	GVariant* value;
	GVariant* _tmp3_;
	GeeMap* _tmp4_;
	const gchar* _tmp5_;
	gpointer _tmp6_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->current;
	_tmp1_ = name;
	_tmp2_ = gee_map_get (_tmp0_, _tmp1_);
	value = (GVariant*) _tmp2_;
	_tmp3_ = value;
	if (_tmp3_ != NULL) {
		result = value;
		return result;
	}
	_tmp4_ = self->priv->_default;
	_tmp5_ = name;
	_tmp6_ = gee_map_get (_tmp4_, _tmp5_);
	result = (GVariant*) _tmp6_;
	_g_variant_unref0 (value);
	return result;
}
Ejemplo n.º 4
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);
}
Ejemplo n.º 5
0
static void deja_dup_config_rel_path_real_write_to_config (DejaDupConfigEntry* base) {
	DejaDupConfigRelPath * self;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_ = NULL;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	GVariant* val;
	DejaDupSimpleSettings* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	self = (DejaDupConfigRelPath*) base;
	_tmp0_ = ((DejaDupConfigEntry*) self)->entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = g_variant_new_bytestring (_tmp1_);
	_tmp3_ = g_variant_ref_sink (_tmp2_);
	val = _tmp3_;
	_tmp4_ = ((DejaDupConfigWidget*) self)->settings;
	_tmp5_ = deja_dup_config_widget_get_key ((DejaDupConfigWidget*) self);
	_tmp6_ = _tmp5_;
	deja_dup_simple_settings_set_value (_tmp4_, _tmp6_, val);
	_g_variant_unref0 (val);
}
Ejemplo n.º 6
0
static gboolean deja_dup_config_rel_path_real_set_from_config_co (DejaDupConfigRelPathSetFromConfigData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((DejaDupConfigWidget*) _data_->self)->settings;
	_data_->_tmp1_ = deja_dup_config_widget_get_key ((DejaDupConfigWidget*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = g_settings_get_value ((GSettings*) _data_->_tmp0_, _data_->_tmp2_);
	_data_->byte_val = _data_->_tmp3_;
	_data_->val = NULL;
	{
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = g_variant_get_bytestring (_data_->byte_val);
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = g_filename_to_utf8 (_data_->_tmp4_, (gssize) (-1), NULL, NULL, &_data_->_inner_error_);
		_data_->_tmp6_ = _data_->_tmp5_;
		if (_data_->_inner_error_ != NULL) {
			goto __catch6_g_error;
		}
		_g_free0 (_data_->val);
		_data_->val = _data_->_tmp6_;
	}
	goto __finally6;
	__catch6_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("ConfigRelPath.vala:39: %s\n", _data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally6:
	if (_data_->_inner_error_ != NULL) {
		_g_free0 (_data_->val);
		_g_variant_unref0 (_data_->byte_val);
		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;
	}
	_data_->_tmp9_ = _data_->val;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp10_ = g_strdup ("");
		_g_free0 (_data_->val);
		_data_->val = _data_->_tmp10_;
	}
	_data_->_tmp11_ = ((DejaDupConfigEntry*) _data_->self)->entry;
	_data_->_tmp12_ = _data_->val;
	gtk_entry_set_text (_data_->_tmp11_, _data_->_tmp12_);
	_g_free0 (_data_->val);
	_g_variant_unref0 (_data_->byte_val);
	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;
}
Ejemplo n.º 7
0
void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) {
	static const char key[] = "interested-media-players";
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GVariantBuilder* players;
	GSettings* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_ = NULL;
	GVariantBuilder* _tmp12_;
	const gchar* _tmp13_;
	GSettings* _tmp14_;
	GVariantBuilder* _tmp15_;
	GVariant* _tmp16_ = NULL;
	GVariant* _tmp17_;
	GSettings* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_desktop_name != NULL);
	_tmp0_ = g_variant_type_new ("as");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	players = _tmp3_;
	_tmp4_ = self->priv->settings;
	_tmp6_ = _tmp5_ = g_settings_get_strv (_tmp4_, key);
	{
		gchar** player_collection = NULL;
		gint player_collection_length1 = 0;
		gint _player_collection_size_ = 0;
		gint player_it = 0;
		player_collection = _tmp6_;
		player_collection_length1 = _vala_array_length (_tmp5_);
		for (player_it = 0; player_it < _vala_array_length (_tmp5_); player_it = player_it + 1) {
			gchar* _tmp7_;
			gchar* player = NULL;
			_tmp7_ = g_strdup (player_collection[player_it]);
			player = _tmp7_;
			{
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				GVariantBuilder* _tmp10_;
				const gchar* _tmp11_;
				_tmp8_ = player;
				_tmp9_ = app_desktop_name;
				if (g_strcmp0 (_tmp8_, _tmp9_) == 0) {
					_g_free0 (player);
					player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
					_g_variant_builder_unref0 (players);
					return;
				}
				_tmp10_ = players;
				_tmp11_ = player;
				g_variant_builder_add (_tmp10_, "s", _tmp11_, NULL);
				_g_free0 (player);
			}
		}
		player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = players;
	_tmp13_ = app_desktop_name;
	g_variant_builder_add (_tmp12_, "s", _tmp13_, NULL);
	_tmp14_ = self->priv->settings;
	_tmp15_ = players;
	_tmp16_ = g_variant_builder_end (_tmp15_);
	_tmp17_ = g_variant_ref_sink (_tmp16_);
	g_settings_set_value (_tmp14_, key, _tmp17_);
	_g_variant_unref0 (_tmp17_);
	_tmp18_ = self->priv->settings;
	g_settings_apply (_tmp18_);
	_g_variant_builder_unref0 (players);
}
Ejemplo n.º 8
0
Preferences* preferences_construct (GType object_type, IBusConfig* config) {
	Preferences * self = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* dictionaries;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_;
	GeeMap* _tmp4_;
	gint _tmp5_ = 0;
	gpointer* _tmp6_ = NULL;
	gchar** _tmp7_;
	gint _tmp7__length1;
	GVariant* _tmp8_;
	GVariant* _tmp9_;
	GeeMap* _tmp10_;
	GVariant* _tmp11_;
	GVariant* _tmp12_;
	GeeMap* _tmp13_;
	GVariant* _tmp14_;
	GVariant* _tmp15_;
	GeeMap* _tmp16_;
	GVariant* _tmp17_;
	GVariant* _tmp18_;
	GeeMap* _tmp19_;
	GVariant* _tmp20_;
	GVariant* _tmp21_;
	GeeMap* _tmp22_;
	GVariant* _tmp23_;
	GVariant* _tmp24_;
	GeeMap* _tmp25_;
	GVariant* _tmp26_;
	GVariant* _tmp27_;
	GeeMap* _tmp28_;
	GVariant* _tmp29_;
	GVariant* _tmp30_;
	GeeMap* _tmp31_;
	GVariant* _tmp32_;
	GVariant* _tmp33_;
	IBusConfig* _tmp34_;
	IBusConfig* _tmp35_;
	IBusConfig* _tmp36_;
	g_return_val_if_fail (config != NULL, NULL);
	self = (Preferences*) g_object_new (object_type, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	dictionaries = _tmp0_;
	_tmp1_ = g_get_user_config_dir ();
	_tmp2_ = g_strdup_printf ("type=file,file=%s/ibus-skk/user.dict,mode=readwrite", _tmp1_);
	_tmp3_ = _tmp2_;
	gee_abstract_collection_add ((GeeAbstractCollection*) dictionaries, _tmp3_);
	_g_free0 (_tmp3_);
	gee_abstract_collection_add ((GeeAbstractCollection*) dictionaries, "type=file,file=/usr/share/skk/SKK-JISYO.L,mode=readonly");
	gee_abstract_collection_add ((GeeAbstractCollection*) dictionaries, "type=server,host=localhost,port=1178");
	_tmp4_ = self->priv->_default;
	_tmp6_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) dictionaries, &_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp7__length1 = _tmp5_;
	_tmp8_ = g_variant_new_strv (_tmp7_, _tmp5_);
	_tmp9_ = g_variant_ref_sink (_tmp8_);
	gee_map_set (_tmp4_, "dictionaries", _tmp9_);
	_g_variant_unref0 (_tmp9_);
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	_tmp10_ = self->priv->_default;
	_tmp11_ = g_variant_new_strv (PREFERENCES_AUTO_START_HENKAN_KEYWORDS, G_N_ELEMENTS (PREFERENCES_AUTO_START_HENKAN_KEYWORDS));
	_tmp12_ = g_variant_ref_sink (_tmp11_);
	gee_map_set (_tmp10_, "auto_start_henkan_keywords", _tmp12_);
	_g_variant_unref0 (_tmp12_);
	_tmp13_ = self->priv->_default;
	_tmp14_ = g_variant_new_int32 ((gint32) SKK_PERIOD_STYLE_JA_JA);
	_tmp15_ = g_variant_ref_sink (_tmp14_);
	gee_map_set (_tmp13_, "period_style", _tmp15_);
	_g_variant_unref0 (_tmp15_);
	_tmp16_ = self->priv->_default;
	_tmp17_ = g_variant_new_int32 ((gint32) 7);
	_tmp18_ = g_variant_ref_sink (_tmp17_);
	gee_map_set (_tmp16_, "page_size", _tmp18_);
	_g_variant_unref0 (_tmp18_);
	_tmp19_ = self->priv->_default;
	_tmp20_ = g_variant_new_int32 ((gint32) 4);
	_tmp21_ = g_variant_ref_sink (_tmp20_);
	gee_map_set (_tmp19_, "pagination_start", _tmp21_);
	_g_variant_unref0 (_tmp21_);
	_tmp22_ = self->priv->_default;
	_tmp23_ = g_variant_new_boolean (TRUE);
	_tmp24_ = g_variant_ref_sink (_tmp23_);
	gee_map_set (_tmp22_, "show_annotation", _tmp24_);
	_g_variant_unref0 (_tmp24_);
	_tmp25_ = self->priv->_default;
	_tmp26_ = g_variant_new_int32 ((gint32) SKK_INPUT_MODE_HIRAGANA);
	_tmp27_ = g_variant_ref_sink (_tmp26_);
	gee_map_set (_tmp25_, "initial_input_mode", _tmp27_);
	_g_variant_unref0 (_tmp27_);
	_tmp28_ = self->priv->_default;
	_tmp29_ = g_variant_new_boolean (FALSE);
	_tmp30_ = g_variant_ref_sink (_tmp29_);
	gee_map_set (_tmp28_, "egg_like_newline", _tmp30_);
	_g_variant_unref0 (_tmp30_);
	_tmp31_ = self->priv->_default;
	_tmp32_ = g_variant_new_string ("default");
	_tmp33_ = g_variant_ref_sink (_tmp32_);
	gee_map_set (_tmp31_, "typing_rule", _tmp33_);
	_g_variant_unref0 (_tmp33_);
	_tmp34_ = config;
	_tmp35_ = _g_object_ref0 (_tmp34_);
	_g_object_unref0 (self->priv->config);
	self->priv->config = _tmp35_;
	preferences_load (self);
	_tmp36_ = config;
	g_signal_connect_object (_tmp36_, "value-changed", (GCallback) _preferences_value_changed_cb_ibus_config_value_changed, self, 0);
	_g_object_unref0 (dictionaries);
	return self;
}