diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 7fcec449..119581fc 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -14,7 +14,7 @@ Tab::Tab( const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_UPDATE ) { // Init database - DB::init( + DB::APP_BROWSER_MAIN_TAB__SESSION::init( this->db = db ); @@ -94,7 +94,7 @@ int Tab::restore() void Tab::clear() // @TODO menu action? { - DB::clear( + DB::APP_BROWSER_MAIN_TAB__SESSION::clear( db ); @@ -106,7 +106,7 @@ void Tab::save() char * error; // @TODO // Delete previous data - DB::clear( + DB::APP_BROWSER_MAIN_TAB__SESSION::clear( db ); @@ -117,7 +117,7 @@ void Tab::save() get_tabPage( page_number )->save( - DB::add( + DB::APP_BROWSER_MAIN_TAB__SESSION::add( db, page_number, page_number == get_current_page() ? 1 : 0, @@ -331,9 +331,8 @@ tab::Page * Tab::get_tabPage( return TAB_PAGE; } - -// Database model -int Tab::DB::init( +// Database +int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::init( sqlite3 * db ) { char * error; @@ -356,7 +355,7 @@ int Tab::DB::init( ); } -int Tab::DB::clear( +int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clear( sqlite3 * db ) { char * error; // @TODO @@ -397,7 +396,7 @@ int Tab::DB::clear( ); // Delegate cleanup childs - tab::Page::DB::clear( + tab::Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clear( db, APP_BROWSER_MAIN_TAB__SESSION_ID ); @@ -409,7 +408,7 @@ int Tab::DB::clear( ); } -sqlite3_int64 Tab::DB::add( +sqlite3_int64 Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::add( sqlite3 * db, const int & PAGE_NUMBER, const bool & IS_CURRENT, diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index 111109fd..55061612 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -22,29 +22,33 @@ namespace app::browser::main struct DB { - enum APP_BROWSER_MAIN_TAB__SESSION + struct APP_BROWSER_MAIN_TAB__SESSION { - ID, - TIME, - PAGE_NUMBER, - IS_CURRENT, - LABEL_TEXT - }; - - static int init( - sqlite3 * db - ); - - static int clear( - sqlite3 * db - ); + enum + { + ID, + TIME, + PAGE_NUMBER, + IS_CURRENT, + LABEL_TEXT + }; + + static int init( + sqlite3 * db + ); + + static int clear( + sqlite3 * db + ); + + static sqlite3_int64 add( + sqlite3 * db, + const int & PAGE_NUMBER, + const bool & IS_CURRENT, + const Glib::ustring & LABEL_TEXT + ); - static sqlite3_int64 add( - sqlite3 * db, - const int & PAGE_NUMBER, - const bool & IS_CURRENT, - const Glib::ustring & LABEL_TEXT - ); + }; }; private: diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index 496ca5e5..2a6be7e8 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -24,7 +24,7 @@ Page::Page( action__refresh = ACTION__REFRESH; // Init database - DB::init( + DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init( this->db = db ); @@ -74,7 +74,7 @@ int Page::save( ) { // Delegate save action to child components return pageNavigation->save( - Page::DB::add( + Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::add( db, DB__APP_BROWSER_MAIN_TAB__SESSION_ID, mime, @@ -364,7 +364,7 @@ void Page::set_navbar_request_text( } // Database model -int Page::DB::init( +int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init( sqlite3 * db ) { char * error; @@ -387,7 +387,7 @@ int Page::DB::init( ); } -int Page::DB::clear( +int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clear( sqlite3 * db, const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID ) { @@ -440,7 +440,7 @@ int Page::DB::clear( ); } -sqlite3_int64 Page::DB::add( +sqlite3_int64 Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::add( sqlite3 * db, const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID, const Page::MIME & MIME, diff --git a/src/app/browser/main/tab/page.hpp b/src/app/browser/main/tab/page.hpp index 46b46599..c644d277 100644 --- a/src/app/browser/main/tab/page.hpp +++ b/src/app/browser/main/tab/page.hpp @@ -37,31 +37,34 @@ namespace app::browser::main::tab struct DB { - enum APP_BROWSER_MAIN_TAB_PAGE__SESSION + struct APP_BROWSER_MAIN_TAB_PAGE__SESSION { - ID, - TIME, - MIME, - TITLE, - DESCRIPTION + enum + { + ID, + TIME, + MIME, + TITLE, + DESCRIPTION + }; + + static int init( + sqlite3 * db + ); + + static int clear( + sqlite3 * db, + const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID + ); + + static sqlite3_int64 add( + sqlite3 * db, + const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID, + const Page::MIME & MIME, + const Glib::ustring & TITLE, + const Glib::ustring & DESCRIPTION + ); }; - - static int init( - sqlite3 * db - ); - - static int clear( - sqlite3 * db, - const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID - ); - - static sqlite3_int64 add( - sqlite3 * db, - const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID, - const Page::MIME & MIME, - const Glib::ustring & TITLE, - const Glib::ustring & DESCRIPTION - ); }; private: