Browse Source

draft local action group for page links navigation

CPP-GTK4
yggverse 3 months ago
parent
commit
39ed3edbb9
  1. 21
      src/app/browser.cpp
  2. 29
      src/app/browser/main/tab/page.cpp
  3. 1
      src/app/browser/main/tab/page.hpp
  4. 2
      src/app/browser/main/tab/page/content/text/gemini/reader.cpp

21
src/app/browser.cpp

@ -26,27 +26,6 @@ Browser::Browser( @@ -26,27 +26,6 @@ Browser::Browser(
}
);
add_action_with_parameter(
"open",
Glib::VARIANT_TYPE_STRING,
[this](const Glib::VariantBase & PARAMETER)
{
if (PARAMETER.is_of_type(Glib::VARIANT_TYPE_STRING))
{
browserMain->update(
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(
PARAMETER
).get()
);
browserHeader->update(
browserMain->get_tab_page_title(),
browserMain->get_tab_page_description()
);
}
}
);
const auto ACTION__SESSION_CLEAN = add_action(
"session_clean",
[this]

29
src/app/browser/main/tab/page.cpp

@ -52,6 +52,35 @@ Page::Page( @@ -52,6 +52,35 @@ Page::Page(
* pageContent
);
// Init widget action group @TODO
auto GioSimpleActionGroup = Gio::SimpleActionGroup::create();
// Define group actions
GioSimpleActionGroup->add_action_with_parameter(
"open",
Glib::VARIANT_TYPE_STRING,
[this](const Glib::VariantBase & PARAMETER)
{
if (PARAMETER.is_of_type(Glib::VARIANT_TYPE_STRING))
{
pageNavigation->set_request_text(
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(
PARAMETER
).get()
);
navigation_reload(
true
);
}
}
);
insert_action_group(
"page",
GioSimpleActionGroup
);
// Connect events
/* activated twice on tab change @TODO
signal_realize().connect(

1
src/app/browser/main/tab/page.hpp

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
#include <giomm/inputstream.h>
#include <giomm/outputstream.h>
#include <giomm/simpleaction.h>
#include <giomm/simpleactiongroup.h>
#include <giomm/socketclient.h>
#include <giomm/socketconnection.h>
#include <glibmm/i18n.h>

2
src/app/browser/main/tab/page/content/text/gemini/reader.cpp

@ -126,7 +126,7 @@ Reader::Reader( @@ -126,7 +126,7 @@ Reader::Reader(
if (SCHEME == NULL || SCHEME == Glib::ustring("gemini"))
{
return activate_action(
"win.open", // @TODO
"page.open", // @TODO use action argument
Glib::Variant<Glib::ustring>::create(
URI
)

Loading…
Cancel
Save