fix new tab button action

This commit is contained in:
yggverse 2024-09-15 11:19:39 +03:00
parent eb1f3baf13
commit bf6287ae72
3 changed files with 24 additions and 7 deletions

View File

@ -42,7 +42,9 @@ Header::Header(
* headerMenu * headerMenu
); );
headerTab = Gtk::make_managed<header::Tab>(); headerTab = Gtk::make_managed<header::Tab>(
ACTION__TAB_APPEND
);
pack_start( pack_start(
* headerTab * headerTab

View File

@ -2,12 +2,13 @@
using namespace app::browser::header; using namespace app::browser::header;
Tab::Tab() Tab::Tab(
{ const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_APPEND
set_action_name( ) {
"win.main_tab_append" // Init actions
); action__tab_append = ACTION__TAB_APPEND;
// Init widget
set_icon_name( set_icon_name(
"tab-new-symbolic" "tab-new-symbolic"
); );
@ -15,4 +16,12 @@ Tab::Tab()
set_tooltip_text( set_tooltip_text(
_("New tab") _("New tab")
); );
// Init events
signal_clicked().connect(
[this]
{
action__tab_append->activate();
}
);
} }

View File

@ -1,16 +1,22 @@
#ifndef APP_BROWSER_HEADER_TAB_HPP #ifndef APP_BROWSER_HEADER_TAB_HPP
#define APP_BROWSER_HEADER_TAB_HPP #define APP_BROWSER_HEADER_TAB_HPP
#include <giomm/simpleaction.h>
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <glibmm/refptr.h>
#include <gtkmm/button.h> #include <gtkmm/button.h>
namespace app::browser::header namespace app::browser::header
{ {
class Tab : public Gtk::Button class Tab : public Gtk::Button
{ {
Glib::RefPtr<Gio::SimpleAction> action__tab_append;
public: public:
Tab(); Tab(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_APPEND
);
}; };
} }