示例#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);
}
示例#2
0
文件: setup.c 项目: ueno/ibus-m17n
static void
setup_dialog_load_config (SetupDialog *dialog)
{
    GVariant *values;
    GdkColor defcol;
    GtkCellRenderer *renderer;

    values = ibus_config_get_values (dialog->config, dialog->section);
    /* ibus_config_get_values may return NULL on failure */
    if (values == NULL) {
        GVariantType *child_type = g_variant_type_new ("{sv}");
        values = g_variant_new_array (child_type, NULL, 0);
        g_variant_type_free (child_type);
    }

    /* General -> Pre-edit Appearance */
    /* foreground color of pre-edit buffer */
    _gdk_color_from_uint (PREEDIT_FOREGROUND, &defcol);
    load_color (values,
                GTK_TOGGLE_BUTTON (dialog->checkbutton_foreground),
                GTK_COLOR_BUTTON (dialog->colorbutton_foreground),
                "preedit_foreground",
                &defcol);
    g_signal_connect (dialog->checkbutton_foreground, "toggled",
                      G_CALLBACK (on_foreground_toggled), dialog);

    /* background color of pre-edit buffer */
    _gdk_color_from_uint (PREEDIT_BACKGROUND, &defcol);
    load_color (values,
                GTK_TOGGLE_BUTTON (dialog->checkbutton_background),
                GTK_COLOR_BUTTON (dialog->colorbutton_background),
                "preedit_background",
                &defcol);
    g_signal_connect (dialog->checkbutton_background, "toggled",
                      G_CALLBACK (on_background_toggled), dialog);

    /* underline of pre-edit buffer */
    load_choice (values,
                 GTK_COMBO_BOX (dialog->combobox_underline),
                 "preedit_underline",
                 IBUS_ATTR_UNDERLINE_NONE);

    /* General -> Other */
    /* lookup table orientation */
    load_choice (values,
                 GTK_COMBO_BOX (dialog->combobox_orientation),
                 "lookup_table_orientation",
                 IBUS_ORIENTATION_SYSTEM);

    /* Advanced -> m17n-lib configuration */
    dialog->store = gtk_list_store_new (NUM_COLS,
                                        G_TYPE_STRING,
                                        G_TYPE_STRING,
                                        G_TYPE_STRING);
    insert_m17n_items (dialog->store, dialog->lang, dialog->name);

    gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview),
                             GTK_TREE_MODEL (dialog->store));

    renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes
        (GTK_TREE_VIEW (dialog->treeview), -1,
         "Key",
         renderer,
         "text", COLUMN_KEY,
         NULL);
    renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes
        (GTK_TREE_VIEW (dialog->treeview), -1,
         "Value",
         renderer,
         "text", COLUMN_VALUE,
         NULL);
    g_object_set (renderer, "editable", TRUE, NULL);
    g_signal_connect (renderer, "edited", G_CALLBACK (on_edited), dialog);

    g_signal_connect (dialog->treeview, "query-tooltip",
                      G_CALLBACK (on_query_tooltip), NULL);

    g_variant_unref (values);
}