From 7b8b3b860ce90186d46165e78f1344f82e91893d Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 5 Aug 2024 18:37:52 +0300 Subject: [PATCH] update header bar menu namespace --- Makefile | 2 +- src/app/browser/header/bar.cpp | 4 +-- src/app/browser/header/bar.h | 51 ++++++++++++++--------------- src/app/browser/header/bar/menu.cpp | 18 ++++++++++ src/app/browser/header/bar/menu.h | 25 ++++++++++++++ src/app/browser/menu.cpp | 21 ------------ src/app/browser/menu.h | 25 -------------- 7 files changed, 70 insertions(+), 76 deletions(-) create mode 100644 src/app/browser/header/bar/menu.cpp create mode 100644 src/app/browser/header/bar/menu.h delete mode 100644 src/app/browser/menu.cpp delete mode 100644 src/app/browser/menu.h diff --git a/Makefile b/Makefile index 84a8a973..c167d266 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ SRCS = src/main.cpp\ src/app/browser/header.cpp\ src/app/browser/header/bar.cpp\ src/app/browser/header/bar/title.cpp\ - src/app/browser/menu.cpp + src/app/browser/header/bar/menu.cpp OBJS = $(SRCS:.cpp=.o) diff --git a/src/app/browser/header/bar.cpp b/src/app/browser/header/bar.cpp index 58daa516..5fd32baf 100644 --- a/src/app/browser/header/bar.cpp +++ b/src/app/browser/header/bar.cpp @@ -20,8 +20,8 @@ namespace app ); // Init menu - this->menu = new Menu( - this->header->browser + this->menu = new bar::Menu( + this ); gtk_box_append( diff --git a/src/app/browser/header/bar.h b/src/app/browser/header/bar.h index be62fbde..dce12fcc 100644 --- a/src/app/browser/header/bar.h +++ b/src/app/browser/header/bar.h @@ -5,45 +5,42 @@ #include "../header.h" // Requirements -#include "../menu.h" +#include "bar/menu.h" #include "bar/title.h" -namespace app +namespace app::browser { - namespace browser + class Header; + + namespace header { - class Header; + namespace bar + { + class Menu; - class Menu; + class Title; + }; - namespace header + class Bar { - namespace bar - { - class Title; - }; - - class Bar - { - public: + public: - // GTK - GtkWidget *gtk; + // GTK + GtkWidget *gtk; - // Defaults - const gint SPACING = 0; + // Defaults + const gint SPACING = 0; - // Dependencies - Header *header; + // Dependencies + Header *header; - // Requirements - Menu *menu; - bar::Title *title; + // Requirements + bar::Menu *menu; + bar::Title *title; - Bar( - Header *header - ); - }; + Bar( + Header *header + ); }; }; }; diff --git a/src/app/browser/header/bar/menu.cpp b/src/app/browser/header/bar/menu.cpp new file mode 100644 index 00000000..198a4c59 --- /dev/null +++ b/src/app/browser/header/bar/menu.cpp @@ -0,0 +1,18 @@ +#include "menu.h" + +namespace app::browser::header::bar +{ + // Construct + Menu::Menu( + Bar *bar + ) { + // Init GTK + this->gtk = gtk_menu_button_new(); + + gtk_widget_show( + GTK_WIDGET( + this->gtk + ) + ); + } +} diff --git a/src/app/browser/header/bar/menu.h b/src/app/browser/header/bar/menu.h new file mode 100644 index 00000000..6d17caca --- /dev/null +++ b/src/app/browser/header/bar/menu.h @@ -0,0 +1,25 @@ +#ifndef APP_BROWSER_HEADER_BAR_MENU_H +#define APP_BROWSER_HEADER_BAR_MENU_H + +#include "../bar.h" + +namespace app::browser::header +{ + class Bar; + + namespace bar + { + class Menu + { + public: + + GtkWidget *gtk; + + Menu( + Bar *bar + ); + }; + }; +}; + +#endif \ No newline at end of file diff --git a/src/app/browser/menu.cpp b/src/app/browser/menu.cpp deleted file mode 100644 index ec101680..00000000 --- a/src/app/browser/menu.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "menu.h" - -namespace app -{ - namespace browser - { - // Construct - Menu::Menu( - Browser *browser - ) { - // Init GTK - this->gtk = gtk_menu_button_new(); - - gtk_widget_show( - GTK_WIDGET( - this->gtk - ) - ); - } - } -} diff --git a/src/app/browser/menu.h b/src/app/browser/menu.h deleted file mode 100644 index fff87f01..00000000 --- a/src/app/browser/menu.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef APP_BROWSER_MENU_H -#define APP_BROWSER_MENU_H - -#include "../browser.h" - -namespace app -{ - class Browser; - - namespace browser - { - class Menu - { - public: - - GtkWidget *gtk; - - Menu( - Browser *browser - ); - }; - }; -}; - -#endif \ No newline at end of file