From d1a08ce8de7404b8b2e339fb608adb00d4725472 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 13 Aug 2024 09:54:11 +0300 Subject: [PATCH] init bookmark button class --- Makefile | 1 + po/POTFILES.in | 1 + src/app/browser/main/tab/data/navbar.cpp | 7 +++++++ src/app/browser/main/tab/data/navbar.hpp | 2 ++ .../browser/main/tab/data/navbar/bookmark.cpp | 20 +++++++++++++++++++ .../browser/main/tab/data/navbar/bookmark.hpp | 19 ++++++++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 src/app/browser/main/tab/data/navbar/bookmark.cpp create mode 100644 src/app/browser/main/tab/data/navbar/bookmark.hpp diff --git a/Makefile b/Makefile index d60ec6bc..05ccc02d 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/bookmark.cpp\ src/app/browser/main/tab/data/navbar/history.cpp\ src/app/browser/main/tab/data/navbar/history/back.cpp\ src/app/browser/main/tab/data/navbar/history/forward.cpp\ diff --git a/po/POTFILES.in b/po/POTFILES.in index a8fe3481..acf898f2 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/bookmark.cpp src/app/browser/main/tab/data/navbar/history.cpp src/app/browser/main/tab/data/navbar/history/back.cpp src/app/browser/main/tab/data/navbar/history/forward.cpp diff --git a/src/app/browser/main/tab/data/navbar.cpp b/src/app/browser/main/tab/data/navbar.cpp index 2b098c7f..876064e2 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/bookmark.hpp" #include "navbar/history.hpp" #include "navbar/update.hpp" @@ -50,6 +51,12 @@ Navbar::Navbar() append( * update ); + + bookmark = new navbar::Bookmark(); + + append( + * bookmark + ); } Navbar::~Navbar() = default; diff --git a/src/app/browser/main/tab/data/navbar.hpp b/src/app/browser/main/tab/data/navbar.hpp index 2c9dac79..e98b83c7 100644 --- a/src/app/browser/main/tab/data/navbar.hpp +++ b/src/app/browser/main/tab/data/navbar.hpp @@ -8,6 +8,7 @@ namespace app::browser::main::tab::data namespace navbar { class Base; + class Bookmark; class History; class Update; } @@ -22,6 +23,7 @@ namespace app::browser::main::tab::data // Components navbar::Base * base; + navbar::Bookmark * bookmark; navbar::History * history; navbar::Update * update; diff --git a/src/app/browser/main/tab/data/navbar/bookmark.cpp b/src/app/browser/main/tab/data/navbar/bookmark.cpp new file mode 100644 index 00000000..f3be49f5 --- /dev/null +++ b/src/app/browser/main/tab/data/navbar/bookmark.cpp @@ -0,0 +1,20 @@ +#include "bookmark.hpp" + +using namespace app::browser::main::tab::data::navbar; + +Bookmark::Bookmark() +{ + set_action_name( + "tab.bookmark" + ); + + set_icon_name( + "starred-symbolic" // | non-starred-symbolic + ); + + set_tooltip_text( + _("Toggle bookmark") + ); +} + +Bookmark::~Bookmark() = default; diff --git a/src/app/browser/main/tab/data/navbar/bookmark.hpp b/src/app/browser/main/tab/data/navbar/bookmark.hpp new file mode 100644 index 00000000..60e533ed --- /dev/null +++ b/src/app/browser/main/tab/data/navbar/bookmark.hpp @@ -0,0 +1,19 @@ +#ifndef APP_BROWSER_MAIN_TAB_DATA_NAVBAR_BOOKMARK_HPP +#define APP_BROWSER_MAIN_TAB_DATA_NAVBAR_BOOKMARK_HPP + +#include +#include + +namespace app::browser::main::tab::data::navbar +{ + class Bookmark : public Gtk::Button + { + public: + + Bookmark(); + + ~Bookmark(); + }; +} + +#endif // APP_BROWSER_MAIN_TAB_DATA_NAVBAR_BOOKMARK_HPP \ No newline at end of file