summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-01-27 16:40:01 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-28 13:17:44 -0800
commit77ece3fccb1a08ef8eea10a9f548bc6a4a3c889e (patch)
tree71dd23e661b88cf690779193a8579a3c6aaa944b /planner.c
parent32e497b5744ef690e91b4a9f22a63109dde4c7df (diff)
downloadsubsurface-77ece3fccb1a08ef8eea10a9f548bc6a4a3c889e.tar.gz
Clean up gtk combo box handling
This cleans up our handling of combo boxes and all the duplicated completion logic, and simplifies the code. In particular, we get rid of the deprecated GtkComboBoxEntry. While it made some things easier, it made other things harder. Just using GtkComboBox and setting that up correctly ends up being simpler, and also makes the logic work with gtk-3. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/planner.c b/planner.c
index f58eec537..1b63a768f 100644
--- a/planner.c
+++ b/planner.c
@@ -931,7 +931,7 @@ static void gas_changed_cb(GtkWidget *combo, gpointer data)
int o2, he;
int idx = data - NULL;
- gastext = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
+ gastext = get_active_text(GTK_COMBO_BOX(combo));
/* stupidly this gets called for two reasons:
* a) any keystroke into the entry field
* b) mouse selection of a dropdown
@@ -1045,8 +1045,6 @@ static gboolean gf_focus_out_cb(GtkWidget *entry, GdkEvent * event, gpointer dat
static GtkWidget *add_gas_combobox_to_box(GtkWidget *box, const char *label, int idx)
{
GtkWidget *frame, *combo;
- GtkEntryCompletion *completion;
- GtkEntry *entry;
if (!gas_model) {
gas_model = gtk_list_store_new(1, G_TYPE_STRING);
@@ -1054,7 +1052,7 @@ static GtkWidget *add_gas_combobox_to_box(GtkWidget *box, const char *label, int
add_string_list_entry("EAN32", gas_model);
add_string_list_entry("EAN36 @ 1.6", gas_model);
}
- combo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(gas_model), 0);
+ combo = combo_box_with_model_and_entry(gas_model);
gtk_widget_add_events(combo, GDK_FOCUS_CHANGE_MASK);
g_signal_connect(gtk_bin_get_child(GTK_BIN(combo)), "focus-out-event", G_CALLBACK(gas_focus_out_cb), NULL + idx);
g_signal_connect(combo, "changed", G_CALLBACK(gas_changed_cb), NULL + idx);
@@ -1065,15 +1063,6 @@ static GtkWidget *add_gas_combobox_to_box(GtkWidget *box, const char *label, int
} else {
gtk_box_pack_start(GTK_BOX(box), combo, FALSE, FALSE, 2);
}
- entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo)));
- completion = gtk_entry_completion_new();
- gtk_entry_completion_set_text_column(completion, 0);
- gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(gas_model));
- gtk_entry_completion_set_inline_completion(completion, TRUE);
- gtk_entry_completion_set_inline_selection(completion, TRUE);
- gtk_entry_completion_set_popup_single_match(completion, FALSE);
- gtk_entry_set_completion(entry, completion);
- g_object_unref(completion);
return combo;
}