summaryrefslogtreecommitdiffstats
path: root/download-dialog.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 /download-dialog.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 'download-dialog.c')
-rw-r--r--download-dialog.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/download-dialog.c b/download-dialog.c
index 73ed4bac9..6237004d9 100644
--- a/download-dialog.c
+++ b/download-dialog.c
@@ -330,7 +330,7 @@ static GtkComboBox *dc_device_selector(GtkWidget *vbox)
frame = gtk_frame_new(_("Device or mount point"));
gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 3);
- combo_box = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
+ combo_box = combo_box_with_model_and_entry(model);
gtk_container_add(GTK_CONTAINER(frame), combo_box);
renderer = gtk_cell_renderer_text_new();
@@ -340,8 +340,7 @@ static GtkComboBox *dc_device_selector(GtkWidget *vbox)
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), default_index);
else
if (default_dive_computer_device)
- gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo_box))),
- default_dive_computer_device);
+ set_active_text(GTK_COMBO_BOX(combo_box), default_dive_computer_device);
return GTK_COMBO_BOX(combo_box);
}
@@ -430,7 +429,7 @@ repeat:
set_default_dive_computer(vendor, product);
/* get the device name from the combo box entry and set as default */
- devname = strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(device)))));
+ devname = strdup(get_active_text(device));
set_default_dive_computer_device(devname);
/* clear leading and trailing white space from the device name and also
* everything after (and including) the first '(' char. */