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(
} }
); );
const auto ACTION__CLEAN = add_action(
"clean",
[this]
{
browserMain->clean();
}
);
const auto ACTION__RESTORE = add_action( const auto ACTION__RESTORE = add_action(
"restore", "restore",
[this] [this]
@ -194,6 +202,7 @@ Browser::Browser(
browserHeader = Gtk::make_managed<browser::Header>( browserHeader = Gtk::make_managed<browser::Header>(
ACTION__DEBUG, ACTION__DEBUG,
ACTION__QUIT, ACTION__QUIT,
ACTION__CLEAN,
ACTION__RESTORE, ACTION__RESTORE,
ACTION__SAVE, ACTION__SAVE,
ACTION__MAIN_TAB_APPEND, ACTION__MAIN_TAB_APPEND,

2
src/app/browser/header.cpp

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

1
src/app/browser/header.hpp

@ -31,6 +31,7 @@ namespace app::browser
Header( Header(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG, const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT, 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__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE, const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND, 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;
Menu::Menu( Menu::Menu(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG, const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT, 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__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE, const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND, const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
@ -24,6 +25,13 @@ Menu::Menu(
const auto MENU__MAIN_SESSION = Gio::Menu::create(); const auto MENU__MAIN_SESSION = Gio::Menu::create();
MENU__MAIN_SESSION->append(
_("Clean"),
get_action_detailed_name(
ACTION__CLEAN
)
);
MENU__MAIN_SESSION->append( MENU__MAIN_SESSION->append(
_("Restore"), _("Restore"),
get_action_detailed_name( get_action_detailed_name(

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

@ -20,6 +20,7 @@ namespace app::browser::header
Menu( Menu(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG, const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__QUIT, 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__RESTORE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE, const Glib::RefPtr<Gio::SimpleAction> & ACTION__SAVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND, const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,

5
src/app/browser/main.cpp

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

1
src/app/browser/main.hpp

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

Loading…
Cancel
Save