mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-12 05:31:06 +00:00
update actions
This commit is contained in:
parent
5065dd23d6
commit
d63ba8f1ad
@ -32,33 +32,51 @@ Browser::Browser(
|
||||
* browserMain
|
||||
);
|
||||
|
||||
// Init actions
|
||||
// Init browser window actions
|
||||
add_action(
|
||||
"main_tab_append",
|
||||
"refresh",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_append();
|
||||
browserMain->refresh();
|
||||
|
||||
browserHeader->set_title(
|
||||
browserMain->get_current_tab_page_title()
|
||||
);
|
||||
|
||||
browserHeader->set_subtitle(
|
||||
browserMain->get_current_tab_page_subtitle()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
"main_tab_page_update",
|
||||
"debug",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_update();
|
||||
// @TODO https://gitlab.gnome.org/GNOME/gtkmm/-/commit/5f3b82537d3daad7bda59dd01e719788070f4b6c
|
||||
gtk_window_set_interactive_debugging(
|
||||
true
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Close
|
||||
add_action(
|
||||
"main_tab_close",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_close();
|
||||
}
|
||||
);
|
||||
// Tab actions
|
||||
add_action(
|
||||
"main_tab_append",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_append();
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
"main_tab_close",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_close();
|
||||
}
|
||||
);
|
||||
|
||||
// Close submenu
|
||||
add_action(
|
||||
"main_tab_close_left",
|
||||
[this]
|
||||
@ -83,49 +101,28 @@ Browser::Browser(
|
||||
}
|
||||
);
|
||||
|
||||
// History
|
||||
add_action(
|
||||
"main_tab_page_navigation_history_try_back",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_page_navigation_history_try_back();
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
"main_tab_page_navigation_history_try_forward",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_page_navigation_history_try_forward();
|
||||
}
|
||||
);
|
||||
|
||||
// Tool
|
||||
add_action(
|
||||
"debug",
|
||||
[this]
|
||||
{
|
||||
// @TODO https://gitlab.gnome.org/GNOME/gtkmm/-/commit/5f3b82537d3daad7bda59dd01e719788070f4b6c
|
||||
gtk_window_set_interactive_debugging(
|
||||
true
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Hidden
|
||||
add_action(
|
||||
"refresh",
|
||||
[this]
|
||||
{
|
||||
browserMain->refresh();
|
||||
|
||||
browserHeader->set_title(
|
||||
browserMain->get_current_tab_page_title()
|
||||
// Tab page navigation actions
|
||||
add_action(
|
||||
"main_tab_page_navigation_update",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_page_update();
|
||||
}
|
||||
);
|
||||
|
||||
browserHeader->set_subtitle(
|
||||
browserMain->get_current_tab_page_subtitle()
|
||||
add_action(
|
||||
"main_tab_page_navigation_history_try_back",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_page_navigation_history_try_back();
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
"main_tab_page_navigation_history_try_forward",
|
||||
[this]
|
||||
{
|
||||
browserMain->tab_page_navigation_history_try_forward();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
@ -96,7 +96,7 @@ Glib::RefPtr<Gio::Menu> Menu::main_tab_page_navigation(
|
||||
|
||||
menu->append(
|
||||
_("Update"),
|
||||
"win.main_tab_page_update"
|
||||
"win.main_tab_page_navigation_update"
|
||||
);
|
||||
|
||||
return menu;
|
||||
|
@ -38,6 +38,13 @@ Glib::ustring Main::get_current_tab_page_subtitle()
|
||||
};
|
||||
|
||||
// Actions
|
||||
void Main::refresh()
|
||||
{
|
||||
mainTab->refresh(
|
||||
mainTab->get_current_page()
|
||||
);
|
||||
};
|
||||
|
||||
void Main::tab_append()
|
||||
{
|
||||
mainTab->append(
|
||||
@ -45,13 +52,6 @@ void Main::tab_append()
|
||||
);
|
||||
};
|
||||
|
||||
void Main::tab_update()
|
||||
{
|
||||
mainTab->update(
|
||||
mainTab->get_current_page()
|
||||
);
|
||||
};
|
||||
|
||||
void Main::tab_close()
|
||||
{
|
||||
mainTab->close(
|
||||
@ -74,6 +74,13 @@ void Main::tab_close_all()
|
||||
mainTab->close_all();
|
||||
};
|
||||
|
||||
void Main::tab_page_update()
|
||||
{
|
||||
mainTab->page_update(
|
||||
mainTab->get_current_page()
|
||||
);
|
||||
};
|
||||
|
||||
bool Main::tab_page_navigation_history_try_back()
|
||||
{
|
||||
const int & PAGE_NUMBER = mainTab->get_current_page();
|
||||
@ -102,11 +109,4 @@ bool Main::tab_page_navigation_history_try_forward()
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
void Main::refresh()
|
||||
{
|
||||
mainTab->refresh(
|
||||
mainTab->get_current_page()
|
||||
);
|
||||
};
|
@ -36,7 +36,7 @@ namespace app::browser
|
||||
void tab_close_right();
|
||||
void tab_close();
|
||||
|
||||
void tab_update();
|
||||
void tab_page_update();
|
||||
|
||||
bool tab_page_navigation_history_try_back();
|
||||
bool tab_page_navigation_history_try_forward();
|
||||
|
@ -124,21 +124,12 @@ void Tab::refresh(
|
||||
);
|
||||
}
|
||||
|
||||
void Tab::update(
|
||||
void Tab::page_update(
|
||||
const int & PAGE_NUMBER
|
||||
) {
|
||||
auto pageWidget = get_nth_page(
|
||||
get_tabPage(
|
||||
PAGE_NUMBER
|
||||
);
|
||||
|
||||
if (pageWidget == nullptr)
|
||||
{
|
||||
throw _("Tab page not found!");
|
||||
}
|
||||
|
||||
pageWidget->activate_action(
|
||||
"page.update"
|
||||
);
|
||||
)->update();
|
||||
}
|
||||
|
||||
// Private helpers
|
||||
|
@ -40,6 +40,10 @@ namespace app::browser::main
|
||||
);
|
||||
|
||||
// Actions
|
||||
void refresh(
|
||||
const int & PAGE_NUMBER // @TODO
|
||||
);
|
||||
|
||||
void append(
|
||||
const Glib::ustring & TITLE,
|
||||
const Glib::ustring & REQUEST = "",
|
||||
@ -54,21 +58,17 @@ namespace app::browser::main
|
||||
void close_right();
|
||||
void close_all();
|
||||
|
||||
bool page_navigation_history_try_back(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
void page_update(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
|
||||
bool page_navigation_history_try_forward(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
bool page_navigation_history_try_back(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
|
||||
void refresh(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
|
||||
void update(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
bool page_navigation_history_try_forward(
|
||||
const int & PAGE_NUMBER
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -15,23 +15,6 @@ Page::Page(
|
||||
Gtk::Orientation::VERTICAL
|
||||
);
|
||||
|
||||
// Init actions group
|
||||
auto GioSimpleActionGroup = Gio::SimpleActionGroup::create();
|
||||
|
||||
// Define group actions
|
||||
GioSimpleActionGroup->add_action(
|
||||
"update",
|
||||
[this]
|
||||
{
|
||||
Page::update();
|
||||
}
|
||||
);
|
||||
|
||||
insert_action_group(
|
||||
"page",
|
||||
GioSimpleActionGroup
|
||||
);
|
||||
|
||||
// Init components
|
||||
pageNavigation = Gtk::make_managed<page::Navigation>(
|
||||
REQUEST
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <giomm/asyncresult.h>
|
||||
#include <giomm/inputstream.h>
|
||||
#include <giomm/outputstream.h>
|
||||
#include <giomm/simpleactiongroup.h>
|
||||
#include <giomm/socketclient.h>
|
||||
#include <giomm/socketconnection.h>
|
||||
#include <glibmm/i18n.h>
|
||||
|
@ -42,7 +42,7 @@ Request::Request(
|
||||
parse();
|
||||
|
||||
activate_action(
|
||||
"page.update"
|
||||
"win.main_tab_page_navigation_update"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
@ -5,7 +5,7 @@ using namespace app::browser::main::tab::page::navigation;
|
||||
Update::Update()
|
||||
{
|
||||
set_action_name(
|
||||
"page.update"
|
||||
"win.main_tab_page_navigation_update"
|
||||
);
|
||||
|
||||
set_icon_name(
|
||||
|
20
src/main.cpp
20
src/main.cpp
@ -27,16 +27,6 @@ int main(
|
||||
);
|
||||
|
||||
// Init accels @TODO db settings
|
||||
app->set_accel_for_action(
|
||||
"win.main_tab_append",
|
||||
"<Primary>t"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
"win.main_tab_page_update",
|
||||
"<Primary>r"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
"win.debug",
|
||||
"<Primary>i"
|
||||
@ -47,6 +37,16 @@ int main(
|
||||
"<Primary>q"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
"win.main_tab_append",
|
||||
"<Primary>t"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
"win.main_tab_page_navigation_update",
|
||||
"<Primary>r"
|
||||
);
|
||||
|
||||
// Launch browser component
|
||||
return app->make_window_and_run<app::Browser>(
|
||||
argc,
|
||||
|
Loading…
x
Reference in New Issue
Block a user