Browse Source

update setter names

CPP-GTK4
yggverse 3 months ago
parent
commit
a5a3a5625b
  1. 6
      src/app/browser/main/tab/page.cpp
  2. 14
      src/app/browser/main/tab/page/content.cpp
  3. 8
      src/app/browser/main/tab/page/content.hpp

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

@ -113,14 +113,14 @@ void Page::update()
// Route by mime type or path extension // Route by mime type or path extension
if (meta[2] == "text/gemini" || Glib::str_has_suffix(navbar->get_request_path(), ".gmi")) if (meta[2] == "text/gemini" || Glib::str_has_suffix(navbar->get_request_path(), ".gmi"))
{ {
content->text_gemini( content->set_text_gemini(
buffer // @TODO buffer // @TODO
); );
} }
else else
{ {
content->text_plain( content->set_text_plain(
_("MIME type not supported") _("MIME type not supported")
); );
} }
@ -128,7 +128,7 @@ void Page::update()
else else
{ {
content->text_plain( content->set_text_plain(
_("Could not open page") _("Could not open page")
); );
} }

14
src/app/browser/main/tab/page/content.cpp

@ -23,20 +23,20 @@ Content::~Content()
}; };
// Public actions // Public actions
void Content::text_gemini( void Content::set_text_gemini(
const Glib::ustring & gemtext const Glib::ustring & gemtext
) { ) {
update( set_widget(
new content::text::Gemini( new content::text::Gemini(
gemtext gemtext
) )
); );
} }
void Content::text_plain( void Content::set_text_plain(
const Glib::ustring & text const Glib::ustring & text
) { ) {
update( set_widget(
new content::text::Plain( new content::text::Plain(
text text
) )
@ -46,8 +46,8 @@ void Content::text_plain(
// @TODO text_plain, picture, video, etc. // @TODO text_plain, picture, video, etc.
// Private helpers // Private helpers
void Content::update( void Content::set_widget(
Gtk::Widget * new_widget Gtk::Widget * object
) { ) {
if (widget != nullptr) if (widget != nullptr)
{ {
@ -58,7 +58,7 @@ void Content::update(
delete widget; delete widget;
} }
widget = new_widget; widget = object;
append( append(
* widget * widget

8
src/app/browser/main/tab/page/content.hpp

@ -11,8 +11,8 @@ namespace app::browser::main::tab::page
{ {
Gtk::Widget * widget; Gtk::Widget * widget;
void update( void set_widget(
Gtk::Widget * new_widget Gtk::Widget * object
); );
public: public:
@ -21,11 +21,11 @@ namespace app::browser::main::tab::page
~Content(); ~Content();
void text_gemini( void set_text_gemini(
const Glib::ustring & gemtext const Glib::ustring & gemtext
); );
void text_plain( void set_text_plain(
const Glib::ustring & text const Glib::ustring & text
); );
}; };

Loading…
Cancel
Save