diff --git a/README.md b/README.md index 32952966..7f0cfaae 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Currently, main application sources located at `src/app` folder, written by foll * `#include` application `.hpp` files in `.cpp`. For system libraries, use headers only. Do not place system dependencies in `.cpp` * App interact SQLite database, where table name match related class namespace, it may contain optional feature postfix (separated with double line) * App class tables in database wanted to store user data between app sessions and must contain only fields that related to this class (e.g. private and public variable values); also may contain primary key fields, to their parent (table) according to the namespace hierarchy -* Window actions called same as their menu actors. Children widgets operate with `SimpleAction` objects, not name strings (follow encapsulation) +* Follow encapsulation, do not use static dependencies like external action names, use `SimpleAction` objects instead of `win.action_name`, etc ### Environment diff --git a/src/app/browser.cpp b/src/app/browser.cpp index 7c2497d2..a054a5f9 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -190,12 +190,12 @@ Browser::Browser( browserMain = Gtk::make_managed( db, - ACTION__UPDATE, ACTION__TAB_CLOSE, ACTION__TAB_CLOSE_ALL, ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - ACTION__TAB_PAGE_NAVIGATION_RELOAD + ACTION__TAB_PAGE_NAVIGATION_RELOAD, + ACTION__UPDATE ); set_child( diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index be06c9c8..ac202673 100644 --- a/src/app/browser/main.cpp +++ b/src/app/browser/main.cpp @@ -5,12 +5,12 @@ using namespace app::browser; Main::Main( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_CLOSE, - const Glib::RefPtr & ACTION__TAB_CLOSE_ALL, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__CLOSE, + const Glib::RefPtr & ACTION__CLOSE_ALL, + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ) { // Init database DB::SESSION::init( @@ -29,12 +29,12 @@ Main::Main( // Init components mainTab = Gtk::make_managed( db, - ACTION__UPDATE, - ACTION__TAB_CLOSE, - ACTION__TAB_CLOSE_ALL, - ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - ACTION__TAB_PAGE_NAVIGATION_RELOAD + ACTION__CLOSE, + ACTION__CLOSE_ALL, + ACTION__HISTORY_BACK, + ACTION__HISTORY_FORWARD, + ACTION__RELOAD, + ACTION__UPDATE ); append( diff --git a/src/app/browser/main.hpp b/src/app/browser/main.hpp index cceba734..2ae8f884 100644 --- a/src/app/browser/main.hpp +++ b/src/app/browser/main.hpp @@ -75,12 +75,12 @@ namespace app::browser Main( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_CLOSE, - const Glib::RefPtr & ACTION__TAB_CLOSE_ALL, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__CLOSE, + const Glib::RefPtr & ACTION__CLOSE_ALL, + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ); // Actions diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index f2c2f1a1..649dc898 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -6,12 +6,12 @@ using namespace app::browser::main; Tab::Tab( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_CLOSE, - const Glib::RefPtr & ACTION__TAB_CLOSE_ALL, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__CLOSE, + const Glib::RefPtr & ACTION__CLOSE_ALL, + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ) { // Init database DB::SESSION::init( @@ -19,12 +19,12 @@ Tab::Tab( ); // Init actions - action__update = ACTION__UPDATE; - action__tab_close = ACTION__TAB_CLOSE; - action__tab_close_all = ACTION__TAB_CLOSE_ALL; - action__tab_page_navigation_history_back = ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK; - action__tab_page_navigation_history_forward = ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD; - action__tab_page_navigation_reload = ACTION__TAB_PAGE_NAVIGATION_RELOAD; + action__close = ACTION__CLOSE; + action__close_all = ACTION__CLOSE_ALL; + action__history_back = ACTION__HISTORY_BACK; + action__history_forward = ACTION__HISTORY_FORWARD; + action__reload = ACTION__RELOAD; + action__update = ACTION__UPDATE; // Init widget set_scrollable( @@ -156,11 +156,11 @@ void Tab::update( ); // Update tab actions status - action__tab_close->set_enabled( + action__close->set_enabled( get_n_pages() > 0 ); - action__tab_close_all->set_enabled( + action__close_all->set_enabled( get_n_pages() > 0 ); } @@ -170,15 +170,15 @@ int Tab::append( ) { const auto TAB_PAGE = new tab::Page( // @TODO manage db, - action__update, - action__tab_page_navigation_history_back, - action__tab_page_navigation_history_forward, - action__tab_page_navigation_reload + action__history_back, + action__history_forward, + action__reload, + action__update ); const auto TAB_LABEL = new tab::Label( // @TODO manage db, - action__tab_close + action__close ); const int PAGE_NUMBER = append_page( diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index b872aad0..81a17f1b 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -67,12 +67,12 @@ namespace app::browser::main sqlite3 * db; // Actions - Glib::RefPtr action__update, - action__tab_close, - action__tab_close_all, - action__tab_page_navigation_history_back, - action__tab_page_navigation_history_forward, - action__tab_page_navigation_reload; + Glib::RefPtr action__close_all, + action__close, + action__history_back, + action__history_forward, + action__reload, + action__update; // Defaults const bool REORDERABLE = true; @@ -85,12 +85,12 @@ namespace app::browser::main Tab( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_CLOSE, - const Glib::RefPtr & ACTION__TAB_CLOSE_ALL, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__CLOSE, + const Glib::RefPtr & ACTION__CLOSE_ALL, + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ); // Actions diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index fa619cef..a3b6eda3 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -6,10 +6,10 @@ using namespace app::browser::main::tab; Page::Page( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ) { // Init meta title = _("New page"); @@ -32,10 +32,10 @@ Page::Page( // Init widget components pageNavigation = Gtk::make_managed( this->db, - ACTION__UPDATE, - ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - ACTION__TAB_PAGE_NAVIGATION_RELOAD + ACTION__HISTORY_BACK, + ACTION__HISTORY_FORWARD, + ACTION__RELOAD, + ACTION__UPDATE ); append( diff --git a/src/app/browser/main/tab/page.hpp b/src/app/browser/main/tab/page.hpp index 4a6df615..7cf7eb8e 100644 --- a/src/app/browser/main/tab/page.hpp +++ b/src/app/browser/main/tab/page.hpp @@ -114,10 +114,10 @@ namespace app::browser::main::tab Page( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ); // Actions diff --git a/src/app/browser/main/tab/page/navigation.cpp b/src/app/browser/main/tab/page/navigation.cpp index 4d5dc08c..344f42bc 100644 --- a/src/app/browser/main/tab/page/navigation.cpp +++ b/src/app/browser/main/tab/page/navigation.cpp @@ -9,10 +9,10 @@ using namespace app::browser::main::tab::page; Navigation::Navigation( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD, + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ) { // Init database DB::SESSION::init( @@ -53,8 +53,8 @@ Navigation::Navigation( navigationHistory = Gtk::make_managed( db, - ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD + ACTION__HISTORY_BACK, + ACTION__HISTORY_FORWARD ); append( @@ -62,7 +62,7 @@ Navigation::Navigation( ); navigationReload = Gtk::make_managed( - ACTION__TAB_PAGE_NAVIGATION_RELOAD + ACTION__RELOAD ); append( @@ -71,8 +71,8 @@ Navigation::Navigation( navigationRequest = Gtk::make_managed( db, - ACTION__UPDATE, - ACTION__TAB_PAGE_NAVIGATION_RELOAD + ACTION__RELOAD, + ACTION__UPDATE ); append( diff --git a/src/app/browser/main/tab/page/navigation/history.cpp b/src/app/browser/main/tab/page/navigation/history.cpp index eecdc56d..d9065d55 100644 --- a/src/app/browser/main/tab/page/navigation/history.cpp +++ b/src/app/browser/main/tab/page/navigation/history.cpp @@ -6,8 +6,8 @@ using namespace app::browser::main::tab::page::navigation; History::History( sqlite3 * db, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD ) { // Init database DB::SESSION::init( @@ -20,7 +20,7 @@ History::History( ); historyBack = Gtk::make_managed( - ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK + ACTION__HISTORY_BACK ); append( @@ -28,7 +28,7 @@ History::History( ); historyForward = Gtk::make_managed( - ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD + ACTION__HISTORY_FORWARD ); append( diff --git a/src/app/browser/main/tab/page/navigation/history.hpp b/src/app/browser/main/tab/page/navigation/history.hpp index 2f4797ce..1216bcc0 100644 --- a/src/app/browser/main/tab/page/navigation/history.hpp +++ b/src/app/browser/main/tab/page/navigation/history.hpp @@ -92,8 +92,8 @@ namespace app::browser::main::tab::page::navigation History( sqlite3 * db, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD + const Glib::RefPtr & ACTION__HISTORY_BACK, + const Glib::RefPtr & ACTION__HISTORY_FORWARD ); // Actions diff --git a/src/app/browser/main/tab/page/navigation/reload.cpp b/src/app/browser/main/tab/page/navigation/reload.cpp index 33b99630..055ecd2a 100644 --- a/src/app/browser/main/tab/page/navigation/reload.cpp +++ b/src/app/browser/main/tab/page/navigation/reload.cpp @@ -3,10 +3,10 @@ using namespace app::browser::main::tab::page::navigation; Reload::Reload( - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__RELOAD ) { // Init actions - action__tab_page_navigation_reload = ACTION__TAB_PAGE_NAVIGATION_RELOAD; + action__reload = ACTION__RELOAD; // Init widget set_icon_name( @@ -24,7 +24,7 @@ Reload::Reload( signal_clicked().connect( [this] { - action__tab_page_navigation_reload->activate(); + action__reload->activate(); } ); } @@ -36,7 +36,7 @@ void Reload::update( !REQUEST_TEXT.empty() ); - action__tab_page_navigation_reload->set_enabled( + action__reload->set_enabled( !REQUEST_TEXT.empty() ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation/reload.hpp b/src/app/browser/main/tab/page/navigation/reload.hpp index 5728b114..cb0f598a 100644 --- a/src/app/browser/main/tab/page/navigation/reload.hpp +++ b/src/app/browser/main/tab/page/navigation/reload.hpp @@ -10,12 +10,12 @@ namespace app::browser::main::tab::page::navigation { class Reload : public Gtk::Button { - Glib::RefPtr action__tab_page_navigation_reload; + Glib::RefPtr action__reload; public: Reload( - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__RELOAD ); void update( diff --git a/src/app/browser/main/tab/page/navigation/request.cpp b/src/app/browser/main/tab/page/navigation/request.cpp index 54a165e7..d42e268a 100644 --- a/src/app/browser/main/tab/page/navigation/request.cpp +++ b/src/app/browser/main/tab/page/navigation/request.cpp @@ -5,8 +5,8 @@ using namespace app::browser::main::tab::page::navigation; // Construct Request::Request( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ) { // Init database DB::SESSION::init( @@ -14,8 +14,8 @@ Request::Request( ); // Init actions + action__reload = ACTION__RELOAD; action__update = ACTION__UPDATE; - action__tab_page_navigation_reload = ACTION__TAB_PAGE_NAVIGATION_RELOAD; // Init extras progress_fraction = 0; @@ -44,7 +44,7 @@ Request::Request( signal_activate().connect( [this] { - action__tab_page_navigation_reload->activate(); + action__reload->activate(); } ); } diff --git a/src/app/browser/main/tab/page/navigation/request.hpp b/src/app/browser/main/tab/page/navigation/request.hpp index f4b64c62..a6f1869b 100644 --- a/src/app/browser/main/tab/page/navigation/request.hpp +++ b/src/app/browser/main/tab/page/navigation/request.hpp @@ -61,8 +61,8 @@ namespace app::browser::main::tab::page::navigation sqlite3 * db; // Actions - Glib::RefPtr action__update, - action__tab_page_navigation_reload; + Glib::RefPtr action__reload, + action__update; // Extras double progress_fraction; @@ -80,8 +80,8 @@ namespace app::browser::main::tab::page::navigation Request( sqlite3 * db, - const Glib::RefPtr & ACTION__UPDATE, - const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD + const Glib::RefPtr & ACTION__RELOAD, + const Glib::RefPtr & ACTION__UPDATE ); // Actions