Browse Source

make children widgets managed

CPP-GTK4
yggverse 3 months ago
parent
commit
02b0b42b6b
  1. 10
      src/app/browser.cpp
  2. 3
      src/app/browser.hpp
  3. 13
      src/app/browser/header.cpp
  4. 3
      src/app/browser/header.hpp
  5. 10
      src/app/browser/header/main.cpp
  6. 3
      src/app/browser/header/main.hpp
  7. 7
      src/app/browser/main.cpp
  8. 2
      src/app/browser/main.hpp
  9. 13
      src/app/browser/main/tab/page.cpp
  10. 3
      src/app/browser/main/tab/page.hpp
  11. 19
      src/app/browser/main/tab/page/navbar.cpp
  12. 3
      src/app/browser/main/tab/page/navbar.hpp
  13. 10
      src/app/browser/main/tab/page/navbar/history.cpp
  14. 3
      src/app/browser/main/tab/page/navbar/history.hpp

10
src/app/browser.cpp

@ -19,14 +19,14 @@ Browser::Browser(
); );
// Init header widget // Init header widget
browserHeader = new browser::Header(); browserHeader = Gtk::make_managed<browser::Header>();
set_titlebar( set_titlebar(
* browserHeader * browserHeader
); );
// Init main widget // Init main widget
browserMain = new browser::Main(); browserMain = Gtk::make_managed<browser::Main>();
set_child( set_child(
* browserMain * browserMain
@ -127,10 +127,4 @@ Browser::Browser(
browserMain->tab_history_forward(); browserMain->tab_history_forward();
} }
); );
}
Browser::~Browser()
{
delete browserHeader;
delete browserMain;
} }

3
src/app/browser.hpp

@ -3,6 +3,7 @@
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <gtkmm/applicationwindow.h> #include <gtkmm/applicationwindow.h>
#include <gtkmm/object.h>
namespace lib namespace lib
{ {
@ -31,8 +32,6 @@ namespace app
//const Glib::RefPtr<Gtk::Application> & app, //const Glib::RefPtr<Gtk::Application> & app,
//const std::shared_ptr<lib::Database> & db //const std::shared_ptr<lib::Database> & db
); );
~Browser();
}; };
} }

13
src/app/browser/header.cpp

@ -13,34 +13,27 @@ Header::Header()
); );
// Init menu // Init menu
headerMenu = new header::Menu(); headerMenu = Gtk::make_managed<header::Menu>();
pack_start( pack_start(
* headerMenu * headerMenu
); );
// Init tab // Init tab
headerTab = new header::Tab(); headerTab = Gtk::make_managed<header::Tab>();
pack_start( pack_start(
* headerTab * headerTab
); );
// Init main widget // Init main widget
headerMain = new header::Main(); headerMain = Gtk::make_managed<header::Main>();
set_title_widget( set_title_widget(
* headerMain * headerMain
); );
} }
Header::~Header()
{
delete headerMain;
delete headerMenu;
delete headerTab;
}
void Header::set_title( void Header::set_title(
const Glib::ustring & VALUE const Glib::ustring & VALUE
) { ) {

3
src/app/browser/header.hpp

@ -3,6 +3,7 @@
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/headerbar.h> #include <gtkmm/headerbar.h>
#include <gtkmm/object.h>
namespace app::browser namespace app::browser
{ {
@ -27,8 +28,6 @@ namespace app::browser
Header(); Header();
~Header();
void set_title( void set_title(
const Glib::ustring & VALUE const Glib::ustring & VALUE
); );

10
src/app/browser/header/main.cpp

@ -16,25 +16,19 @@ Main::Main()
); );
// Init title // Init title
mainTitle = new main::Title(); mainTitle = Gtk::make_managed<main::Title>();
append( append(
* mainTitle * mainTitle
); );
mainSubtitle = new main::Subtitle(); mainSubtitle = Gtk::make_managed<main::Subtitle>();
append( append(
* mainSubtitle * mainSubtitle
); );
} }
Main::~Main()
{
delete mainTitle;
delete mainSubtitle;
}
void Main::set_title( void Main::set_title(
const Glib::ustring & VALUE const Glib::ustring & VALUE
) { ) {

3
src/app/browser/header/main.hpp

@ -3,6 +3,7 @@
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/object.h>
namespace app::browser::header namespace app::browser::header
{ {
@ -23,8 +24,6 @@ namespace app::browser::header
Main(); Main();
~Main();
void set_title( void set_title(
const Glib::ustring & VALUE const Glib::ustring & VALUE
); );

7
src/app/browser/main.cpp

@ -15,18 +15,13 @@ Main::Main()
); );
// Init tabs // Init tabs
mainTab = new main::Tab(); mainTab = Gtk::make_managed<main::Tab>();
append( append(
* mainTab * mainTab
); );
} }
Main::~Main()
{
delete mainTab;
}
// Getters // Getters
Glib::ustring Main::get_current_tab_page_title() Glib::ustring Main::get_current_tab_page_title()
{ {

2
src/app/browser/main.hpp

@ -4,6 +4,7 @@
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/object.h>
namespace app::browser namespace app::browser
{ {
@ -23,7 +24,6 @@ namespace app::browser
public: public:
Main(); Main();
~Main();
// Getters // Getters
Glib::ustring get_current_tab_page_title(); Glib::ustring get_current_tab_page_title();

13
src/app/browser/main/tab/page.cpp

@ -33,7 +33,7 @@ Page::Page(
); );
// Init components // Init components
pageNavbar = new page::Navbar( pageNavbar = Gtk::make_managed<page::Navbar>(
REQUEST REQUEST
); );
@ -41,13 +41,13 @@ Page::Page(
* pageNavbar * pageNavbar
); );
pageProgressbar = new page::Progressbar(); pageProgressbar = Gtk::make_managed<page::Progressbar>();
append( append(
* pageProgressbar * pageProgressbar
); );
pageContent = new page::Content(); pageContent = Gtk::make_managed<page::Content>();
append( append(
* pageContent * pageContent
@ -61,13 +61,6 @@ Page::Page(
); );
} }
Page::~Page()
{
delete pageNavbar;
delete pageContent;
delete pageProgressbar;
}
// Getters // Getters
Glib::ustring Page::get_title() Glib::ustring Page::get_title()
{ {

3
src/app/browser/main/tab/page.hpp

@ -13,6 +13,7 @@
#include <glibmm/stringutils.h> #include <glibmm/stringutils.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/object.h>
namespace app::browser::main::tab namespace app::browser::main::tab
{ {
@ -55,8 +56,6 @@ namespace app::browser::main::tab
const Glib::ustring & REQUEST = "" const Glib::ustring & REQUEST = ""
); );
~Page();
// Getters // Getters
Glib::ustring get_title(); Glib::ustring get_title();
Glib::ustring get_subtitle(); Glib::ustring get_subtitle();

19
src/app/browser/main/tab/page/navbar.cpp

@ -36,25 +36,25 @@ Navbar::Navbar(
); );
// Init components // Init components
navbarBase = new navbar::Base(); navbarBase = Gtk::make_managed<navbar::Base>();
append( append(
* navbarBase * navbarBase
); );
navbarHistory = new navbar::History(); navbarHistory = Gtk::make_managed<navbar::History>();
append( append(
* navbarHistory * navbarHistory
); );
navbarUpdate = new navbar::Update(); navbarUpdate = Gtk::make_managed<navbar::Update>();
append( append(
* navbarUpdate * navbarUpdate
); );
navbarRequest = new navbar::Request( navbarRequest = Gtk::make_managed<navbar::Request>(
REQUEST REQUEST
); );
@ -62,7 +62,7 @@ Navbar::Navbar(
* navbarRequest * navbarRequest
); );
navbarBookmark = new navbar::Bookmark(); navbarBookmark = Gtk::make_managed<navbar::Bookmark>();
append( append(
* navbarBookmark * navbarBookmark
@ -86,15 +86,6 @@ Navbar::Navbar(
); );
} }
Navbar::~Navbar()
{
delete navbarBase;
delete navbarBookmark;
delete navbarHistory;
delete navbarRequest;
delete navbarUpdate;
};
// Actions // Actions
void Navbar::back() void Navbar::back()
{ {

3
src/app/browser/main/tab/page/navbar.hpp

@ -4,6 +4,7 @@
#include <giomm/simpleactiongroup.h> #include <giomm/simpleactiongroup.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/object.h>
namespace app::browser::main::tab::page namespace app::browser::main::tab::page
{ {
@ -35,8 +36,6 @@ namespace app::browser::main::tab::page
const Glib::ustring & REQUEST const Glib::ustring & REQUEST
); );
~Navbar();
// Actions // Actions
void back(); void back();

10
src/app/browser/main/tab/page/navbar/history.cpp

@ -10,25 +10,19 @@ History::History()
"linked" // merge children elements "linked" // merge children elements
); );
historyBack = new history::Back(); historyBack = Gtk::make_managed<history::Back>();
append( append(
* historyBack * historyBack
); );
historyForward = new history::Forward(); historyForward = Gtk::make_managed<history::Forward>();
append( append(
* historyForward * historyForward
); );
} }
History::~History()
{
delete historyBack;
delete historyForward;
};
// Actions // Actions
void History::back() void History::back()
{ {

3
src/app/browser/main/tab/page/navbar/history.hpp

@ -5,6 +5,7 @@
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/object.h>
#include <vector> #include <vector>
namespace app::browser::main::tab::page::navbar namespace app::browser::main::tab::page::navbar
@ -36,8 +37,6 @@ namespace app::browser::main::tab::page::navbar
History(); History();
~History();
void back(); void back();
void forward(); void forward();

Loading…
Cancel
Save