From ab6f0cca3a6cb8ca69a9f4747b94b8914aac3a32 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 11 Sep 2024 08:00:47 +0300 Subject: [PATCH] add clean session action and menu item --- src/app/browser.cpp | 9 +++++++++ src/app/browser/header.cpp | 2 ++ src/app/browser/header.hpp | 1 + src/app/browser/header/menu.cpp | 8 ++++++++ src/app/browser/header/menu.hpp | 1 + src/app/browser/main.cpp | 5 +++++ src/app/browser/main.hpp | 1 + 7 files changed, 27 insertions(+) diff --git a/src/app/browser.cpp b/src/app/browser.cpp index a635c7d6..7e2a333f 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -22,6 +22,14 @@ Browser::Browser( } ); + const auto ACTION__CLEAN = add_action( + "clean", + [this] + { + browserMain->clean(); + } + ); + const auto ACTION__RESTORE = add_action( "restore", [this] @@ -194,6 +202,7 @@ Browser::Browser( browserHeader = Gtk::make_managed( ACTION__DEBUG, ACTION__QUIT, + ACTION__CLEAN, ACTION__RESTORE, ACTION__SAVE, ACTION__MAIN_TAB_APPEND, diff --git a/src/app/browser/header.cpp b/src/app/browser/header.cpp index 25b54a05..15a1c612 100644 --- a/src/app/browser/header.cpp +++ b/src/app/browser/header.cpp @@ -8,6 +8,7 @@ using namespace app::browser; Header::Header( const Glib::RefPtr & ACTION__DEBUG, const Glib::RefPtr & ACTION__QUIT, + const Glib::RefPtr & ACTION__CLEAN, const Glib::RefPtr & ACTION__RESTORE, const Glib::RefPtr & ACTION__SAVE, const Glib::RefPtr & ACTION__MAIN_TAB_APPEND, @@ -26,6 +27,7 @@ Header::Header( headerMenu = Gtk::make_managed( ACTION__DEBUG, ACTION__QUIT, + ACTION__CLEAN, ACTION__RESTORE, ACTION__SAVE, ACTION__MAIN_TAB_APPEND, diff --git a/src/app/browser/header.hpp b/src/app/browser/header.hpp index 0230a9ed..e661b0c8 100644 --- a/src/app/browser/header.hpp +++ b/src/app/browser/header.hpp @@ -31,6 +31,7 @@ namespace app::browser Header( const Glib::RefPtr & ACTION__DEBUG, const Glib::RefPtr & ACTION__QUIT, + const Glib::RefPtr & ACTION__CLEAN, const Glib::RefPtr & ACTION__RESTORE, const Glib::RefPtr & ACTION__SAVE, const Glib::RefPtr & ACTION__MAIN_TAB_APPEND, diff --git a/src/app/browser/header/menu.cpp b/src/app/browser/header/menu.cpp index 00e3f7f1..125b3dcc 100644 --- a/src/app/browser/header/menu.cpp +++ b/src/app/browser/header/menu.cpp @@ -5,6 +5,7 @@ using namespace app::browser::header; Menu::Menu( const Glib::RefPtr & ACTION__DEBUG, const Glib::RefPtr & ACTION__QUIT, + const Glib::RefPtr & ACTION__CLEAN, const Glib::RefPtr & ACTION__RESTORE, const Glib::RefPtr & ACTION__SAVE, const Glib::RefPtr & ACTION__MAIN_TAB_APPEND, @@ -24,6 +25,13 @@ Menu::Menu( const auto MENU__MAIN_SESSION = Gio::Menu::create(); + MENU__MAIN_SESSION->append( + _("Clean"), + get_action_detailed_name( + ACTION__CLEAN + ) + ); + MENU__MAIN_SESSION->append( _("Restore"), get_action_detailed_name( diff --git a/src/app/browser/header/menu.hpp b/src/app/browser/header/menu.hpp index 3296241f..3aa41fd7 100644 --- a/src/app/browser/header/menu.hpp +++ b/src/app/browser/header/menu.hpp @@ -20,6 +20,7 @@ namespace app::browser::header Menu( const Glib::RefPtr & ACTION__DEBUG, const Glib::RefPtr & ACTION__QUIT, + const Glib::RefPtr & ACTION__CLEAN, const Glib::RefPtr & ACTION__RESTORE, const Glib::RefPtr & ACTION__SAVE, const Glib::RefPtr & ACTION__MAIN_TAB_APPEND, diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index 8d7cd7cb..cd5b5f55 100644 --- a/src/app/browser/main.cpp +++ b/src/app/browser/main.cpp @@ -53,6 +53,11 @@ void Main::tab_append() ); }; +void Main::clean() +{ + mainTab->clean(); +}; + void Main::restore() { mainTab->restore(); diff --git a/src/app/browser/main.hpp b/src/app/browser/main.hpp index 5bbeb9a1..11c4031c 100644 --- a/src/app/browser/main.hpp +++ b/src/app/browser/main.hpp @@ -38,6 +38,7 @@ namespace app::browser // Actions void update(); + void clean(); void restore(); void save();