mirror of https://github.com/YGGverse/Yoda.git
yggverse
4 months ago
28 changed files with 365 additions and 365 deletions
@ -1,182 +0,0 @@
@@ -1,182 +0,0 @@
|
||||
#include "navbar.hpp" |
||||
#include "navbar/base.hpp" |
||||
#include "navbar/bookmark.hpp" |
||||
#include "navbar/history.hpp" |
||||
#include "navbar/request.hpp" |
||||
#include "navbar/update.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page; |
||||
|
||||
Navbar::Navbar( |
||||
const Glib::ustring & REQUEST |
||||
) { |
||||
// Init container
|
||||
set_orientation( |
||||
Gtk::Orientation::HORIZONTAL |
||||
); |
||||
|
||||
set_spacing( |
||||
SPACING |
||||
); |
||||
|
||||
set_margin_top( |
||||
MARGIN |
||||
); |
||||
|
||||
set_margin_start( |
||||
MARGIN |
||||
); |
||||
|
||||
set_margin_end( |
||||
MARGIN |
||||
); |
||||
|
||||
set_margin_bottom( |
||||
MARGIN |
||||
); |
||||
|
||||
// Init components
|
||||
navbarBase = Gtk::make_managed<navbar::Base>(); |
||||
|
||||
append( |
||||
* navbarBase |
||||
); |
||||
|
||||
navbarHistory = Gtk::make_managed<navbar::History>(); |
||||
|
||||
append( |
||||
* navbarHistory |
||||
); |
||||
|
||||
navbarUpdate = Gtk::make_managed<navbar::Update>(); |
||||
|
||||
append( |
||||
* navbarUpdate |
||||
); |
||||
|
||||
navbarRequest = Gtk::make_managed<navbar::Request>( |
||||
REQUEST |
||||
); |
||||
|
||||
append( |
||||
* navbarRequest |
||||
); |
||||
|
||||
navbarBookmark = Gtk::make_managed<navbar::Bookmark>(); |
||||
|
||||
append( |
||||
* navbarBookmark |
||||
); |
||||
|
||||
// Init actions group
|
||||
auto GioSimpleActionGroup = Gio::SimpleActionGroup::create(); |
||||
|
||||
// Define group actions
|
||||
GioSimpleActionGroup->add_action( |
||||
"refresh", |
||||
[this] |
||||
{ |
||||
refresh(); |
||||
} |
||||
); |
||||
|
||||
insert_action_group( |
||||
"navbar", |
||||
GioSimpleActionGroup |
||||
); |
||||
} |
||||
|
||||
// Actions
|
||||
void Navbar::history_back() |
||||
{ |
||||
navbar::History::Memory match; |
||||
|
||||
if (navbarHistory->try_back(match)) |
||||
{ |
||||
navbarRequest->set_text( |
||||
match.request |
||||
); |
||||
|
||||
navbarUpdate->activate(); |
||||
} |
||||
} |
||||
|
||||
void Navbar::history_forward() |
||||
{ |
||||
navbar::History::Memory match; |
||||
|
||||
if (navbarHistory->try_forward(match)) |
||||
{ |
||||
navbarRequest->set_text( |
||||
match.request |
||||
); |
||||
|
||||
navbarUpdate->activate(); |
||||
} |
||||
} |
||||
|
||||
void Navbar::history_add( |
||||
const Glib::ustring & VALUE |
||||
) { |
||||
navbarHistory->add( |
||||
VALUE |
||||
); |
||||
} |
||||
|
||||
void Navbar::refresh() |
||||
{ |
||||
// Toggle base button sensibility
|
||||
navbarBase->set_sensitive( |
||||
!navbarRequest->get_host().empty() && !navbarRequest->get_path().empty() |
||||
); |
||||
|
||||
// Toggle update button sensibility
|
||||
navbarUpdate->set_sensitive( |
||||
navbarRequest->get_text_length() > 0 |
||||
); |
||||
|
||||
// Refresh history widget
|
||||
navbarHistory->refresh(); |
||||
} |
||||
|
||||
// Setters @TODO is really wanted?
|
||||
void Navbar::set_request_text( |
||||
const Glib::ustring & VALUE |
||||
) { |
||||
navbarRequest->set_text( |
||||
VALUE |
||||
); |
||||
|
||||
// refresh(); not wanted as on change listener do same @TODO
|
||||
} |
||||
|
||||
// Getters @TODO &
|
||||
Glib::ustring Navbar::get_request_text() |
||||
{ |
||||
return navbarRequest->get_text(); |
||||
} |
||||
|
||||
Glib::ustring Navbar::get_request_scheme() |
||||
{ |
||||
return navbarRequest->get_scheme(); |
||||
} |
||||
|
||||
Glib::ustring Navbar::get_request_host() |
||||
{ |
||||
return navbarRequest->get_host(); |
||||
} |
||||
|
||||
Glib::ustring Navbar::get_request_path() |
||||
{ |
||||
return navbarRequest->get_path(); |
||||
} |
||||
|
||||
Glib::ustring Navbar::get_request_query() |
||||
{ |
||||
return navbarRequest->get_query(); |
||||
} |
||||
|
||||
Glib::ustring Navbar::get_request_port() |
||||
{ |
||||
return navbarRequest->get_port(); |
||||
} |
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BASE_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BASE_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navbar |
||||
{ |
||||
class Base : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Base(); |
||||
|
||||
~Base(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BASE_HPP
|
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BOOKMARK_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BOOKMARK_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navbar |
||||
{ |
||||
class Bookmark : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Bookmark(); |
||||
|
||||
~Bookmark(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BOOKMARK_HPP
|
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_BACK_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_BACK_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navbar::history |
||||
{ |
||||
class Back : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Back(); |
||||
|
||||
~Back(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_BACK_HPP
|
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_FORWARD_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_FORWARD_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navbar::history |
||||
{ |
||||
class Forward : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Forward(); |
||||
|
||||
~Forward(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_FORWARD_HPP
|
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_UPDATE_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_UPDATE_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navbar |
||||
{ |
||||
class Update : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Update(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_UPDATE_HPP
|
@ -0,0 +1,182 @@
@@ -0,0 +1,182 @@
|
||||
#include "navigation.hpp" |
||||
#include "navigation/base.hpp" |
||||
#include "navigation/bookmark.hpp" |
||||
#include "navigation/history.hpp" |
||||
#include "navigation/request.hpp" |
||||
#include "navigation/update.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page; |
||||
|
||||
Navigation::Navigation( |
||||
const Glib::ustring & REQUEST |
||||
) { |
||||
// Init container
|
||||
set_orientation( |
||||
Gtk::Orientation::HORIZONTAL |
||||
); |
||||
|
||||
set_spacing( |
||||
SPACING |
||||
); |
||||
|
||||
set_margin_top( |
||||
MARGIN |
||||
); |
||||
|
||||
set_margin_start( |
||||
MARGIN |
||||
); |
||||
|
||||
set_margin_end( |
||||
MARGIN |
||||
); |
||||
|
||||
set_margin_bottom( |
||||
MARGIN |
||||
); |
||||
|
||||
// Init components
|
||||
navigationBase = Gtk::make_managed<navigation::Base>(); |
||||
|
||||
append( |
||||
* navigationBase |
||||
); |
||||
|
||||
navigationHistory = Gtk::make_managed<navigation::History>(); |
||||
|
||||
append( |
||||
* navigationHistory |
||||
); |
||||
|
||||
navigationUpdate = Gtk::make_managed<navigation::Update>(); |
||||
|
||||
append( |
||||
* navigationUpdate |
||||
); |
||||
|
||||
navigationRequest = Gtk::make_managed<navigation::Request>( |
||||
REQUEST |
||||
); |
||||
|
||||
append( |
||||
* navigationRequest |
||||
); |
||||
|
||||
navigationBookmark = Gtk::make_managed<navigation::Bookmark>(); |
||||
|
||||
append( |
||||
* navigationBookmark |
||||
); |
||||
|
||||
// Init actions group
|
||||
auto GioSimpleActionGroup = Gio::SimpleActionGroup::create(); |
||||
|
||||
// Define group actions
|
||||
GioSimpleActionGroup->add_action( |
||||
"refresh", |
||||
[this] |
||||
{ |
||||
refresh(); |
||||
} |
||||
); |
||||
|
||||
insert_action_group( |
||||
"navigation", |
||||
GioSimpleActionGroup |
||||
); |
||||
} |
||||
|
||||
// Actions
|
||||
void Navigation::history_back() |
||||
{ |
||||
navigation::History::Memory match; |
||||
|
||||
if (navigationHistory->try_back(match)) |
||||
{ |
||||
navigationRequest->set_text( |
||||
match.request |
||||
); |
||||
|
||||
navigationUpdate->activate(); |
||||
} |
||||
} |
||||
|
||||
void Navigation::history_forward() |
||||
{ |
||||
navigation::History::Memory match; |
||||
|
||||
if (navigationHistory->try_forward(match)) |
||||
{ |
||||
navigationRequest->set_text( |
||||
match.request |
||||
); |
||||
|
||||
navigationUpdate->activate(); |
||||
} |
||||
} |
||||
|
||||
void Navigation::history_add( |
||||
const Glib::ustring & VALUE |
||||
) { |
||||
navigationHistory->add( |
||||
VALUE |
||||
); |
||||
} |
||||
|
||||
void Navigation::refresh() |
||||
{ |
||||
// Toggle base button sensibility
|
||||
navigationBase->set_sensitive( |
||||
!navigationRequest->get_host().empty() && !navigationRequest->get_path().empty() |
||||
); |
||||
|
||||
// Toggle update button sensibility
|
||||
navigationUpdate->set_sensitive( |
||||
navigationRequest->get_text_length() > 0 |
||||
); |
||||
|
||||
// Refresh history widget
|
||||
navigationHistory->refresh(); |
||||
} |
||||
|
||||
// Setters @TODO is really wanted?
|
||||
void Navigation::set_request_text( |
||||
const Glib::ustring & VALUE |
||||
) { |
||||
navigationRequest->set_text( |
||||
VALUE |
||||
); |
||||
|
||||
// refresh(); not wanted as on change listener do same @TODO
|
||||
} |
||||
|
||||
// Getters @TODO &
|
||||
Glib::ustring Navigation::get_request_text() |
||||
{ |
||||
return navigationRequest->get_text(); |
||||
} |
||||
|
||||
Glib::ustring Navigation::get_request_scheme() |
||||
{ |
||||
return navigationRequest->get_scheme(); |
||||
} |
||||
|
||||
Glib::ustring Navigation::get_request_host() |
||||
{ |
||||
return navigationRequest->get_host(); |
||||
} |
||||
|
||||
Glib::ustring Navigation::get_request_path() |
||||
{ |
||||
return navigationRequest->get_path(); |
||||
} |
||||
|
||||
Glib::ustring Navigation::get_request_query() |
||||
{ |
||||
return navigationRequest->get_query(); |
||||
} |
||||
|
||||
Glib::ustring Navigation::get_request_port() |
||||
{ |
||||
return navigationRequest->get_port(); |
||||
} |
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
#include "base.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page::navbar; |
||||
using namespace app::browser::main::tab::page::navigation; |
||||
|
||||
Base::Base() |
||||
{ |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_BASE_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_BASE_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navigation |
||||
{ |
||||
class Base : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Base(); |
||||
|
||||
~Base(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_BASE_HPP
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
#include "bookmark.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page::navbar; |
||||
using namespace app::browser::main::tab::page::navigation; |
||||
|
||||
Bookmark::Bookmark() |
||||
{ |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_BOOKMARK_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_BOOKMARK_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navigation |
||||
{ |
||||
class Bookmark : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Bookmark(); |
||||
|
||||
~Bookmark(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_BOOKMARK_HPP
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
#include "back.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page::navbar::history; |
||||
using namespace app::browser::main::tab::page::navigation::history; |
||||
|
||||
Back::Back() |
||||
{ |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navigation::history |
||||
{ |
||||
class Back : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Back(); |
||||
|
||||
~Back(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK_HPP
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
#include "forward.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page::navbar::history; |
||||
using namespace app::browser::main::tab::page::navigation::history; |
||||
|
||||
Forward::Forward() |
||||
{ |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navigation::history |
||||
{ |
||||
class Forward : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Forward(); |
||||
|
||||
~Forward(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD_HPP
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
#include "update.hpp" |
||||
|
||||
using namespace app::browser::main::tab::page::navbar; |
||||
using namespace app::browser::main::tab::page::navigation; |
||||
|
||||
Update::Update() |
||||
{ |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_UPDATE_HPP |
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_UPDATE_HPP |
||||
|
||||
#include <glibmm/i18n.h> |
||||
#include <gtkmm/button.h> |
||||
|
||||
namespace app::browser::main::tab::page::navigation |
||||
{ |
||||
class Update : public Gtk::Button |
||||
{ |
||||
public: |
||||
|
||||
Update(); |
||||
}; |
||||
} |
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_UPDATE_HPP
|
Loading…
Reference in new issue