summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-09 17:10:17 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-09 17:10:17 -0700
commit067506038a5fea72e60680513d768f89722671fd (patch)
tree9f926ebb0793cd7d4ee8445577a1d31dea901c33 /main.c
parent41bce9e5f4c80803132563681d492e74853aa609 (diff)
downloadsubsurface-067506038a5fea72e60680513d768f89722671fd.tar.gz
Rename 'cylinder.c' as 'equipment.c'
Make it about general equipment management, and start hooking up functions to show new equipment information when changing dives (and to flush changes to equipment information for the previously active dive). Nothing is hooked up yet, and it's now showing just one (really big) cylinder choice, so this is all broken. But it should make it possible to at least get somewhere some day. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/main.c b/main.c
index dc5453892..5367571ad 100644
--- a/main.c
+++ b/main.c
@@ -90,9 +90,25 @@ static void on_destroy(GtkWidget* w, gpointer data)
static GtkWidget *dive_profile;
+void update_dive(struct dive *new_dive)
+{
+ static struct dive *buffered_dive;
+ struct dive *old_dive = buffered_dive;
+
+ if (old_dive) {
+ flush_dive_info_changes(old_dive);
+ flush_dive_equipment_changes(old_dive);
+ }
+ if (new_dive) {
+ buffered_dive = new_dive;
+ show_dive_info(new_dive);
+ show_dive_equipment(new_dive);
+ }
+}
+
void repaint_dive(void)
{
- update_dive_info(current_dive);
+ update_dive(current_dive);
gtk_widget_queue_draw(dive_profile);
}
@@ -356,7 +372,7 @@ int main(int argc, char **argv)
GtkWidget *notebook;
GtkWidget *frame;
GtkWidget *dive_info;
- GtkWidget *cylinder_management;
+ GtkWidget *equipment;
GtkWidget *menubar;
GtkWidget *vbox;
@@ -417,9 +433,9 @@ int main(int argc, char **argv)
dive_info = extended_dive_info_widget();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dive_info, gtk_label_new("Dive Notes"));
- /* Frame for extended dive info */
- cylinder_management = cylinder_management_widget();
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), cylinder_management, gtk_label_new("Cylinders"));
+ /* Frame for dive equipment */
+ equipment = equipment_widget();
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), equipment, gtk_label_new("Equipment"));
gtk_widget_set_app_paintable(win, TRUE);
gtk_widget_show_all(win);