mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
implement alternative update action api
This commit is contained in:
parent
6b6d3ad826
commit
cda76380e8
@ -33,9 +33,17 @@ Browser::Browser(
|
|||||||
{
|
{
|
||||||
if (PARAMETER.is_of_type(Glib::VARIANT_TYPE_STRING))
|
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()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// @TODO process request
|
|
||||||
// Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(parameter).get()
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -168,6 +168,15 @@ void Main::update()
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void Main::update(
|
||||||
|
const Glib::ustring & URI
|
||||||
|
) {
|
||||||
|
mainTab->update(
|
||||||
|
mainTab->get_current_page(),
|
||||||
|
URI
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
Glib::ustring Main::get_tab_page_title()
|
Glib::ustring Main::get_tab_page_title()
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,10 @@ namespace app::browser
|
|||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
void update(
|
||||||
|
const Glib::ustring & URI
|
||||||
|
);
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
Glib::ustring get_tab_page_title();
|
Glib::ustring get_tab_page_title();
|
||||||
Glib::ustring get_tab_page_description();
|
Glib::ustring get_tab_page_description();
|
||||||
|
@ -166,6 +166,37 @@ void Tab::update(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tab::update(
|
||||||
|
const int & PAGE_NUMBER,
|
||||||
|
const Glib::ustring & URI
|
||||||
|
) {
|
||||||
|
// Get tab page
|
||||||
|
const auto TAB_PAGE = get_tabPage(
|
||||||
|
PAGE_NUMBER
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update tab page component
|
||||||
|
TAB_PAGE->update(
|
||||||
|
URI
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update tab label component
|
||||||
|
get_tabLabel(
|
||||||
|
PAGE_NUMBER
|
||||||
|
)->set_label(
|
||||||
|
TAB_PAGE->get_title()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update tab actions status
|
||||||
|
action__tab_close_active->set_enabled(
|
||||||
|
get_n_pages() > 0
|
||||||
|
);
|
||||||
|
|
||||||
|
action__tab_close_all->set_enabled(
|
||||||
|
get_n_pages() > 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
int Tab::append(
|
int Tab::append(
|
||||||
const Glib::ustring & LABEL_TEXT,
|
const Glib::ustring & LABEL_TEXT,
|
||||||
const bool & IS_CURRENT
|
const bool & IS_CURRENT
|
||||||
|
@ -124,6 +124,11 @@ namespace app::browser::main
|
|||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void update(
|
||||||
|
const int & PAGE_NUMBER,
|
||||||
|
const Glib::ustring & URI
|
||||||
|
);
|
||||||
|
|
||||||
int restore(
|
int restore(
|
||||||
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
|
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
|
||||||
); // return sqlite3_finalize status code
|
); // return sqlite3_finalize status code
|
||||||
|
@ -155,6 +155,16 @@ void Page::update()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Page::update(
|
||||||
|
const Glib::ustring & URI
|
||||||
|
) {
|
||||||
|
// Update children components
|
||||||
|
pageNavigation->update(
|
||||||
|
URI,
|
||||||
|
progress_fraction
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void Page::navigation_reload(
|
void Page::navigation_reload(
|
||||||
const bool & ADD_HISTORY
|
const bool & ADD_HISTORY
|
||||||
) {
|
) {
|
||||||
|
@ -133,6 +133,10 @@ namespace app::browser::main::tab
|
|||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
void update(
|
||||||
|
const Glib::ustring & URI
|
||||||
|
);
|
||||||
|
|
||||||
void navigation_reload(
|
void navigation_reload(
|
||||||
const bool & ADD_HISTORY
|
const bool & ADD_HISTORY
|
||||||
);
|
);
|
||||||
|
@ -117,6 +117,30 @@ void Navigation::update(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Navigation::update(
|
||||||
|
const Glib::ustring & REQUEST_TEXT,
|
||||||
|
const double & REQUEST_PROGRESS_FRACTION
|
||||||
|
) {
|
||||||
|
// Update base widget
|
||||||
|
navigationBase->update(
|
||||||
|
REQUEST_TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update history widget
|
||||||
|
navigationHistory->update();
|
||||||
|
|
||||||
|
// Toggle update button sensibility
|
||||||
|
navigationReload->update(
|
||||||
|
navigationRequest->get_text_length() > 0
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update request area (with progressbar)
|
||||||
|
navigationRequest->update(
|
||||||
|
REQUEST_TEXT,
|
||||||
|
REQUEST_PROGRESS_FRACTION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
int Navigation::restore(
|
int Navigation::restore(
|
||||||
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
|
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
|
||||||
) {
|
) {
|
||||||
|
@ -93,6 +93,11 @@ namespace app::browser::main::tab::page
|
|||||||
const double & PROGRESS_FRACTION
|
const double & PROGRESS_FRACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void update(
|
||||||
|
const Glib::ustring & REQUEST_TEXT,
|
||||||
|
const double & REQUEST_PROGRESS_FRACTION
|
||||||
|
);
|
||||||
|
|
||||||
int restore(
|
int restore(
|
||||||
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
|
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
|
||||||
); // return sqlite3_finalize status code
|
); // return sqlite3_finalize status code
|
||||||
|
@ -15,4 +15,22 @@ Base::Base()
|
|||||||
set_sensitive(
|
set_sensitive(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// @TODO add action
|
||||||
|
}
|
||||||
|
|
||||||
|
void Base::update(
|
||||||
|
const Glib::ustring & URI
|
||||||
|
) {
|
||||||
|
GUri * uri = g_uri_parse(
|
||||||
|
URI.c_str(),
|
||||||
|
G_URI_FLAGS_NONE,
|
||||||
|
NULL // @TODO GError *
|
||||||
|
);
|
||||||
|
|
||||||
|
set_sensitive(
|
||||||
|
NULL != uri &&
|
||||||
|
NULL != g_uri_get_host(uri) &&
|
||||||
|
NULL != g_uri_get_path(uri)
|
||||||
|
);
|
||||||
}
|
}
|
@ -11,6 +11,10 @@ namespace app::browser::main::tab::page::navigation
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Base();
|
Base();
|
||||||
|
|
||||||
|
void update(
|
||||||
|
const Glib::ustring & URI
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,19 @@ void Request::update(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Request::update(
|
||||||
|
const Glib::ustring & TEXT,
|
||||||
|
const double & PROGRESS_FRACTION
|
||||||
|
) {
|
||||||
|
set_text(
|
||||||
|
TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
update(
|
||||||
|
PROGRESS_FRACTION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
int Request::restore(
|
int Request::restore(
|
||||||
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
||||||
) {
|
) {
|
||||||
|
@ -89,6 +89,11 @@ namespace app::browser::main::tab::page::navigation
|
|||||||
const double & PROGRESS_FRACTION
|
const double & PROGRESS_FRACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void update(
|
||||||
|
const Glib::ustring & TEXT,
|
||||||
|
const double & PROGRESS_FRACTION
|
||||||
|
);
|
||||||
|
|
||||||
int restore(
|
int restore(
|
||||||
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
||||||
); // return sqlite3_finalize status code
|
); // return sqlite3_finalize status code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user