From acca9b1804efc43b589d04b60682081b56afe7bc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 26 Sep 2011 09:19:30 -0700 Subject: [PATCH] Add a "Dive Computer" frame around the dive computer choice in import I'll add a widget to allow the user to select the device too, so let's name things to make them more obvious. Signed-off-by: Linus Torvalds --- gtk-gui.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gtk-gui.c b/gtk-gui.c index 7eb85cf..5675e5d 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -613,21 +613,23 @@ static void fill_computer_list(GtkListStore *store) } } -static GtkComboBox *dive_computer_selector(GtkWidget *dialog) +static GtkComboBox *dive_computer_selector(GtkWidget *vbox) { - GtkWidget *hbox, *combo_box, *vbox; + GtkWidget *hbox, *combo_box, *frame; GtkListStore *model; GtkCellRenderer *renderer; hbox = gtk_hbox_new(FALSE, 6); - vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); fill_computer_list(model); + frame = gtk_frame_new("Dive computer"); + gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 3); + combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); - gtk_box_pack_start(GTK_BOX(hbox), combo_box, FALSE, TRUE, 3); + gtk_container_add(GTK_CONTAINER(frame), combo_box); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_box), renderer, TRUE); @@ -652,10 +654,11 @@ void import_dialog(GtkWidget *w, gpointer data) GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - computer = dive_computer_selector(dialog); + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + + computer = dive_computer_selector(vbox); hbox = gtk_hbox_new(FALSE, 6); - vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 3); devicedata.progress.bar = gtk_progress_bar_new(); gtk_container_add(GTK_CONTAINER(hbox), devicedata.progress.bar); -- 2.45.2