From c36f98d9487c4b3a9b5c1f77aedb15e674b5a192 Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Fri, 24 Feb 2012 08:17:32 +0100 Subject: [PATCH] fio: work on widget alignment Signed-off-by: Stephen M. Cameron Signed-off-by: Jens Axboe --- gfio.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/gfio.c b/gfio.c index 2a9dd6a6..bec42c7b 100644 --- a/gfio.c +++ b/gfio.c @@ -54,6 +54,9 @@ struct gui { char **argv; GtkWidget *window; GtkWidget *vbox; + GtkWidget *topvbox; + GtkWidget *topalign; + GtkWidget *bottomalign; GtkWidget *thread_status_pb; GtkWidget *buttonbox; GtkWidget *button[ARRAYSIZE(buttonspeclist)]; @@ -227,8 +230,6 @@ static void add_buttons(struct gui *ui, { int i; - ui->buttonbox = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER (ui->vbox), ui->buttonbox); for (i = 0; i < nbuttons; i++) add_button(ui, i, ui->buttonbox, &buttonlist[i]); } @@ -258,6 +259,15 @@ static void init_ui(int *argc, char **argv[], struct gui *ui) ui->vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER (ui->window), ui->vbox); + /* + * Set up alignments for widgets at the top of ui, + * align top left, expand horizontally but not vertically + */ + ui->topalign = gtk_alignment_new(0, 0, 1, 0); + ui->topvbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(ui->topalign), ui->topvbox); + gtk_container_add(GTK_CONTAINER(ui->vbox), ui->topalign); + /* * Set up hostname label + entry, port label + entry, */ @@ -286,7 +296,7 @@ static void init_ui(int *argc, char **argv[], struct gui *ui) gtk_container_add(GTK_CONTAINER (ui->hostname_hbox), ui->port_label); gtk_container_add(GTK_CONTAINER (ui->hostname_hbox), ui->port_entry); gtk_container_add(GTK_CONTAINER (ui->hostname_hbox), ui->hostname_combo_box); - gtk_container_add(GTK_CONTAINER (ui->vbox), ui->hostname_hbox); + gtk_container_add(GTK_CONTAINER (ui->topvbox), ui->hostname_hbox); /* * Set up jobfile text entry (temporary until gui really works) @@ -296,7 +306,7 @@ static void init_ui(int *argc, char **argv[], struct gui *ui) ui->jobfile_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER (ui->jobfile_hbox), ui->jobfile_label); gtk_container_add(GTK_CONTAINER (ui->jobfile_hbox), ui->jobfile_entry); - gtk_container_add(GTK_CONTAINER (ui->vbox), ui->jobfile_hbox); + gtk_container_add(GTK_CONTAINER (ui->topvbox), ui->jobfile_hbox); /* * Set up thread status progress bar @@ -306,7 +316,7 @@ static void init_ui(int *argc, char **argv[], struct gui *ui) GTK_PROGRESS_BAR(ui->thread_status_pb), 0.0); gtk_progress_bar_set_text( GTK_PROGRESS_BAR(ui->thread_status_pb), "No jobs running"); - gtk_container_add(GTK_CONTAINER (ui->vbox), ui->thread_status_pb); + gtk_container_add(GTK_CONTAINER (ui->topvbox), ui->thread_status_pb); /* * Add a text box for text op messages @@ -322,6 +332,15 @@ static void init_ui(int *argc, char **argv[], struct gui *ui) gtk_container_add(GTK_CONTAINER(ui->scrolled_window), ui->textview); gtk_container_add(GTK_CONTAINER(ui->vbox), ui->scrolled_window); + /* + * Set up alignments for widgets at the bottom of ui, + * align bottom left, expand horizontally but not vertically + */ + ui->bottomalign = gtk_alignment_new(0, 1, 1, 0); + ui->buttonbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(ui->bottomalign), ui->buttonbox); + gtk_container_add(GTK_CONTAINER (ui->vbox), ui->bottomalign); + add_buttons(ui, buttonspeclist, ARRAYSIZE(buttonspeclist)); gtk_widget_show_all(ui->window); } -- 2.25.1