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( @@ -19,14 +19,14 @@ Browser::Browser(
);
// Init header widget
browserHeader = new browser::Header();
browserHeader = Gtk::make_managed<browser::Header>();
set_titlebar(
* browserHeader
);
// Init main widget
browserMain = new browser::Main();
browserMain = Gtk::make_managed<browser::Main>();
set_child(
* browserMain
@ -128,9 +128,3 @@ Browser::Browser( @@ -128,9 +128,3 @@ Browser::Browser(
}
);
}
Browser::~Browser()
{
delete browserHeader;
delete browserMain;
}

3
src/app/browser.hpp

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

13
src/app/browser/header.cpp

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

3
src/app/browser/header.hpp

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

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

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

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

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

7
src/app/browser/main.cpp

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

2
src/app/browser/main.hpp

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save