roundabout,
created on Thursday, 26 June 2025, 11:15:15 (1750936515),
received on Thursday, 26 June 2025, 11:15:17 (1750936517)
Author identity: vlad <vlad.muntoiu@gmail.com>
0d4eeb196bbaa681c0296716e7feca6bede2aaae
CMakeLists.txt
@@ -4,6 +4,7 @@ project(gpanthera)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")
add_library(gpanthera SHARED gpanthera.cc)
add_library(test_plugin SHARED test_plugin.cc)
panthera-www.cc
@@ -15,7 +15,7 @@
#include <sstream>
#include <dlfcn.h>
#include "external/sqlite_orm/sqlite_orm.h"
#include "plugin_api.h"
//#include "plugin_api.h"
#define _(STRING) gettext(STRING)
using plugin_entrypoint_type = void(*)(void);
@@ -278,7 +278,7 @@ private:
std::shared_ptr<gPanthera::ContentManager> content_manager;
std::string cookie_file;
std::vector<SearchEngine> search_engines;
SearchEngine* default_search_engine;
SearchEngine *default_search_engine;
std::shared_ptr<HistoryManager> history_manager;
Glib::RefPtr<Gio::Menu> main_menu;
std::string new_tab_page;
@@ -298,6 +298,7 @@ protected:
public:
PantheraWww();
~PantheraWww();
friend class PantheraWindow;
void on_new_tab(gPanthera::ContentStack* stack, const Glib::ustring& url = "", bool focus = true, bool new_window = false);
void set_search_engines_from_json(const std::string& json_string);
@@ -547,6 +548,7 @@ public:
});
set_show_menubar(true);
}
~PantheraWindow() override = default;
};
void PantheraWww::load_change_callback(WebKitWebView *object, WebKitLoadEvent load_event, gpointer data) {
@@ -700,7 +702,6 @@ void PantheraWww::on_new_tab(gPanthera::ContentStack *stack, const Glib::ustring
PantheraWindow *PantheraWww::make_window() {
Glib::RefPtr<Gtk::Application> self_ref = Glib::make_refptr_for_instance<Gtk::Application>(this);
auto window = Gtk::make_managed<PantheraWindow>(self_ref);
add_window(*window);
return window;
}
@@ -748,7 +749,7 @@ void PantheraWww::on_startup() {
auto json = nlohmann::json::parse(plugin_json);
for(auto &plugin : json) {
auto plugin_path = plugin["path"].get<std::string>();
load_plugin(plugin_path);
//load_plugin(plugin_path);
}
} else {
plugin_file_in.close();
@@ -836,6 +837,7 @@ Glib::RefPtr<PantheraWww> PantheraWww::create() {
}
void PantheraWww::load_plugin(const std::string &plugin_path) {
// TODO: needs to be reworked, to work with multi-window
void *handle = dlopen(plugin_path.c_str(), RTLD_LAZY | RTLD_GLOBAL);
if(!handle) {
std::cerr << "Failed to load plugin: " << dlerror() << std::endl;
@@ -850,8 +852,9 @@ void PantheraWww::load_plugin(const std::string &plugin_path) {
entrypoint();
}
Glib::RefPtr<PantheraWww> app = nullptr;
PantheraWww::~PantheraWww() = default;
/*
extern "C" {
void panthera_log(const char *message) {
std::cerr << message << std::endl;
@@ -867,10 +870,12 @@ extern "C" {
//app->get_layout_manager()->add_pane(new_pane);
}
}
*/
int main(int argc, char *argv[]) {
gPanthera::init();
app = PantheraWww::create();
auto app = PantheraWww::create();
return app->run(argc, argv);
}