fio: work on widget alignment
authorStephen M. Cameron <stephenmcameron@gmail.com>
Fri, 24 Feb 2012 07:17:32 +0000 (08:17 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Feb 2012 07:17:32 +0000 (08:17 +0100)
Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
gfio.c

diff --git a/gfio.c b/gfio.c
index 2a9dd6a635c2ec35720953747050b47318e5cb7b..bec42c7bc1c889562d8f983316ea273fd3e70352 100644 (file)
--- 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);
 }