update header menu namespace

This commit is contained in:
yggverse 2024-08-06 21:34:52 +03:00
parent 2fc4ac9541
commit 3fe3468696
13 changed files with 45 additions and 131 deletions

View File

@ -12,11 +12,10 @@ SRCS = src/main.cpp\
src/app/browser/container/tab.cpp\ src/app/browser/container/tab.cpp\
src/app/browser/header.cpp\ src/app/browser/header.cpp\
src/app/browser/header/tab.cpp\ src/app/browser/header/tab.cpp\
src/app/browser/header/bar.cpp\ src/app/browser/header/menu.cpp\
src/app/browser/header/bar/menu.cpp\ src/app/browser/header/menu/main.cpp\
src/app/browser/header/bar/menu/main.cpp\ src/app/browser/header/menu/main/debug.cpp\
src/app/browser/header/bar/menu/main/debug.cpp\ src/app/browser/header/menu/main/quit.cpp
src/app/browser/header/bar/menu/main/quit.cpp
OBJS = $(SRCS:.cpp=.o) OBJS = $(SRCS:.cpp=.o)

View File

@ -21,15 +21,19 @@ namespace app
Header::SHOW_TITLE_BUTTONS Header::SHOW_TITLE_BUTTONS
); );
// Init title widget // Init menu element
this->menu = new header::Menu(
this
);
gtk_header_bar_pack_start( gtk_header_bar_pack_start(
GTK_HEADER_BAR( GTK_HEADER_BAR(
this->gtk this->gtk
), ),
(new header::Bar(this))->gtk // @TODO this->menu->gtk
); );
// Init new tab button // Init new tab element
this->tab = new header::Tab( this->tab = new header::Tab(
this this
); );

View File

@ -5,7 +5,7 @@
#include "../browser.h" #include "../browser.h"
// Requirements // Requirements
#include "header/bar.h" #include "header/menu.h"
#include "header/tab.h" #include "header/tab.h"
namespace app namespace app
@ -16,7 +16,7 @@ namespace app
{ {
namespace header namespace header
{ {
class Bar; class Menu;
class Tab; class Tab;
} }
@ -34,7 +34,7 @@ namespace app
Browser *browser; Browser *browser;
// Requirements // Requirements
header::Bar *bar; header::Menu *menu;
header::Tab *tab; header::Tab *tab;
Header( Header(

View File

@ -1,45 +0,0 @@
#include "bar.h"
namespace app
{
namespace browser
{
namespace header
{
// Construct
Bar::Bar(
Header *header
) {
// Init dependencies
this->header = header;
// Init GTK
this->gtk = gtk_box_new(
GTK_ORIENTATION_HORIZONTAL,
Bar::SPACING
);
// Init menu
this->menu = new bar::Menu(
this
);
gtk_box_append(
GTK_BOX(
this->gtk
),
GTK_WIDGET(
this->menu->gtk
)
);
// Render
gtk_widget_show(
GTK_WIDGET(
this->gtk
)
);
}
}
}
}

View File

@ -1,44 +0,0 @@
#ifndef APP_BROWSER_HEADER_BAR_H
#define APP_BROWSER_HEADER_BAR_H
// Dependencies
#include "../header.h"
// Requirements
#include "bar/menu.h"
namespace app::browser
{
class Header;
namespace header
{
namespace bar
{
class Menu;
};
class Bar
{
public:
// GTK
GtkWidget *gtk;
// Defaults
const gint SPACING = 0;
// Dependencies
Header *header;
// Requirements
bar::Menu *menu;
Bar(
Header *header
);
};
};
};
#endif

View File

@ -1,13 +1,13 @@
#include "menu.h" #include "menu.h"
namespace app::browser::header::bar namespace app::browser::header
{ {
// Construct // Construct
Menu::Menu( Menu::Menu(
Bar *bar Header *header
) { ) {
// Init dependencies // Init dependencies
this->bar = bar; this->header = header;
// Init GTK // Init GTK
this->gtk = gtk_menu_button_new(); this->gtk = gtk_menu_button_new();

View File

@ -1,22 +1,22 @@
#ifndef APP_BROWSER_HEADER_BAR_MENU_H #ifndef APP_BROWSER_HEADER_MENU_H
#define APP_BROWSER_HEADER_BAR_MENU_H #define APP_BROWSER_HEADER_MENU_H
// Dependencies // Dependencies
#include "../bar.h" #include "../header.h"
// Requirements // Requirements
#include "menu/main.h" #include "menu/main.h"
namespace app::browser::header namespace app::browser
{ {
class Bar; class Header;
namespace bar namespace header
{ {
namespace menu namespace menu
{ {
class Main; class Main;
}; }
class Menu class Menu
{ {
@ -26,14 +26,14 @@ namespace app::browser::header
GtkWidget *gtk; GtkWidget *gtk;
// Dependencies // Dependencies
Bar *bar; Header *header;
// Requirements // Requirements
menu::Main *main; menu::Main *main;
// Constructor // Constructor
Menu( Menu(
Bar *bar Header *header
); );
}; };
}; };

View File

@ -1,6 +1,6 @@
#include "main.h" #include "main.h"
namespace app::browser::header::bar::menu namespace app::browser::header::menu
{ {
// Construct // Construct
Main::Main( Main::Main(

View File

@ -1,5 +1,5 @@
#ifndef APP_BROWSER_HEADER_BAR_MENU_MAIN_H #ifndef APP_BROWSER_HEADER_MENU_MAIN_H
#define APP_BROWSER_HEADER_BAR_MENU_MAIN_H #define APP_BROWSER_HEADER_MENU_MAIN_H
// Dependencies // Dependencies
#include "../menu.h" #include "../menu.h"
@ -8,7 +8,7 @@
#include "main/debug.h" #include "main/debug.h"
#include "main/quit.h" #include "main/quit.h"
namespace app::browser::header::bar namespace app::browser::header
{ {
class Menu; class Menu;

View File

@ -1,6 +1,6 @@
#include "debug.h" #include "debug.h"
namespace app::browser::header::bar::menu::main namespace app::browser::header::menu::main
{ {
// Construct // Construct
Debug::Debug( Debug::Debug(
@ -17,7 +17,7 @@ namespace app::browser::header::bar::menu::main
g_action_map_add_action( g_action_map_add_action(
G_ACTION_MAP( G_ACTION_MAP(
this->main->menu->bar->header->browser->app this->main->menu->header->browser->app
), ),
G_ACTION( G_ACTION(
this->action this->action
@ -46,7 +46,7 @@ namespace app::browser::header::bar::menu::main
gtk_application_set_accels_for_action( gtk_application_set_accels_for_action(
GTK_APPLICATION( GTK_APPLICATION(
this->main->menu->bar->header->browser->app this->main->menu->header->browser->app
), ),
action, action,
accels accels

View File

@ -1,9 +1,9 @@
#ifndef APP_BROWSER_HEADER_BAR_MENU_DEBUG_H #ifndef APP_BROWSER_HEADER_MENU_MAIN_DEBUG_H
#define APP_BROWSER_HEADER_BAR_MENU_DEBUG_H #define APP_BROWSER_HEADER_MENU_MAIN_DEBUG_H
#include "../main.h" #include "../main.h"
namespace app::browser::header::bar::menu namespace app::browser::header::menu
{ {
class Main; class Main;
@ -28,7 +28,7 @@ namespace app::browser::header::bar::menu
const gchar *ACCEL_2 = "<Control><Shift>I"; const gchar *ACCEL_2 = "<Control><Shift>I";
const gchar *ACTION_NS = "app.%s"; const gchar *ACTION_NS = "app.%s";
const gchar *ACTION_ID = "browser.header.bar.menu.main.debug.activate"; const gchar *ACTION_ID = "browser.header.menu.main.debug.activate";
// Construct // Construct
Debug( Debug(

View File

@ -1,6 +1,6 @@
#include "quit.h" #include "quit.h"
namespace app::browser::header::bar::menu::main namespace app::browser::header::menu::main
{ {
// Construct // Construct
Quit::Quit( Quit::Quit(
@ -17,7 +17,7 @@ namespace app::browser::header::bar::menu::main
g_action_map_add_action( g_action_map_add_action(
G_ACTION_MAP( G_ACTION_MAP(
this->main->menu->bar->header->browser->app this->main->menu->header->browser->app
), ),
G_ACTION( G_ACTION(
this->action this->action
@ -46,7 +46,7 @@ namespace app::browser::header::bar::menu::main
gtk_application_set_accels_for_action( gtk_application_set_accels_for_action(
GTK_APPLICATION( GTK_APPLICATION(
this->main->menu->bar->header->browser->app this->main->menu->header->browser->app
), ),
action, action,
accels accels
@ -68,7 +68,7 @@ namespace app::browser::header::bar::menu::main
Quit::_activate Quit::_activate
), ),
G_APPLICATION( G_APPLICATION(
this->main->menu->bar->header->browser->app this->main->menu->header->browser->app
) )
); );
} }

View File

@ -1,9 +1,9 @@
#ifndef APP_BROWSER_HEADER_BAR_MENU_QUIT_H #ifndef APP_BROWSER_HEADER_MENU_MAIN_QUIT_H
#define APP_BROWSER_HEADER_BAR_MENU_QUIT_H #define APP_BROWSER_HEADER_MENU_MAIN_QUIT_H
#include "../main.h" #include "../main.h"
namespace app::browser::header::bar::menu namespace app::browser::header::menu
{ {
class Main; class Main;
@ -28,7 +28,7 @@ namespace app::browser::header::bar::menu
const gchar *ACCEL_2 = "<Control>Q"; const gchar *ACCEL_2 = "<Control>Q";
const gchar *ACTION_NS = "app.%s"; const gchar *ACTION_NS = "app.%s";
const gchar *ACTION_ID = "browser.header.bar.menu.main.quit.activate"; const gchar *ACTION_ID = "browser.header.menu.main.quit.activate";
// Construct // Construct
Quit( Quit(