From 788ebc0500b12fb502b82473c1459ccca06345a5 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 15 Jan 2012 14:29:08 -0800 Subject: [PATCH] Create separate single dive and total stats pages No additional statistics added, yet. Signed-off-by: Dirk Hohndel --- display-gtk.h | 3 ++- gtk-gui.c | 22 ++++++++++++---------- statistics.c | 14 ++++---------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/display-gtk.h b/display-gtk.h index b55dc96..f43e374 100644 --- a/display-gtk.h +++ b/display-gtk.h @@ -61,7 +61,8 @@ extern GtkWidget *dive_profile_widget(void); extern GtkWidget *dive_info_frame(void); extern GtkWidget *extended_dive_info_widget(void); extern GtkWidget *equipment_widget(void); -extern GtkWidget *stats_widget(void); +extern GtkWidget *single_stats_widget(void); +extern GtkWidget *total_stats_widget(void); extern GtkWidget *cylinder_list_widget(void); extern GtkWidget *dive_list_create(void); diff --git a/gtk-gui.c b/gtk-gui.c index e16d60e..45185c0 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -646,10 +646,8 @@ void init_ui(int *argcp, char ***argvp) { GtkWidget *win; GtkWidget *notebook; - GtkWidget *dive_info; + GtkWidget *nb_page; GtkWidget *dive_list; - GtkWidget *equipment; - GtkWidget *stats; GtkWidget *menubar; GtkWidget *vbox; GdkScreen *screen; @@ -735,16 +733,20 @@ void init_ui(int *argcp, char ***argvp) gtk_paned_add2(GTK_PANED(hpane), dive_profile); /* Frame for extended dive info */ - dive_info = extended_dive_info_widget(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dive_info, gtk_label_new("Dive Notes")); + nb_page = extended_dive_info_widget(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Dive Notes")); /* Frame for dive equipment */ - equipment = equipment_widget(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), equipment, gtk_label_new("Equipment")); + nb_page = equipment_widget(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Equipment")); - /* Frame for dive statistics */ - stats = stats_widget(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), stats, gtk_label_new("Info & Stats")); + /* Frame for single dive statistics */ + nb_page = single_stats_widget(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Dive Info")); + + /* Frame for total dive statistics */ + nb_page = total_stats_widget(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Overall Stats")); gtk_widget_set_app_paintable(win, TRUE); gtk_widget_show_all(win); diff --git a/statistics.c b/statistics.c index 60b4776..5017fe0 100644 --- a/statistics.c +++ b/statistics.c @@ -242,10 +242,11 @@ static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label) return label_widget; } -static GtkWidget *total_stats_widget(GtkWidget *vbox) +GtkWidget *total_stats_widget(void) { + GtkWidget *vbox, *hbox, *statsframe, *framebox; - GtkWidget *hbox, *statsframe, *framebox; + vbox = gtk_vbox_new(FALSE, 3); statsframe = gtk_frame_new("Statistics"); gtk_box_pack_start(GTK_BOX(vbox), statsframe, TRUE, FALSE, 3); @@ -272,9 +273,8 @@ static GtkWidget *total_stats_widget(GtkWidget *vbox) return vbox; } -static GtkWidget *single_stats_widget(void) +GtkWidget *single_stats_widget(void) { - GtkWidget *vbox, *hbox, *infoframe, *framebox; vbox = gtk_vbox_new(FALSE, 3); @@ -311,9 +311,3 @@ static GtkWidget *single_stats_widget(void) return vbox; } - -GtkWidget* stats_widget(void) -{ - GtkWidget *vbox = single_stats_widget(); - return total_stats_widget(vbox); -} -- 2.45.2