mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
add page mime type enum
This commit is contained in:
parent
ecfcb1728a
commit
2a7e1e9775
2 changed files with 29 additions and 4 deletions
|
|
@ -10,6 +10,11 @@ Page::Page(
|
||||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD,
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD,
|
||||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE
|
||||||
) {
|
) {
|
||||||
|
// Init extras
|
||||||
|
mime = MIME::UNDEFINED;
|
||||||
|
title = _("New page");
|
||||||
|
subtitle = "";
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
pageNavigation = Gtk::make_managed<page::Navigation>(
|
pageNavigation = Gtk::make_managed<page::Navigation>(
|
||||||
ACTION__REFRESH,
|
ACTION__REFRESH,
|
||||||
|
|
@ -34,7 +39,9 @@ Page::Page(
|
||||||
);
|
);
|
||||||
|
|
||||||
refresh(
|
refresh(
|
||||||
_("New page"), "", 0
|
title,
|
||||||
|
subtitle,
|
||||||
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,6 +176,8 @@ void Page::navigation_update(
|
||||||
// Route by mime type or path extension
|
// Route by mime type or path extension
|
||||||
if (meta[2] == "text/gemini" || Glib::str_has_suffix(pageNavigation->get_request_path(), ".gmi"))
|
if (meta[2] == "text/gemini" || Glib::str_has_suffix(pageNavigation->get_request_path(), ".gmi"))
|
||||||
{
|
{
|
||||||
|
mime = MIME::TEXT_GEMINI;
|
||||||
|
|
||||||
pageContent->set_text_gemini(
|
pageContent->set_text_gemini(
|
||||||
buffer // @TODO
|
buffer // @TODO
|
||||||
);
|
);
|
||||||
|
|
@ -176,6 +185,8 @@ void Page::navigation_update(
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
mime = MIME::TEXT_PLAIN;
|
||||||
|
|
||||||
pageContent->set_text_plain(
|
pageContent->set_text_plain(
|
||||||
_("MIME type not supported")
|
_("MIME type not supported")
|
||||||
);
|
);
|
||||||
|
|
@ -257,6 +268,11 @@ void Page::navigation_history_forward()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
Page::MIME Page::get_mime()
|
||||||
|
{
|
||||||
|
return mime;
|
||||||
|
}
|
||||||
|
|
||||||
Glib::ustring Page::get_title()
|
Glib::ustring Page::get_title()
|
||||||
{
|
{
|
||||||
return title;
|
return title;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,14 @@ namespace app::browser::main::tab
|
||||||
class Page : public Gtk::Box
|
class Page : public Gtk::Box
|
||||||
{
|
{
|
||||||
// Extras
|
// Extras
|
||||||
|
enum MIME
|
||||||
|
{
|
||||||
|
TEXT_PLAIN,
|
||||||
|
TEXT_GEMINI,
|
||||||
|
UNDEFINED
|
||||||
|
};
|
||||||
|
|
||||||
|
MIME mime;
|
||||||
Glib::ustring title;
|
Glib::ustring title;
|
||||||
Glib::ustring subtitle;
|
Glib::ustring subtitle;
|
||||||
|
|
||||||
|
|
@ -63,6 +71,7 @@ namespace app::browser::main::tab
|
||||||
void navigation_history_forward();
|
void navigation_history_forward();
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
Page::MIME get_mime();
|
||||||
Glib::ustring get_title();
|
Glib::ustring get_title();
|
||||||
Glib::ustring get_subtitle();
|
Glib::ustring get_subtitle();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue