From 59b3f171e574a7d1a5eea1b3a83911b4c86f1733 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 9 Sep 2024 23:51:13 +0300 Subject: [PATCH] rename methods --- src/app/browser.cpp | 4 ++-- src/app/browser/main.cpp | 8 ++++---- src/app/browser/main.hpp | 4 ++-- src/app/browser/main/tab.cpp | 20 ++++++++++---------- src/app/browser/main/tab.hpp | 7 +++---- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/app/browser.cpp b/src/app/browser.cpp index c3e8b7f3..2373d603 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -155,7 +155,7 @@ Browser::Browser( "main_tab_session_restore", [this] { - browserMain->tab_restore(); + browserMain->tab_session_restore(); } ); @@ -163,7 +163,7 @@ Browser::Browser( "main_tab_session_save", [this] { - browserMain->tab_save(); + browserMain->tab_session_save(); } ); diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index 1231df43..a59b8ed1 100644 --- a/src/app/browser/main.cpp +++ b/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() diff --git a/src/app/browser/main.hpp b/src/app/browser/main.hpp index 0dc96682..5a236e3d 100644 --- a/src/app/browser/main.hpp +++ b/src/app/browser/main.hpp @@ -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(); diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 6c592a43..5afef6bc 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -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( [this] { // Restore session from DB - restore(); + session_restore(); } ); @@ -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() reinterpret_cast( ::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() ); } -void Tab::save() +void Tab::session_save() { char * error; // @TODO @@ -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() 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() void Tab::shutdown() { - save(); + session_save(); // @TODO shutdown children components } diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index 675daa8e..3bdbe889 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -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 const int & PAGE_NUMBER ); - void restore(); - - void save(); + void session_restore(); + void session_save(); void shutdown();