From 4b2fe64b086528c17c7bbbc7c90b4265436bb875 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 11 Aug 2024 14:52:09 +0300 Subject: [PATCH] require db on browser construct --- src/app/browser.cpp | 3 ++- src/app/browser.hpp | 8 +++++++- src/main.cpp | 13 +++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/app/browser.cpp b/src/app/browser.cpp index 5240dc29..f064596a 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -4,7 +4,8 @@ using namespace app; Browser::Browser( - const Glib::RefPtr & app + const Glib::RefPtr & app, + const lib::Database & db ) { set_title( TITLE diff --git a/src/app/browser.hpp b/src/app/browser.hpp index c4a1ceac..a0ba2a66 100644 --- a/src/app/browser.hpp +++ b/src/app/browser.hpp @@ -4,6 +4,11 @@ #include #include +namespace lib +{ + class Database; +} + namespace app { class Browser : public Gtk::ApplicationWindow @@ -15,7 +20,8 @@ namespace app const int HEIGHT = 480; Browser( - const Glib::RefPtr & app + const Glib::RefPtr & app, + const lib::Database & db ); void debug(); diff --git a/src/main.cpp b/src/main.cpp index b79f6a0e..2f8d2760 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,11 +6,6 @@ int main( int argc, char * argv[] ) { - // Init profile - auto database = lib::Database( - "database.sqlite3" - ); - // Init app auto app = Gtk::Application::create( "io.github.yggverse.Yoda" @@ -31,10 +26,16 @@ int main( "q" ); + // Init profile + auto db = lib::Database( + "database.sqlite3" + ); + // Launch browser component return app->make_window_and_run( argc, argv, - app + app, + db ); } \ No newline at end of file