Browse Source

rename methods

CPP-GTK4
yggverse 2 months ago
parent
commit
59b3f171e5
  1. 4
      src/app/browser.cpp
  2. 8
      src/app/browser/main.cpp
  3. 4
      src/app/browser/main.hpp
  4. 20
      src/app/browser/main/tab.cpp
  5. 7
      src/app/browser/main/tab.hpp

4
src/app/browser.cpp

@ -155,7 +155,7 @@ Browser::Browser(
"main_tab_session_restore", "main_tab_session_restore",
[this] [this]
{ {
browserMain->tab_restore(); browserMain->tab_session_restore();
} }
); );
@ -163,7 +163,7 @@ Browser::Browser(
"main_tab_session_save", "main_tab_session_save",
[this] [this]
{ {
browserMain->tab_save(); browserMain->tab_session_save();
} }
); );

8
src/app/browser/main.cpp

@ -95,14 +95,14 @@ void Main::tab_page_navigation_history_forward()
); );
}; };
void Main::tab_restore() void Main::tab_session_restore()
{ {
mainTab->restore(); mainTab->session_restore();
}; };
void Main::tab_save() void Main::tab_session_save()
{ {
mainTab->save(); mainTab->session_save();
}; };
void Main::shutdown() void Main::shutdown()

4
src/app/browser/main.hpp

@ -49,8 +49,8 @@ namespace app::browser
void tab_page_navigation_history_back(); void tab_page_navigation_history_back();
void tab_page_navigation_history_forward(); void tab_page_navigation_history_forward();
void tab_restore(); void tab_session_restore();
void tab_save(); void tab_session_save();
void shutdown(); void shutdown();

20
src/app/browser/main/tab.cpp

@ -21,7 +21,7 @@ Tab::Tab(
::sqlite3_exec( ::sqlite3_exec(
db, db,
R"SQL( R"SQL(
CREATE TABLE IF NOT EXISTS `app_browser_main_tab` CREATE TABLE IF NOT EXISTS `app_browser_main_tab_session`
( (
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
`time` INTEGER NOT NULL, `time` INTEGER NOT NULL,
@ -53,7 +53,7 @@ Tab::Tab(
[this] [this]
{ {
// Restore session from DB // Restore session from DB
restore(); session_restore();
} }
); );
@ -66,14 +66,14 @@ Tab::Tab(
); );
} }
void Tab::restore() void Tab::session_restore()
{ {
sqlite3_stmt* statement; sqlite3_stmt* statement;
const int PREPARE = ::sqlite3_prepare_v3( const int PREPARE = ::sqlite3_prepare_v3(
this->db, this->db,
R"SQL( R"SQL(
SELECT * FROM `app_browser_main_tab` ORDER BY `number` ASC SELECT * FROM `app_browser_main_tab_session` ORDER BY `number` ASC
)SQL", )SQL",
-1, -1,
SQLITE_PREPARE_NORMALIZE, SQLITE_PREPARE_NORMALIZE,
@ -93,12 +93,12 @@ void Tab::restore()
reinterpret_cast<const char*>( reinterpret_cast<const char*>(
::sqlite3_column_text( ::sqlite3_column_text(
statement, statement,
DB::APP_BROWSER_MAIN_TAB::REQUEST DB::APP_BROWSER_MAIN_TAB_SESSION::REQUEST
) )
) )
); );
if (::sqlite3_column_int(statement, DB::APP_BROWSER_MAIN_TAB::CURRENT) == 1) if (::sqlite3_column_int(statement, DB::APP_BROWSER_MAIN_TAB_SESSION::CURRENT) == 1)
{ {
set_current_page( set_current_page(
PAGE_NUMBER PAGE_NUMBER
@ -112,7 +112,7 @@ void Tab::restore()
); );
} }
void Tab::save() void Tab::session_save()
{ {
char * error; // @TODO char * error; // @TODO
@ -120,7 +120,7 @@ void Tab::save()
::sqlite3_exec( ::sqlite3_exec(
db, db,
R"SQL( R"SQL(
DELETE FROM `app_browser_main_tab` DELETE FROM `app_browser_main_tab_session`
)SQL", )SQL",
nullptr, nullptr,
nullptr, nullptr,
@ -138,7 +138,7 @@ void Tab::save()
db, db,
Glib::ustring::sprintf( Glib::ustring::sprintf(
R"SQL( R"SQL(
INSERT INTO `app_browser_main_tab` ( INSERT INTO `app_browser_main_tab_session` (
`time`, `time`,
`number`, `number`,
`current`, `current`,
@ -163,7 +163,7 @@ void Tab::save()
void Tab::shutdown() void Tab::shutdown()
{ {
save(); session_save();
// @TODO shutdown children components // @TODO shutdown children components
} }

7
src/app/browser/main/tab.hpp

@ -23,7 +23,7 @@ namespace app::browser::main
struct DB struct DB
{ {
enum APP_BROWSER_MAIN_TAB enum APP_BROWSER_MAIN_TAB_SESSION
{ {
ID, ID,
TIME, TIME,
@ -94,9 +94,8 @@ namespace app::browser::main
const int & PAGE_NUMBER const int & PAGE_NUMBER
); );
void restore(); void session_restore();
void session_save();
void save();
void shutdown(); void shutdown();

Loading…
Cancel
Save