From fb54cc4431759afe74cb4ea41a7b745f10e8e9bd Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 13 Aug 2024 09:05:59 +0300 Subject: [PATCH] init update navigation button --- Makefile | 1 + po/POTFILES.in | 1 + src/app/browser/main/tab/data.cpp | 4 --- src/app/browser/main/tab/data/navbar.cpp | 33 ++++++++++++++++--- src/app/browser/main/tab/data/navbar.hpp | 7 ++++ .../browser/main/tab/data/navbar/update.cpp | 20 +++++++++++ .../browser/main/tab/data/navbar/update.hpp | 19 +++++++++++ 7 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 src/app/browser/main/tab/data/navbar/update.cpp create mode 100644 src/app/browser/main/tab/data/navbar/update.hpp diff --git a/Makefile b/Makefile index 32a4456a..ae64695a 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ SRCS = src/main.cpp\ src/app/browser/main/tab/data.cpp\ src/app/browser/main/tab/data/navbar.cpp\ src/app/browser/main/tab/data/navbar/base.cpp\ + src/app/browser/main/tab/data/navbar/update.cpp\ src/app/browser/main/tab/label.cpp\ src/lib/database.cpp\ src/lib/database/session.cpp diff --git a/po/POTFILES.in b/po/POTFILES.in index 2ca258e4..6d6b96bc 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -7,6 +7,7 @@ src/app/browser/main/tab.cpp src/app/browser/main/tab/data.cpp src/app/browser/main/tab/data/navbar.cpp src/app/browser/main/tab/data/navbar/base.cpp +src/app/browser/main/tab/data/navbar/update.cpp src/app/browser/main/tab/label.cpp src/lib/database.cpp src/lib/database/session.cpp diff --git a/src/app/browser/main/tab/data.cpp b/src/app/browser/main/tab/data.cpp index 7893dd2e..92dd6c25 100644 --- a/src/app/browser/main/tab/data.cpp +++ b/src/app/browser/main/tab/data.cpp @@ -10,10 +10,6 @@ Data::Data() Gtk::Orientation::VERTICAL ); - set_homogeneous( - true - ); - // Init elements navbar = new data::Navbar(); diff --git a/src/app/browser/main/tab/data/navbar.cpp b/src/app/browser/main/tab/data/navbar.cpp index d57cf51e..946cbdea 100644 --- a/src/app/browser/main/tab/data/navbar.cpp +++ b/src/app/browser/main/tab/data/navbar.cpp @@ -1,5 +1,6 @@ #include "navbar.hpp" #include "navbar/base.hpp" +#include "navbar/update.hpp" using namespace app::browser::main::tab::data; @@ -10,16 +11,38 @@ Navbar::Navbar() Gtk::Orientation::HORIZONTAL ); - set_homogeneous( - true + set_spacing( + SPACING + ); + + set_margin_top( + MARGIN + ); + + set_margin_start( + MARGIN + ); + + set_margin_end( + MARGIN + ); + + set_margin_bottom( + MARGIN ); // Init elements base = new navbar::Base(); - append( - * base - ); + append( + * base + ); + + update = new navbar::Update(); + + append( + * update + ); } Navbar::~Navbar() = default; diff --git a/src/app/browser/main/tab/data/navbar.hpp b/src/app/browser/main/tab/data/navbar.hpp index 009bbb94..bc074eb3 100644 --- a/src/app/browser/main/tab/data/navbar.hpp +++ b/src/app/browser/main/tab/data/navbar.hpp @@ -8,13 +8,20 @@ namespace app::browser::main::tab::data namespace navbar { class Base; + class Update; } class Navbar : public Gtk::Box { private: + // Defaults + const int SPACING = 8; + const int MARGIN = 8; + + // Components navbar::Base * base; + navbar::Update * update; public: diff --git a/src/app/browser/main/tab/data/navbar/update.cpp b/src/app/browser/main/tab/data/navbar/update.cpp new file mode 100644 index 00000000..3e3849a7 --- /dev/null +++ b/src/app/browser/main/tab/data/navbar/update.cpp @@ -0,0 +1,20 @@ +#include "update.hpp" + +using namespace app::browser::main::tab::data::navbar; + +Update::Update() +{ + set_action_name( + "tab.update" + ); + + set_icon_name( + "view-refresh-symbolic" + ); + + set_tooltip_text( + _("Update") + ); +} + +Update::~Update() = default; diff --git a/src/app/browser/main/tab/data/navbar/update.hpp b/src/app/browser/main/tab/data/navbar/update.hpp new file mode 100644 index 00000000..9aaf740c --- /dev/null +++ b/src/app/browser/main/tab/data/navbar/update.hpp @@ -0,0 +1,19 @@ +#ifndef APP_BROWSER_MAIN_TAB_DATA_NAVBAR_UPDATE_HPP +#define APP_BROWSER_MAIN_TAB_DATA_NAVBAR_UPDATE_HPP + +#include +#include + +namespace app::browser::main::tab::data::navbar +{ + class Update : public Gtk::Button + { + public: + + Update(); + + ~Update(); + }; +} + +#endif // APP_BROWSER_MAIN_TAB_DATA_NAVBAR_UPDATE_HPP \ No newline at end of file