diff --git a/.gitignore b/.gitignore index dc0179ec..1c2e41ec 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.cache *.log *.status +*.sqlite3 configure configure~ Makefile \ No newline at end of file diff --git a/Makefile b/Makefile index 53049a7d..6b445397 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Define compiler and flags CXX = g++ -CXXFLAGS = `pkg-config --cflags gtkmm-4.0 glibmm-2.68` -LDFLAGS = `pkg-config --libs gtkmm-4.0 glibmm-2.68` +CXXFLAGS = `pkg-config --cflags gtkmm-4.0 glibmm-2.68 sqlite3` +LDFLAGS = `pkg-config --libs gtkmm-4.0 glibmm-2.68 sqlite3` # Define target executable and source files TARGET = bin/Yoda @@ -10,7 +10,8 @@ SRCS = src/main.cpp\ src/app/browser/header.cpp\ src/app/browser/header/menu.cpp\ src/app/browser/header/tab.cpp\ - src/app/browser/page.cpp + src/app/browser/page.cpp\ + src/lib/database.cpp OBJS = $(SRCS:.cpp=.o) diff --git a/README.md b/README.md index 33e84a94..a3612a62 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,10 @@ GTK 4 / C++ implementation branch ### Linux -* `sudo apt install git libgtkmm-4.0-dev libglibmm-2.68-dev` +``` bash +sudo apt install git libgtkmm-4.0-dev libglibmm-2.68-dev libsqlite3-dev +``` + * `git clone https://github.com/YGGverse/Yoda.git` * `cd Yoda` * `git checkout master` @@ -38,7 +41,9 @@ GTK 4 / C++ implementation branch ### Environment -* `pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68` +``` bash +pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68 sqlite3 +``` ### Contribution diff --git a/po/POTFILES.in b/po/POTFILES.in index 1f3febaf..fa9b5eb4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -8,5 +8,6 @@ src/app/browser/header/tab.cpp src/app/browser/header/tab.hpp src/app/browser/page.cpp src/app/browser/page.hpp +src/lib/database.hpp src/main.cpp src/main.hpp \ No newline at end of file diff --git a/src/lib/database.cpp b/src/lib/database.cpp new file mode 100644 index 00000000..bfe412ff --- /dev/null +++ b/src/lib/database.cpp @@ -0,0 +1,12 @@ +#include "database.hpp" + +using namespace lib; + +Database::Database( + const char * filename +) { + status = sqlite3_open( + filename, + &connection + ); +} \ No newline at end of file diff --git a/src/lib/database.hpp b/src/lib/database.hpp new file mode 100644 index 00000000..3911c270 --- /dev/null +++ b/src/lib/database.hpp @@ -0,0 +1,26 @@ +#ifndef LIB_DATABASE_H +#define LIB_DATABASE_H + +#include + +namespace lib +{ + class Database + { + private: + + int status; + + char * error; + + sqlite3 * connection; + + public: + + Database( + const char * filename + ); + }; +} + +#endif // LIB_DATABASE_H \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 1877b71d..b79f6a0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,10 +1,16 @@ #include "main.hpp" #include "app/browser.hpp" +#include "lib/database.hpp" 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"