diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d03616d..61c3d91 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -17,17 +17,14 @@ find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) option(WEBKIT_FOUND "No" OFF) if(WEBKIT_LIBRARIES_FOUND) - option(WEBKIT_FOUND "Yes" ON) + + add_definitions(-DWEBKIT_FOUND) 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-cmake.in ubl-cmake.h) - -file(COPY ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h DESTINATION ./) - set(GRESOURCE_C resources.c) set(GRESOURCE_XML gresource.xml) @@ -61,20 +58,16 @@ add_custom_target( DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} ) -#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 -lm") -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") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(SOURCE_FILES ubl-settings-manager.c ubl-settings-manager.h - ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h ) +message(${GTK_LIBRARIES}) + set(LIBRARIES ${GTK_LIBRARIES} ${WEBKIT_LIBRARIES} diff --git a/source/ubl-cmake.in b/source/ubl-cmake.in deleted file mode 100644 index d4623a7..0000000 --- a/source/ubl-cmake.in +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine WEBKIT_FOUND diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index d138384..c205f3e 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -1,21 +1,5 @@ #ifndef UBL_SETTINGS_MANAGER_MAIN #define UBL_SETTINGS_MANAGER_MAIN -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "ubl-settings-manager.h" @@ -66,6 +50,10 @@ void on_plug_removed(GtkSocket* self, actionWidgets *widgets){ void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ GtkTreeIter iter; char *name; + if (applist->socket){ + gtk_widget_destroy(applist->socket); + } + applist->socket=create_socket(applist); gtk_tree_model_get_iter(gtk_icon_view_get_model(self),&iter,path); gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,0,&name,-1); @@ -90,7 +78,7 @@ void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *appl void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ GtkTreeIter iter; char *name; - if (!applist->socket){}else{ + if (applist->socket){ gtk_widget_destroy(applist->socket); } applist->socket=create_socket(applist); @@ -162,7 +150,8 @@ void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb){ GtkWidget *window=GTK_WIDGET(gtk_builder_get_object(sctb->builder,"HideWhileLaunch")); GtkWidget *socketplace=GTK_WIDGET(gtk_builder_get_object(sctb->builder,"socketplace")); gtk_widget_destroy(sctb->socket); - sctb->socket=GTK_WIDGET(create_socket(sctb)); + sctb->socket=NULL; + // sctb->socket=GTK_WIDGET(create_socket(sctb)); GtkWidget *backbutton=sctb->ButtonBackToMain; gtk_widget_hide(backbutton); }; @@ -1676,10 +1665,11 @@ dictionary *yon_dictionary_get_last(dictionary *dict){ return dct; } -void yon_main_quit(actionWidgets *widgets){ +void yon_main_quit(GtkWidget *,GdkEvent*,actionWidgets *widgets){ // GtkWindow *wnd=GTK_WINDOW(widgets->window); // gtk_window_get_position(wnd,&main_config.windowPosX,&main_config.windowPosY); // gtk_window_get_size(wnd,&main_config.windowWidth,&main_config.windowHeight); + g_signal_handlers_disconnect_by_func(widgets->socket,on_plug_removed,widgets); save_config(widgets); gtk_main_quit(); } @@ -1728,7 +1718,6 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them gtk_widget_set_sensitive(curWidgets->MenuItemSettings,0); } gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview"); - curWidgets->socket=GTK_WIDGET(create_socket(curWidgets)); if (curWidgets->ButtonBackToMain!=NULL) gtk_label_set_text(GTK_LABEL(curWidgets->BackToSettingsLabel),BACK_TO_ALL_SETTINGS_LABEL); gtk_window_set_title(GTK_WINDOW(curWidgets->window),UBL_SETTINGS_MANAGER_TITLE); @@ -1808,7 +1797,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them g_signal_connect(G_OBJECT(curWidgets->settingsDoubleClickSwitch), "state-set", G_CALLBACK(on_double_click_changed), widgets); } gtk_widget_hide_on_delete(curWidgets->window); - g_signal_connect(G_OBJECT(curWidgets->window), "destroy", G_CALLBACK(yon_main_quit), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->window), "delete-event", G_CALLBACK(yon_main_quit), curWidgets); return widgets; } diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index 04d1de1..a34bc4c 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -5,7 +5,21 @@ #include #include #include -#include "ubl-cmake.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef WEBKIT_FOUND #include #endif