Browse Source

add clean session action and menu item

CPP-GTK4
yggverse 2 months ago
parent
commit
ab6f0cca3a
  1. 9
      src/app/browser.cpp
  2. 2
      src/app/browser/header.cpp
  3. 1
      src/app/browser/header.hpp
  4. 8
      src/app/browser/header/menu.cpp
  5. 1
      src/app/browser/header/menu.hpp
  6. 5
      src/app/browser/main.cpp
  7. 1
      src/app/browser/main.hpp

9
src/app/browser.cpp

@ -22,6 +22,14 @@ Browser::Browser( @@ -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( @@ -194,6 +202,7 @@ Browser::Browser(
browserHeader = Gtk::make_managed<browser::Header>(
ACTION__DEBUG,
ACTION__QUIT,
ACTION__CLEAN,
ACTION__RESTORE,
ACTION__SAVE,
ACTION__MAIN_TAB_APPEND,

2
src/app/browser/header.cpp

@ -8,6 +8,7 @@ using namespace app::browser; @@ -8,6 +8,7 @@ using namespace app::browser;
Header::Header(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLEAN,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
@ -26,6 +27,7 @@ Header::Header( @@ -26,6 +27,7 @@ Header::Header(
headerMenu = Gtk::make_managed<header::Menu>(
ACTION__DEBUG,
ACTION__QUIT,
ACTION__CLEAN,
ACTION__RESTORE,
ACTION__SAVE,
ACTION__MAIN_TAB_APPEND,

1
src/app/browser/header.hpp

@ -31,6 +31,7 @@ namespace app::browser @@ -31,6 +31,7 @@ namespace app::browser
Header(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLEAN,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,

8
src/app/browser/header/menu.cpp

@ -5,6 +5,7 @@ using namespace app::browser::header; @@ -5,6 +5,7 @@ using namespace app::browser::header;
Menu::Menu(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLEAN,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
@ -24,6 +25,13 @@ Menu::Menu( @@ -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(

1
src/app/browser/header/menu.hpp

@ -20,6 +20,7 @@ namespace app::browser::header @@ -20,6 +20,7 @@ namespace app::browser::header
Menu(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLEAN,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,

5
src/app/browser/main.cpp

@ -53,6 +53,11 @@ void Main::tab_append() @@ -53,6 +53,11 @@ void Main::tab_append()
);
};
void Main::clean()
{
mainTab->clean();
};
void Main::restore()
{
mainTab->restore();

1
src/app/browser/main.hpp

@ -38,6 +38,7 @@ namespace app::browser @@ -38,6 +38,7 @@ namespace app::browser
// Actions
void update();
void clean();
void restore();
void save();

Loading…
Cancel
Save