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..0ad4771 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" @@ -57,15 +41,15 @@ void on_plug_removed(GtkSocket* self, actionWidgets *widgets){ gtk_widget_show(widgets->HideWhileLaunch); gtk_widget_set_vexpand(widgets->socketplace,0); gtk_widget_set_vexpand(widgets->HideWhileLaunch,1); - // if(widgets->socketbutton) - // gtk_widget_destroy(widgets->socketbutton); - // if(widgets->ThirdSocket) - // gtk_widget_destroy(widgets->ThirdSocket); } 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 +74,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 +146,7 @@ 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; GtkWidget *backbutton=sctb->ButtonBackToMain; gtk_widget_hide(backbutton); }; @@ -511,7 +495,6 @@ void on_sections_add(GtkWidget *button, actionWidgets *widgets){ SectionSettingSegment *segment=yon_create_section_setting(category_name,category_categories); dictionary *newsection = yon_dictionary_get_last(main_config.SettingsSections); newsection=yon_dictionary_create_with_data_connected(newsection,category_name,segment); - // printf("%s\n",category_name); dictionary *newsec=yon_dictionary_create_empty(); newsec=yon_section_new(newsec,category_name,category_categories); main_config.sections=yon_dictionary_create_with_data_connected(main_config.sections,category_name,newsec->data); @@ -652,7 +635,6 @@ void on_reveal_banner(GtkWidget *button, actionWidgets *widgets){ } void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){ - // printf("%s\n","SGRBHSDRFJHNSDRJHNSDRJHNDRDJR"); *main_config.currentDoubleClick=state; update_double_clicks(widgetsD); } @@ -670,11 +652,7 @@ void on_about(GtkWidget *button, GtkBuilder *buildr){ GList *list = gtk_container_get_children(GTK_CONTAINER(AboutButtons)); gtk_widget_destroy(AboutButtons); g_signal_connect(G_OBJECT(About), "activate-link", G_CALLBACK(on_about_link), buildr); - // gtk_widget_destroy(GTK_WIDGET(g_list_first(list)->next->next)); - // gtk_widget_destroy(GTK_WIDGET(g_list_first(list)->next)); - // gtk_widget_destroy(GTK_WIDGET(g_list_first(list))); gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_HOME_PAGE_LABEL)); - // gtk_widget_set_visible(AboutButtons,0); } int launch(thread_output *thread){ @@ -905,7 +883,7 @@ int check_categories(apps app, char *catstocheck){ n_found++; while (cat){ left_cats=cat+1; - char *fcat=app.Categories;//strstr(app.Categories,";"); + char *fcat=app.Categories; cat=strstr(cat+1,";"); if (!cat) break; find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); @@ -1027,9 +1005,6 @@ int setup_config(){ main_config.sections->next=NULL; } - // if (main_config.windowWidth<1024&&main_config.windowHeight<720){ - // main_config.WindowTheme=0; - // } return 1; }; @@ -1676,10 +1651,8 @@ dictionary *yon_dictionary_get_last(dictionary *dict){ return dct; } -void yon_main_quit(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); +void yon_main_quit(GtkWidget *,GdkEvent*,actionWidgets *widgets){ + g_signal_handlers_disconnect_by_func(widgets->socket,on_plug_removed,widgets); save_config(widgets); gtk_main_quit(); } @@ -1720,6 +1693,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them curWidgets->Revealer=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Revealer"))); curWidgets->BackToSettingsLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"BackToSettingsLabel"))); curWidgets->SettingsSections=main_config.SettingsSections; + curWidgets->socket=NULL; if (main_config.BannerHidden==0){ gtk_revealer_set_reveal_child(GTK_REVEALER(curWidgets->Revealer),1); gtk_menu_button_set_direction(GTK_MENU_BUTTON(curWidgets->BannerRevealer),GTK_ARROW_LEFT); @@ -1728,7 +1702,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); @@ -1738,10 +1711,6 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them } g_signal_connect(G_OBJECT(curWidgets->window), "configure-event", G_CALLBACK(on_resized), widgets); - // if (strcmp(theme_id,"Gnome")==0){ - // g_signal_connect(G_OBJECT(curWidgets->window), "event-after", G_CALLBACK(on_resized_done), widgets); - - // } if (curWidgets->ButtonBackToMain!=NULL) g_signal_connect(G_OBJECT(curWidgets->ButtonBackToMain), "clicked", G_CALLBACK(on_backToSettingsButton_clicked), curWidgets); gtk_window_set_title(GTK_WINDOW(curWidgets->window),UBL_SETTINGS_MANAGER_TITLE); @@ -1808,7 +1777,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