From 9d22d6b2782a2879223e5a2403dd7bfc3a86e5a8 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Fri, 28 Oct 2011 17:06:18 -0400 Subject: [PATCH] ocarina: Split footer into multiple files This should help keep things organized --- include/ocarina/footer.h | 2 ++ ocarina/footer/controls.cpp | 27 +++++++++++++++++++++++++++ ocarina/footer/footer.cpp | 25 ++++++------------------- ocarina/footer/footer.h | 6 ++++++ 4 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 ocarina/footer/controls.cpp create mode 100644 ocarina/footer/footer.h diff --git a/include/ocarina/footer.h b/include/ocarina/footer.h index 42be8763..50d01147 100644 --- a/include/ocarina/footer.h +++ b/include/ocarina/footer.h @@ -2,8 +2,10 @@ #define OCARINA_FOOTER #include +#include GtkWidget *get_footer(); void put_footer(); +void set_footer_track(Track &); #endif /* OCARINA_FOOTER */ diff --git a/ocarina/footer/controls.cpp b/ocarina/footer/controls.cpp new file mode 100644 index 00000000..dd4b7dd4 --- /dev/null +++ b/ocarina/footer/controls.cpp @@ -0,0 +1,27 @@ + +#include +#include +#include "footer.h" + +static GtkWidget *controls = NULL; + +static void make_controls() +{ + controls = gtk_hbox_new(FALSE, 0); + gtk_widget_show(controls); + + box_pack_end(controls, make_volume_button(), FALSE, FALSE, 0); + box_pack_end(controls, make_stop_button(), FALSE, FALSE, 0); + box_pack_end(controls, make_pause_button(), FALSE, FALSE, 0); + box_pack_end(controls, make_play_button(), FALSE, FALSE, 0); + box_pack_end(controls, make_forward_button(), FALSE, FALSE, 0); + box_pack_end(controls, make_rewind_button(), FALSE, FALSE, 0); + box_pack_end(controls, make_open_button(), FALSE, FALSE, 0); +} + +GtkWidget *get_controls() +{ + if (controls == NULL) + make_controls(); + return controls; +} diff --git a/ocarina/footer/footer.cpp b/ocarina/footer/footer.cpp index a3bb8bee..2af449d5 100644 --- a/ocarina/footer/footer.cpp +++ b/ocarina/footer/footer.cpp @@ -1,37 +1,24 @@ #include -#include +#include +#include "footer.h" static GtkWidget *footer = NULL; -static void add_controls() -{ - GtkWidget *controls = gtk_hbox_new(FALSE, 0); - gtk_widget_show(controls); - - box_pack_end(controls, make_volume_button(), FALSE, FALSE, 0); - box_pack_end(controls, make_stop_button(), FALSE, FALSE, 0); - box_pack_end(controls, make_pause_button(), FALSE, FALSE, 0); - box_pack_end(controls, make_play_button(), FALSE, FALSE, 0); - box_pack_end(controls, make_forward_button(), FALSE, FALSE, 0); - box_pack_end(controls, make_rewind_button(), FALSE, FALSE, 0); - box_pack_end(controls, make_open_button(), FALSE, FALSE, 0); - - box_pack_start(footer, controls, FALSE, FALSE, 0); -} - static void make_footer() { GtkWidget *sep = gtk_hseparator_new(); footer = gtk_vbox_new(FALSE, 0); - box_pack_start(footer, sep, FALSE, FALSE, 0); + gtk_widget_show(sep); + gtk_widget_show(footer); /* * The pause button begins life hidden, so show everything up until * this point, and then add the controls */ gtk_widget_show_all(footer); - add_controls(); + box_pack_start(footer, sep, FALSE, FALSE, 0); + box_pack_start(footer, get_controls(), FALSE, FALSE, 0); } GtkWidget *get_footer() diff --git a/ocarina/footer/footer.h b/ocarina/footer/footer.h new file mode 100644 index 00000000..287844a5 --- /dev/null +++ b/ocarina/footer/footer.h @@ -0,0 +1,6 @@ +#ifndef OCARINA_FOOTER_PRIVATE_H +#define OCARINA_FOOTER_PRIVATE_H + +GtkWidget *get_controls(); + +#endif /* OCARINA_FOOTER_PRIVATE_H */