mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
use open_link_variant action
This commit is contained in:
parent
0a75ca7671
commit
18c16e9e95
9 changed files with 68 additions and 35 deletions
|
|
@ -4,6 +4,7 @@
|
|||
using namespace app::browser::main::tab::page::content::text;
|
||||
|
||||
Gemini::Gemini(
|
||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__OPEN_LINK_VARIANT,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title,
|
||||
GUri * uri
|
||||
|
|
@ -18,6 +19,7 @@ Gemini::Gemini(
|
|||
|
||||
set_child(
|
||||
* Gtk::make_managed<gemini::Reader>(
|
||||
ACTION__OPEN_LINK_VARIANT,
|
||||
GEMTEXT,
|
||||
title,
|
||||
uri
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
|
||||
#include <giomm/simpleaction.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/viewport.h>
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ namespace app::browser::main::tab::page::content::text
|
|||
public:
|
||||
|
||||
Gemini(
|
||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__OPEN_LINK_VARIANT,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title,
|
||||
GUri * uri
|
||||
|
|
|
|||
|
|
@ -3,10 +3,14 @@
|
|||
using namespace app::browser::main::tab::page::content::text::gemini;
|
||||
|
||||
Reader::Reader(
|
||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__OPEN_LINK_VARIANT,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title,
|
||||
GUri * base
|
||||
) {
|
||||
// Init shared actions
|
||||
action__open_link_variant = ACTION__OPEN_LINK_VARIANT;
|
||||
|
||||
// Build markup
|
||||
Glib::ustring markup;
|
||||
|
||||
|
|
@ -125,12 +129,13 @@ Reader::Reader(
|
|||
|
||||
if (SCHEME == NULL || SCHEME == Glib::ustring("gemini"))
|
||||
{
|
||||
return activate_action(
|
||||
"page.open", // @TODO use action argument
|
||||
action__open_link_variant->activate_variant(
|
||||
Glib::Variant<Glib::ustring>::create(
|
||||
URI
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // delegate unsupported URI to external application
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_READER_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_READER_HPP
|
||||
|
||||
#include <giomm/simpleaction.h>
|
||||
#include <glibmm/i18n.h>
|
||||
#include <glibmm/markup.h>
|
||||
#include <glibmm/regex.h>
|
||||
|
|
@ -63,12 +64,18 @@ namespace app::browser::main::tab::page::content::text::gemini
|
|||
);
|
||||
};
|
||||
|
||||
/*
|
||||
* Internal members
|
||||
*/
|
||||
Glib::RefPtr<Gio::SimpleAction> action__open_link_variant;
|
||||
|
||||
/*
|
||||
* Reader class API
|
||||
*/
|
||||
public:
|
||||
|
||||
Reader(
|
||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__OPEN_LINK_VARIANT,
|
||||
const Glib::ustring & GEMTEXT,
|
||||
Glib::ustring & title,
|
||||
GUri * uri
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue