Author: akv
Date: 2013-04-24 19:02:05 +0200 (Wed, 24 Apr 2013)
New Revision: 4359
Modified:
branches/4175-enfuse/src/gtk-helper.c
Log:
Saving data from combobox in conf.
Modified: branches/4175-enfuse/src/gtk-helper.c
===================================================================
--- branches/4175-enfuse/src/gtk-helper.c 2013-04-23 21:52:48 UTC (rev
4358)
+++ branches/4175-enfuse/src/gtk-helper.c 2013-04-24 17:02:05 UTC (rev
4359)
@@ -833,9 +833,19 @@
return rs_color_space_icc_new_from_icc(profile);
}
+void
+combobox_changed(GtkComboBox *combo, const gchar *conf_key) {
+ rs_conf_set_integer(conf_key, gtk_combo_box_get_active(combo));
+}
+
GtkWidget *
rs_combobox_new(const gchar *text, GtkListStore *store, const gchar *conf_key)
{
+ gint selected;
+
+ if (!rs_conf_get_integer(conf_key, &selected))
+ selected = 0;
+
GtkWidget *combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
GtkWidget *label = gtk_label_new(text);
@@ -845,7 +855,9 @@
GtkCellRenderer *cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, "text", 0,
NULL);
- gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), selected);
+ g_signal_connect(combo, "changed", G_CALLBACK(combobox_changed), (gpointer)
conf_key);
+
return hbox;
}
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit