Browse Source

drop sigc dependency

CPP-GTK4
yggverse 4 months ago
parent
commit
626997af14
  1. 100
      src/app/browser.cpp
  2. 10
      src/app/browser.hpp
  3. 11
      src/app/browser/main/tab.cpp
  4. 1
      src/app/browser/main/tab.hpp
  5. 10
      src/app/browser/main/tab/label.cpp
  6. 1
      src/app/browser/main/tab/label.hpp
  7. 8
      src/app/browser/main/tab/page/navbar.cpp
  8. 1
      src/app/browser/main/tab/page/navbar.hpp
  9. 8
      src/main.cpp

100
src/app/browser.cpp

@ -35,108 +35,68 @@ Browser::Browser(
// Init actions // Init actions
add_action( add_action(
"tab_append", "tab_append",
sigc::mem_fun( [this]
* this, {
& Browser::main_tab_append main->tab_append();
) }
); );
add_action( add_action(
"tab_update", "tab_update",
sigc::mem_fun( [this]
*this, {
&Browser::main_tab_update main->tab_update();
) }
); );
// Close // Close
add_action( add_action(
"tab_close", "tab_close",
sigc::mem_fun( [this]
* this, {
& Browser::main_tab_close main->tab_close();
) }
); );
// Close submenu // Close submenu
add_action( add_action(
"tab_close_left", "tab_close_left",
sigc::mem_fun( [this]
* this, {
& Browser::main_tab_close_left main->tab_close_left();
) }
); );
add_action( add_action(
"tab_close_right", "tab_close_right",
sigc::mem_fun( [this]
* this, {
& Browser::main_tab_close_right main->tab_close_right();
) }
); );
add_action( add_action(
"tab_close_all", "tab_close_all",
sigc::mem_fun( [this]
* this, {
& Browser::main_tab_close_all main->tab_close_all();
) }
); );
// Tool // Tool
add_action( add_action(
"debug", "debug",
sigc::mem_fun( [this]
* this, {
& Browser::debug gtk_window_set_interactive_debugging(
) true
);
}
); );
} }
Browser::~Browser() Browser::~Browser()
{ {
destroy();
delete header; delete header;
header = nullptr;
delete main; delete main;
main = nullptr;
} }
void Browser::main_tab_append()
{
main->tab_append();
};
void Browser::main_tab_update()
{
main->tab_update();
};
void Browser::main_tab_close()
{
main->tab_close();
};
void Browser::main_tab_close_left()
{
main->tab_close_left();
};
void Browser::main_tab_close_right()
{
main->tab_close_right();
};
void Browser::main_tab_close_all()
{
main->tab_close_all();
};
void Browser::debug()
{
gtk_window_set_interactive_debugging(
true
);
};

10
src/app/browser.hpp

@ -32,16 +32,6 @@ namespace app
); );
~Browser(); ~Browser();
void main_tab_append();
void main_tab_update();
void main_tab_close();
void main_tab_close_left();
void main_tab_close_right();
void main_tab_close_all();
void debug();
}; };
} }

11
src/app/browser/main/tab.cpp

@ -13,10 +13,13 @@ Tab::Tab()
// Init events // Init events
signal_switch_page().connect( signal_switch_page().connect(
sigc::mem_fun( [this](Gtk::Widget * page, guint page_num)
* this, {
& Tab::on_switch on_switch(
) page,
page_num
);
}
); );
} }

1
src/app/browser/main/tab.hpp

@ -4,7 +4,6 @@
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <gtkmm/widget.h> #include <gtkmm/widget.h>
#include <gtkmm/notebook.h> #include <gtkmm/notebook.h>
#include <sigc++/functors/mem_fun.h>
namespace app::browser::main namespace app::browser::main
{ {

10
src/app/browser/main/tab/label.cpp

@ -17,10 +17,12 @@ Label::Label()
);*/ );*/
controller->signal_pressed().connect( controller->signal_pressed().connect(
sigc::mem_fun( [this](int n, double x, double y)
* this, {
& Label::on_click on_click(
) n, x, y
);
}
); );
add_controller( add_controller(

1
src/app/browser/main/tab/label.hpp

@ -5,7 +5,6 @@
#include <glibmm/refptr.h> #include <glibmm/refptr.h>
#include <gtkmm/gestureclick.h> #include <gtkmm/gestureclick.h>
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <sigc++/functors/mem_fun.h>
namespace app::browser::main::tab namespace app::browser::main::tab
{ {

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

@ -71,10 +71,10 @@ Navbar::Navbar()
// Define group actions // Define group actions
action_group->add_action( action_group->add_action(
"refresh", "refresh",
sigc::mem_fun( [this]
* this, {
& Navbar::refresh refresh();
) }
); );
insert_action_group( insert_action_group(

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

@ -5,7 +5,6 @@
#include <glibmm/refptr.h> #include <glibmm/refptr.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <sigc++/functors/mem_fun.h>
#include <string> #include <string>
namespace app::browser::main::tab::page namespace app::browser::main::tab::page

8
src/main.cpp

@ -20,10 +20,10 @@ int main(
app->add_action( app->add_action(
"quit", "quit",
sigc::mem_fun( [app]
* app, {
& Gtk::Application::quit app->quit();
) }
); );
// Init accels @TODO db settings // Init accels @TODO db settings

Loading…
Cancel
Save