Browse Source

rename close action

CPP-GTK4
yggverse 3 months ago
parent
commit
5868ed822f
  1. 17
      src/app/browser.cpp
  2. 6
      src/app/browser/header.cpp
  3. 3
      src/app/browser/header.hpp
  4. 14
      src/app/browser/header/menu.cpp
  5. 3
      src/app/browser/header/menu.hpp
  6. 4
      src/app/browser/main.cpp
  7. 2
      src/app/browser/main.hpp
  8. 6
      src/app/browser/main/tab.cpp
  9. 4
      src/app/browser/main/tab.hpp
  10. 6
      src/app/browser/main/tab/label.cpp
  11. 4
      src/app/browser/main/tab/label.hpp

17
src/app/browser.cpp

@ -51,8 +51,8 @@ Browser::Browser( @@ -51,8 +51,8 @@ Browser::Browser(
"<Primary>t"
);
const auto ACTION__MAIN_TAB_CLOSE = add_action(
"main_tab_close",
const auto ACTION__MAIN_TAB_CLOSE_ACTIVE = add_action(
"main_tab_close_active",
[this]
{
browserMain->tab_close();
@ -79,16 +79,18 @@ Browser::Browser( @@ -79,16 +79,18 @@ Browser::Browser(
false
);
add_action(
const auto ACTION__MAIN_TAB_CLOSE_ALL = add_action(
"main_tab_close_all",
[this]
{
browserMain->tab_close_all();
}
)->set_enabled(
false
);
ACTION__MAIN_TAB_CLOSE_ALL->set_enabled(
false
);
const auto ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE = add_action(
"main_tab_page_navigation_update",
[this]
@ -154,7 +156,8 @@ Browser::Browser( @@ -154,7 +156,8 @@ Browser::Browser(
browserHeader = Gtk::make_managed<browser::Header>(
ACTION__DEBUG,
ACTION__MAIN_TAB_APPEND,
ACTION__MAIN_TAB_CLOSE,
ACTION__MAIN_TAB_CLOSE_ACTIVE,
ACTION__MAIN_TAB_CLOSE_ALL,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE
@ -166,7 +169,7 @@ Browser::Browser( @@ -166,7 +169,7 @@ Browser::Browser(
browserMain = Gtk::make_managed<browser::Main>(
ACTION__REFRESH,
ACTION__MAIN_TAB_CLOSE,
ACTION__MAIN_TAB_CLOSE_ACTIVE,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE

6
src/app/browser/header.cpp

@ -8,7 +8,8 @@ using namespace app::browser; @@ -8,7 +8,8 @@ using namespace app::browser;
Header::Header(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE
@ -22,7 +23,8 @@ Header::Header( @@ -22,7 +23,8 @@ Header::Header(
headerMenu = Gtk::make_managed<header::Menu>(
ACTION__DEBUG,
ACTION__MAIN_TAB_APPEND,
ACTION__MAIN_TAB_CLOSE,
ACTION__MAIN_TAB_CLOSE_ACTIVE,
ACTION__MAIN_TAB_CLOSE_ALL,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE

3
src/app/browser/header.hpp

@ -31,7 +31,8 @@ namespace app::browser @@ -31,7 +31,8 @@ namespace app::browser
Header(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE

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

@ -5,7 +5,8 @@ using namespace app::browser::header; @@ -5,7 +5,8 @@ using namespace app::browser::header;
Menu::Menu(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE
@ -74,7 +75,7 @@ Menu::Menu( @@ -74,7 +75,7 @@ Menu::Menu(
MENU__MAIN_TAB_CLOSE->append(
_("Active tab"),
get_action_detailed_name(
ACTION__MAIN_TAB_CLOSE
ACTION__MAIN_TAB_CLOSE_ACTIVE
)
);
@ -83,24 +84,23 @@ Menu::Menu( @@ -83,24 +84,23 @@ Menu::Menu(
MENU__MAIN_TAB_CLOSE->append(
_("All tabs to left"),
get_action_detailed_name(
ACTION__MAIN_TAB_CLOSE
ACTION__MAIN_TAB_CLOSE_LEFT
)
);
MENU__MAIN_TAB_CLOSE->append(
_("All tabs to right"),
get_action_detailed_name(
ACTION__MAIN_TAB_CLOSE
ACTION__MAIN_TAB_CLOSE_RIGHT
)
);
*/
MENU__MAIN_TAB_CLOSE->append(
_("All tabs"),
get_action_detailed_name(
ACTION__MAIN_TAB_CLOSE
ACTION__MAIN_TAB_CLOSE_ALL
)
);
*/
MENU__MAIN_TAB->append_submenu(
_("Close"),

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

@ -20,7 +20,8 @@ namespace app::browser::header @@ -20,7 +20,8 @@ namespace app::browser::header
Menu(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE

4
src/app/browser/main.cpp

@ -5,7 +5,7 @@ using namespace app::browser; @@ -5,7 +5,7 @@ using namespace app::browser;
Main::Main(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE
@ -22,7 +22,7 @@ Main::Main( @@ -22,7 +22,7 @@ Main::Main(
// Init components
mainTab = Gtk::make_managed<main::Tab>(
ACTION__REFRESH,
ACTION__MAIN_TAB_CLOSE,
ACTION__MAIN_TAB_CLOSE_ACTIVE,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE

2
src/app/browser/main.hpp

@ -27,7 +27,7 @@ namespace app::browser @@ -27,7 +27,7 @@ namespace app::browser
Main(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE

6
src/app/browser/main/tab.cpp

@ -6,14 +6,14 @@ using namespace app::browser::main; @@ -6,14 +6,14 @@ using namespace app::browser::main;
Tab::Tab(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_UPDATE
) {
// Init actions
action__refresh = ACTION__REFRESH;
action__tab_close = ACTION__TAB_CLOSE;
action__tab_close_active = ACTION__TAB_CLOSE_ACTIVE;
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_update = ACTION__TAB_PAGE_NAVIGATION_UPDATE;
@ -65,7 +65,7 @@ void Tab::append( @@ -65,7 +65,7 @@ void Tab::append(
);
auto tabLabel = new tab::Label(
action__tab_close
action__tab_close_active
);
int page_number = append_page(

4
src/app/browser/main/tab.hpp

@ -19,7 +19,7 @@ namespace app::browser::main @@ -19,7 +19,7 @@ namespace app::browser::main
{
// Actions
Glib::RefPtr<Gio::SimpleAction> action__refresh,
action__tab_close,
action__tab_close_active,
action__tab_page_navigation_history_back,
action__tab_page_navigation_history_forward,
action__tab_page_navigation_update;
@ -41,7 +41,7 @@ namespace app::browser::main @@ -41,7 +41,7 @@ namespace app::browser::main
Tab(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_UPDATE

6
src/app/browser/main/tab/label.cpp

@ -3,10 +3,10 @@ @@ -3,10 +3,10 @@
using namespace app::browser::main::tab;
Label::Label(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLOSE
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLOSE_ACTIVE
) {
// Init actions
action__close = ACTION__CLOSE;
action__close_active = ACTION__CLOSE_ACTIVE;
// Setup label controller
auto GtkGestureClick = Gtk::GestureClick::create();
@ -21,7 +21,7 @@ Label::Label( @@ -21,7 +21,7 @@ Label::Label(
{
if (n == 2) // double click
{
action__close->activate();
action__close_active->activate();
}
}
);

4
src/app/browser/main/tab/label.hpp

@ -12,12 +12,12 @@ namespace app::browser::main::tab @@ -12,12 +12,12 @@ namespace app::browser::main::tab
{
class Label : public Gtk::Label
{
Glib::RefPtr<Gio::SimpleAction> action__close;
Glib::RefPtr<Gio::SimpleAction> action__close_active;
public:
Label(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLOSE
const Glib::RefPtr<Gio::SimpleAction> & ACTION__CLOSE_ACTIVE
);
};
}

Loading…
Cancel
Save