diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index eb46b27..0caeeb7 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,22 +8,28 @@ include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) -option(WEBKIT_FOUND "" ON) +find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) -if(WEBKIT_FOUND) +option(WEBKIT_FOUND "No" OFF) + +find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) +if(WEBKIT_LIBRARIES_FOUND) + option(WEBKIT_FOUND "Yes" ON) PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0) include_directories(${WEBKIT_INCLUDE_DIRS}) link_directories(${WEBKIT_LIBRARY_DIRS}) add_definitions(${WEBKIT_CFLAGS_OTHER}) endif() +configure_file(ubl-settings-diskquota.h.in ubl-settings-diskquota-cm.h) -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ -O2 -pipe -fno-plt -fexceptions \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES + ubl-settings-diskquota-cm.h ubl-settings-diskquota.h ubl-settings-diskquota.cc ubconfig_quotas.h @@ -46,13 +52,14 @@ set(SOURCE_FILES my_plug.cc ubl-util-standard.h ubl-util-standard.c - main.cc) + main.cc) set(LIBRARIES ${GTK_LIBRARIES} pthread) add_executable(ubl-settings-diskquota ${SOURCE_FILES}) + target_link_libraries(ubl-settings-diskquota PUBLIC ${WEBKIT_LIBRARIES} ${LIBRARIES}) target_include_directories(ubl-settings-diskquota PUBLIC "${PROJECT_BINARY_DIR}" diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index 2ca853b..702e498 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -43,13 +43,9 @@ void MainWindow::settings() { obj_quotas_sys.set_map_gui(map_gui_cfg); obj_quotas_ubconfig.set_map_gui(map_gui_cfg); #ifdef WEBKIT_FOUND - void *handle=NULL; - handle = dlopen("libwebkit2gtk-4.0.so", RTLD_LAZY); - if (handle) { - one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); - three = Glib::wrap(GTK_WIDGET(one)); - wndWeb->add(*three); - } + one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); + three = Glib::wrap(GTK_WIDGET(one)); + wndWeb->add(*three); #endif if (geteuid() == 0) { this->load_system_cfg(); @@ -462,11 +458,7 @@ void MainWindow::get_builder() { builder->get_widget("btnFilterUsers", btnFilterUsers); builder->get_widget("btnFilterGroups", btnFilterGroups); #ifdef WEBKIT_FOUND - void *handle=NULL; - handle = dlopen("libwebkit2gtk-4.0.so", RTLD_LAZY); - if (handle) { builder->get_widget("wndWeb", wndWeb); - } #endif builder->get_widget("lblHeadeWndWeb", lblHeadeWndWeb); builder->get_widget("lblwebHeaderName", lblwebHeaderName); @@ -690,15 +682,8 @@ void MainWindow::synopsis_show() { void MainWindow::open_browser() { #ifdef WEBKIT_FOUND - void *handle=NULL; - handle = dlopen("libwebkit2gtk-4.0.so", RTLD_LAZY); - if (handle) { - webkit_web_view_load_uri(one, link_doc); - wndWeb->show_all(); - } - else { - this->template_open_browser(); - } + webkit_web_view_load_uri(one, link_doc); + wndWeb->show_all(); #else this->template_open_browser(); #endif @@ -791,13 +776,6 @@ void MainWindow::info_warning_error(int mess) { } MainWindow::~MainWindow() { - #ifdef WEBKIT_FOUND - void *handle=NULL; - handle = dlopen("libwebkit2gtk-4.0.so", RTLD_LAZY); - if (handle) { - free(one); - } - #endif } void help() { diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 27943c3..62d17d3 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -10,6 +10,7 @@ #include "system_quotas.h" #include "ubconfig_quotas.h" #include +#include "ubl-settings-diskquota-cm.h" #ifdef WEBKIT_FOUND #include #endif diff --git a/source/ubl-settings-diskquota.h.in b/source/ubl-settings-diskquota.h.in new file mode 100644 index 0000000..17ba454 --- /dev/null +++ b/source/ubl-settings-diskquota.h.in @@ -0,0 +1 @@ +#cmakedefine WEBKIT_FOUND \ No newline at end of file