Browse Source

rename methods

CPP-GTK4
yggverse 4 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( @@ -155,7 +155,7 @@ Browser::Browser(
"main_tab_session_restore",
[this]
{
browserMain->tab_restore();
browserMain->tab_session_restore();
}
);
@ -163,7 +163,7 @@ Browser::Browser( @@ -163,7 +163,7 @@ Browser::Browser(
"main_tab_session_save",
[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() @@ -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()

4
src/app/browser/main.hpp

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

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

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

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

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

Loading…
Cancel
Save