2024-08-10 17:57:15 +03:00
|
|
|
#include "browser.hpp"
|
|
|
|
#include "browser/header.hpp"
|
2024-08-11 22:04:34 +03:00
|
|
|
#include "browser/main.hpp"
|
2024-08-05 03:15:41 +03:00
|
|
|
|
2024-08-08 12:44:27 +03:00
|
|
|
using namespace app;
|
2024-08-05 03:15:41 +03:00
|
|
|
|
2024-08-11 09:55:10 +03:00
|
|
|
Browser::Browser(
|
2024-08-11 14:52:09 +03:00
|
|
|
const Glib::RefPtr<Gtk::Application> & app,
|
|
|
|
const lib::Database & db
|
2024-08-11 09:55:10 +03:00
|
|
|
) {
|
2024-08-11 22:04:34 +03:00
|
|
|
// Init window
|
2024-08-08 12:44:27 +03:00
|
|
|
set_title(
|
|
|
|
TITLE
|
|
|
|
);
|
|
|
|
|
|
|
|
set_default_size(
|
|
|
|
WIDTH,
|
|
|
|
HEIGHT
|
|
|
|
);
|
2024-08-08 15:19:04 +03:00
|
|
|
|
2024-08-11 22:04:34 +03:00
|
|
|
// Init header widget
|
|
|
|
header = new browser::Header();
|
|
|
|
|
2024-08-08 15:19:04 +03:00
|
|
|
set_titlebar(
|
2024-08-11 22:04:34 +03:00
|
|
|
* header
|
|
|
|
);
|
|
|
|
|
|
|
|
// Init main widget
|
|
|
|
main = new browser::Main();
|
|
|
|
|
|
|
|
set_child(
|
|
|
|
* main
|
|
|
|
);
|
|
|
|
|
|
|
|
// Init actions
|
|
|
|
add_action(
|
|
|
|
"tab",
|
|
|
|
sigc::mem_fun(
|
|
|
|
* this,
|
|
|
|
& Browser::mainTabAppend
|
|
|
|
)
|
2024-08-08 13:33:23 +03:00
|
|
|
);
|
2024-08-11 09:55:10 +03:00
|
|
|
|
|
|
|
add_action(
|
|
|
|
"debug",
|
|
|
|
sigc::mem_fun(
|
|
|
|
* this,
|
|
|
|
& Browser::debug
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-08-11 22:04:34 +03:00
|
|
|
// Init
|
|
|
|
app->set_accel_for_action(
|
|
|
|
"win.tab",
|
|
|
|
"<Primary>t"
|
|
|
|
);
|
|
|
|
|
2024-08-11 09:55:10 +03:00
|
|
|
app->set_accel_for_action(
|
|
|
|
"win.debug",
|
|
|
|
"<Primary>i"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-08-11 22:04:34 +03:00
|
|
|
void Browser::mainTabAppend()
|
|
|
|
{
|
|
|
|
main->tabAppend();
|
|
|
|
};
|
|
|
|
|
2024-08-11 09:55:10 +03:00
|
|
|
void Browser::debug()
|
|
|
|
{
|
|
|
|
gtk_window_set_interactive_debugging(
|
|
|
|
true
|
|
|
|
);
|
|
|
|
};
|