Browse Source

require db on browser construct

CPP-GTK4
yggverse 4 months ago
parent
commit
4b2fe64b08
  1. 3
      src/app/browser.cpp
  2. 8
      src/app/browser.hpp
  3. 13
      src/main.cpp

3
src/app/browser.cpp

@ -4,7 +4,8 @@ @@ -4,7 +4,8 @@
using namespace app;
Browser::Browser(
const Glib::RefPtr<Gtk::Application> & app
const Glib::RefPtr<Gtk::Application> & app,
const lib::Database & db
) {
set_title(
TITLE

8
src/app/browser.hpp

@ -4,6 +4,11 @@ @@ -4,6 +4,11 @@
#include <glibmm/i18n.h>
#include <gtkmm/applicationwindow.h>
namespace lib
{
class Database;
}
namespace app
{
class Browser : public Gtk::ApplicationWindow
@ -15,7 +20,8 @@ namespace app @@ -15,7 +20,8 @@ namespace app
const int HEIGHT = 480;
Browser(
const Glib::RefPtr<Gtk::Application> & app
const Glib::RefPtr<Gtk::Application> & app,
const lib::Database & db
);
void debug();

13
src/main.cpp

@ -6,11 +6,6 @@ int main( @@ -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( @@ -31,10 +26,16 @@ int main(
"<Primary>q"
);
// Init profile
auto db = lib::Database(
"database.sqlite3"
);
// Launch browser component
return app->make_window_and_run<app::Browser>(
argc,
argv,
app
app,
db
);
}
Loading…
Cancel
Save