From 3d1e8872d3344af1c09620a05bf2961a336aff09 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 20 Jan 2014 20:14:22 -0500 Subject: [PATCH] gui: Create a common ocarina_init() To initialize the needed backend modules, shared by normal main() and testing main(). Signed-off-by: Anna Schumaker --- gui/main.cpp | 15 +++++++++++---- gui/tabs.cpp | 3 ++- include/ocarina.h | 4 ++++ tests/gui/gui.cpp | 7 ++----- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/gui/main.cpp b/gui/main.cpp index 4d01da23..d09c800d 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -1,17 +1,24 @@ /* * Copyright 2014 (c) Anna Schumaker. */ +#include #include +Gtk::Window *ocarina_init() +{ + Gtk::Window *window = connect_wires(); + deck::init(); + library::init(); + return window; +} + #ifndef CONFIG_TEST int main(int argc, char **argv) { - Gtk::Window *window; - Gtk::Main ocarina(argc, argv); - window = connect_wires(); - + Gtk::Window *window = ocarina_init(); Gtk::Main::run(*window); + cleanup_tabs(); return 0; } #endif /* CONFIG_TEST */ diff --git a/gui/tabs.cpp b/gui/tabs.cpp index 339e3cb1..e96b4455 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -30,7 +30,7 @@ public: Gtk::TreeModelColumn q_col_count; Gtk::TreeModelColumn q_col_played; } queue_cols; -static unsigned int q_col_width[] = { 20, 300, 1, 125, 125, 1, 125, 1, 1 }; +static unsigned int q_col_width[] = { 20, 300, 60, 125, 125, 1, 125, 60, 1 }; /* @@ -131,6 +131,7 @@ void OcarinaTab::setup_columns() for (unsigned int i = 0; i < columns.size(); i++) { columns[i]->set_resizable(); columns[i]->set_fixed_width(q_col_width[i]); + columns[i]->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); } } diff --git a/include/ocarina.h b/include/ocarina.h index ade1e734..ffea6bf5 100644 --- a/include/ocarina.h +++ b/include/ocarina.h @@ -6,6 +6,10 @@ #include #include + +/* main.cpp */ +Gtk::Window *ocarina_init(); + /* model.cpp */ class PlayqueueModel : public Gtk::TreeModel, public Glib::Object { private: diff --git a/tests/gui/gui.cpp b/tests/gui/gui.cpp index 6f018fec..dbc672ef 100644 --- a/tests/gui/gui.cpp +++ b/tests/gui/gui.cpp @@ -131,14 +131,11 @@ bool test_0() int main(int argc, char **argv) { - Gtk::Window *window; - Gtk::Main ocarina(argc, argv); - - deck :: init(); - window = connect_wires(); + Gtk::Window *window = ocarina_init(); schedule_test(test_0); + Gtk::Main::run(*window); cleanup_tabs(); return 0;