From 33131279f7cdceb735ea96660c23eae8d67c259c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 20 Nov 2025 18:03:19 +0600 Subject: [PATCH 1/3] WIP settings manager rework --- gresource.xml | 6 +- ...s-manager-banner.png => manager-banner.png | Bin source/CMakeLists.txt | 27 +- source/ubl-settings-manager-app-sections.c | 7 + source/ubl-settings-manager-theme-gnome.c | 92 + source/ubl-settings-manager-theme.c | 55 + source/ubl-settings-manager.c | 3163 +++++++---------- source/ubl-settings-manager.h | 270 +- source/ubl-strings.h | 26 + ubl-settings-manager-settings-sections.glade | 299 ++ ubl-settings-manager-settings-sections.glade~ | 298 ++ ubl-settings-manager-settings.glade | 353 ++ ...settings-manager-theme-gnome-section.glade | 23 + ...ettings-manager-theme-gnome-section.glade~ | 23 + ubl-settings-manager-theme-gnome.glade | 153 + ubl-settings-manager-theme-gnome.glade~ | 149 + ...settings-manager-theme-main-IconView.glade | 60 + ubl-settings-manager-theme-main.glade | 69 + ubl-settings-manager-theme-main.glade~ | 73 + ubl-settings-manager.css | 421 ++- ubl-settings-manager.glade | 2117 ++--------- 21 files changed, 3657 insertions(+), 4027 deletions(-) rename ubl-settings-manager-banner.png => manager-banner.png (100%) create mode 100644 source/ubl-settings-manager-app-sections.c create mode 100644 source/ubl-settings-manager-theme-gnome.c create mode 100644 source/ubl-settings-manager-theme.c create mode 100644 source/ubl-strings.h create mode 100644 ubl-settings-manager-settings-sections.glade create mode 100644 ubl-settings-manager-settings-sections.glade~ create mode 100644 ubl-settings-manager-settings.glade create mode 100644 ubl-settings-manager-theme-gnome-section.glade create mode 100644 ubl-settings-manager-theme-gnome-section.glade~ create mode 100644 ubl-settings-manager-theme-gnome.glade create mode 100644 ubl-settings-manager-theme-gnome.glade~ create mode 100644 ubl-settings-manager-theme-main-IconView.glade create mode 100644 ubl-settings-manager-theme-main.glade create mode 100644 ubl-settings-manager-theme-main.glade~ diff --git a/gresource.xml b/gresource.xml index a6b8179..87d8e0d 100644 --- a/gresource.xml +++ b/gresource.xml @@ -2,11 +2,15 @@ ubl-settings-manager.glade + ubl-settings-manager-theme-gnome.glade + ubl-settings-manager-theme-gnome-section.glade + ubl-settings-manager-theme-main.glade + ubl-settings-manager-settings-sections.glade ubl-settings-manager.css - ubl-settings-manager-banner.png + manager-banner.png \ No newline at end of file diff --git a/ubl-settings-manager-banner.png b/manager-banner.png similarity index 100% rename from ubl-settings-manager-banner.png rename to manager-banner.png diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 61c3d91..3c99c95 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -15,10 +15,7 @@ add_definitions(${VTE291_CFLAGS_OTHER}) find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) -option(WEBKIT_FOUND "No" OFF) if(WEBKIT_LIBRARIES_FOUND) - - 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}) @@ -33,8 +30,12 @@ add_custom_target(GLADE ubl-settings-manager.glade) set(DEPENDFILES ../ubl-settings-manager.glade + ../ubl-settings-manager-theme-gnome.glade + ../ubl-settings-manager-theme-gnome-section.glade + ../ubl-settings-manager-theme-main.glade + ../ubl-settings-manager-settings-sections.glade ../gresource.xml - ../ubl-settings-manager-banner.png + ../manager-banner.png ../ubl-settings-manager.css ) @@ -58,21 +59,31 @@ add_custom_target( DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} ) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") +#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(SOURCE_FILES ubl-settings-manager.c + ubl-settings-manager-theme.c + ubl-settings-manager-theme-gnome.c + ubl-settings-manager-app-sections.c ubl-settings-manager.h + ubl-strings.h ) -message(${GTK_LIBRARIES}) - set(LIBRARIES ${GTK_LIBRARIES} ${WEBKIT_LIBRARIES} ${VTE291_LIBRARIES} - pthread) + pthread + ublsettings + ublsettings-gtk3 + ublsettingsui-gtk3) add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}) diff --git a/source/ubl-settings-manager-app-sections.c b/source/ubl-settings-manager-app-sections.c new file mode 100644 index 0000000..b71ed7e --- /dev/null +++ b/source/ubl-settings-manager-app-sections.c @@ -0,0 +1,7 @@ +#include "ubl-settings-manager.h" + +app_section *yon_app_section_new(){ + app_section *new_section = malloc(sizeof(app_section)); + memset(new_section,0,sizeof(app_section)); + return new_section; +} \ No newline at end of file diff --git a/source/ubl-settings-manager-theme-gnome.c b/source/ubl-settings-manager-theme-gnome.c new file mode 100644 index 0000000..4d8ceb3 --- /dev/null +++ b/source/ubl-settings-manager-theme-gnome.c @@ -0,0 +1,92 @@ +#include "ubl-settings-manager.h" + + +void on_gnome_activate(){ + +} + +void on_gnome_socket_add(){ + +} + +typedef struct { + GtkWidget *expander; + GtkWidget *AppsList; + app_section *section; +} gnome_section; + +gnome_section *yon_gnome_section_new(){ + gnome_section *cur_section = malloc(sizeof(gnome_section)); + memset(cur_section,0,sizeof(cur_section)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_gnome_section); + cur_section->expander = yon_gtk_builder_get_widget(builder,"MainExpander"); + cur_section->AppsList = yon_gtk_builder_get_widget(builder,"AppsList"); + return cur_section; +} + +void yon_gnome_section_setup_apps(gnome_section *cur_section, const char *target){ + apps *cur_app = yon_apps_get((char*)target); + GtkWidget *Image = gtk_image_new_from_icon_name(cur_app->Icon,GTK_ICON_SIZE_BUTTON); + GtkWidget *Label = gtk_label_new(cur_app->Name); + GtkWidget *Row = gtk_list_box_row_new(); + GtkWidget *Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + // g_signal_connect(G_OBJECT(theme->AppsTree),"row-activated",G_CALLBACK(on_gnome_activate),theme); + g_object_set_data(G_OBJECT(Row),"gnome_section",cur_section); + gtk_container_add(GTK_CONTAINER(Row),Box); + gtk_box_pack_start(GTK_BOX(Box),Image,0,0,0); + gtk_box_pack_start(GTK_BOX(Box),Label,0,0,0); + gtk_label_set_xalign(GTK_LABEL(Label),0); + gtk_list_box_insert(GTK_LIST_BOX(cur_section->AppsList),Row,-1); + gtk_widget_show_all(Row); +} + +void yon_gnome_section_setup(GtkBox *target,app_section *section){ + gnome_section *cur_section = yon_gnome_section_new(); + cur_section->section = section; + gtk_expander_set_label(GTK_EXPANDER(cur_section->expander),section->name); + int app_size; + config_str app_list = yon_apps_get_by_categories(section->categories,section->categories_size,&app_size); + for(int i=0;iexpander,0,0,0); +} + +int yon_gnome_update(gnome_theme_struct *theme){ + if (!main_config.sections) return 0; + GList *list = gtk_container_get_children(GTK_CONTAINER(theme->AppsTree)); + GList *iter; + for (iter=list;iter;iter=iter->next){ + gnome_section *cur_section = g_object_get_data(G_OBJECT(iter->data),"gnome_section"); + gtk_widget_destroy(cur_section->expander); + free(cur_section); + } + + int size; + dictionary *cur; + for_dictionaries(cur,main_config.sections){ + app_section *section_data = yon_dictionary_get_data(cur,app_section*); + yon_gnome_section_setup(GTK_BOX(theme->AppsTree),section_data); + } + return 1; +} + +gnome_theme_struct *yon_gnome_theme_new(){ + gnome_theme_struct *theme = malloc(sizeof(gnome_theme_struct)); + + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_gnome_theme); + theme->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + theme->AppsTree = yon_gtk_builder_get_widget(builder,"AppsTree"); + theme->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox"); + theme->GnomePaned = yon_gtk_builder_get_widget(builder,"GnomePaned"); + theme->GnomeInfoLogoImage = yon_gtk_builder_get_widget(builder,"GnomeInfoLogoImage"); + theme->IconCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"IconCell")); + theme->Socket = NULL; + theme->get_command_func = NULL; + theme->list_update_func = (int(*)(struct gnome_theme_struct*))yon_gnome_update; + theme->set_sections_func = NULL; + + g_signal_connect(G_OBJECT(theme->SocketBox),"add",G_CALLBACK(on_gnome_socket_add),theme); + // gtk_cell_renderer_set_fixed_size(theme->IconCell,main_config.apps_icon_size,main_config.apps_icon_size); + return theme; +} diff --git a/source/ubl-settings-manager-theme.c b/source/ubl-settings-manager-theme.c new file mode 100644 index 0000000..a2c7ce3 --- /dev/null +++ b/source/ubl-settings-manager-theme.c @@ -0,0 +1,55 @@ +#include "ubl-settings-manager.h" + +theme_struct *yon_theme_update(main_window *widgets){ + char *theme_id; + if (!yon_window_config_get_parameter("Settings","theme",&theme_id,YON_TYPE_STRING)){ + theme_id = yon_char_new(GNOME_THEME_LABEL); + } + + theme_struct *theme = g_hash_table_lookup(main_config.themes,theme_id); + if (theme){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->ThemeBox)); + GList *iter; + for (iter = list;iter;iter=iter->next){ + theme_struct *cur_theme = g_object_get_data(G_OBJECT(iter->data),"theme_struct"); + if (cur_theme) free(cur_theme); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + } + + gtk_box_pack_start(GTK_BOX(widgets->ThemeBox),theme->MainBox,1,1,0); + return theme; + } else { + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),THEME_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + } + return NULL; +} + +void yon_theme_init(){ + theme_struct *gnome_struct = (theme_struct*)yon_gnome_theme_new(); + theme_struct *main_struct = (theme_struct*)yon_main_theme_new(); + g_hash_table_insert(main_config.themes,yon_char_new(GNOME_THEME_LABEL),gnome_struct); + g_hash_table_insert(main_config.themes,yon_char_new(MAIN_THEME_LABEL),main_struct); +} + +void on_main_activate(){ + +} + +void on_main_socket_add(){ + +} + +main_theme_struct *yon_main_theme_new(){ + main_theme_struct *theme = malloc(sizeof(gnome_theme_struct)); + + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_main_theme); + theme->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + theme->AppsIconView = yon_gtk_builder_get_widget(builder,"AppsIconView"); + theme->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox"); + theme->AppsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AppsList")); + theme->Socket = NULL; + + g_signal_connect(G_OBJECT(theme->AppsIconView),"item-activated",G_CALLBACK(on_main_activate),theme); + g_signal_connect(G_OBJECT(theme->SocketBox),"add",G_CALLBACK(on_main_socket_add),theme); + return theme; +} diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index 0ad4771..125f48f 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -1,1788 +1,1402 @@ -#ifndef UBL_SETTINGS_MANAGER_MAIN -#define UBL_SETTINGS_MANAGER_MAIN #include "ubl-settings-manager.h" -#define _(String) gettext(String) - -char **sectionremoval=NULL; -int removalsize=0; -char *local; config main_config; -int gnld=0; -int stld=0; -int cmld=0; - - - -void on_plug_added(GtkSocket* self, actionWidgets *builder){ - gtk_widget_show(builder->socketbutton); - gtk_widget_show(builder->ThirdSocket); - gtk_widget_set_vexpand(builder->HideWhileLaunch,0); - gtk_widget_hide(builder->HideWhileLaunch); - gtk_widget_set_vexpand(GTK_WIDGET(builder->socketplace),1); - gtk_widget_set_vexpand(GTK_WIDGET(self),1); - gtk_widget_show(builder->socketplace); - gtk_widget_hide(builder->appSettings); - if (builder->ButtonBackToMain!=NULL) gtk_widget_show(builder->ButtonBackToMain); - gtk_widget_show(GTK_WIDGET(self)); - gtk_widget_show(builder->socketbuttonplace); - gtk_widget_show(builder->ThirdSocketPlace); - gtk_widget_show(builder->socketbutton); - gtk_widget_show(builder->ThirdSocket); -} - -void on_plug_removed(GtkSocket* self, actionWidgets *widgets){ - on_backToSettingsButton_clicked(widgets->ButtonBackToMain,widgets); - gtk_widget_show(widgets->socketbuttonplace); - gtk_widget_show(widgets->appSettings); - gtk_widget_show(widgets->HideWhileLaunch); - gtk_widget_set_vexpand(widgets->socketplace,0); - gtk_widget_set_vexpand(widgets->HideWhileLaunch,1); -} - -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); +// void on_plug_added(GtkSocket* self, main_window *builder){ +// gtk_widget_show(builder->socketbutton); +// gtk_widget_show(builder->ThirdSocket); +// gtk_widget_set_vexpand(builder->HideWhileLaunch,0); +// gtk_widget_hide(builder->HideWhileLaunch); +// gtk_widget_set_vexpand(GTK_WIDGET(builder->socketplace),1); +// gtk_widget_set_vexpand(GTK_WIDGET(self),1); +// gtk_widget_show(builder->socketplace); +// gtk_widget_hide(builder->appSettings); +// if (builder->ButtonBackToMain!=NULL) gtk_widget_show(builder->ButtonBackToMain); +// gtk_widget_show(GTK_WIDGET(self)); +// gtk_widget_show(builder->socketbuttonplace); +// gtk_widget_show(builder->ThirdSocketPlace); +// gtk_widget_show(builder->socketbutton); +// gtk_widget_show(builder->ThirdSocket); +// } + +// void on_plug_removed(GtkSocket* self, main_window *widgets){ +// on_backToSettingsButton_clicked(widgets->ButtonBackToMain,widgets); +// gtk_widget_show(widgets->socketbuttonplace); +// gtk_widget_show(widgets->appSettings); +// gtk_widget_show(widgets->HideWhileLaunch); +// gtk_widget_set_vexpand(widgets->socketplace,0); +// gtk_widget_set_vexpand(widgets->HideWhileLaunch,1); +// } + +// void on_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *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); - apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); - if (!tempapp){}else{ - char *arg=NULL; - arg=yon_char_get_augumented("--socket-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket)))); +// apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); +// if (!tempapp){}else{ +// char *arg=NULL; +// arg=yon_char_get_augumented("--socket-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket)))); - if (tempapp[0].Type==1){ - if (tempapp->Pluggable==1) - if (tempapp->DualPluggable==1){ - char *dualarg=NULL; - dualarg=yon_char_get_augumented("--socket-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket))),yon_char_get_augumented(" --socket-ext-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))),yon_char_get_augumented(" --socket-trd-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket)))))))); - launch_app_with_arguments(tempapp[0].Exec,dualarg); - } else - launch_app_with_arguments(tempapp[0].Exec,arg); - else launch_app(tempapp[0].Exec); - } - } -}; - -void on_gnome_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); +// if (tempapp[0].Type==1){ +// if (tempapp->Pluggable==1) +// if (tempapp->DualPluggable==1){ +// char *dualarg=NULL; +// dualarg=yon_char_get_augumented("--socket-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket))),yon_char_get_augumented(" --socket-ext-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))),yon_char_get_augumented(" --socket-trd-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket)))))))); +// launch_app_with_arguments(tempapp[0].Exec,dualarg); +// } else +// launch_app_with_arguments(tempapp[0].Exec,arg); +// else launch_app(tempapp[0].Exec); +// } +// } +// }; + +// void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *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); - apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); - char *arg=NULL; - arg=yon_char_get_augumented("--socket-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket)))); - if (tempapp[0].Type==1){ - if (tempapp->Pluggable==1){ +// apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); +// char *arg=NULL; +// arg=yon_char_get_augumented("--socket-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket)))); +// if (tempapp[0].Type==1){ +// if (tempapp->Pluggable==1){ - if (tempapp->DualPluggable==1){ - char *dualarg=NULL; - dualarg=yon_char_get_augumented("--socket-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket))),yon_char_get_augumented(" --socket-ext-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))),yon_char_get_augumented(" --socket-trd-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket)))))))); - if (launch_app_with_arguments(tempapp[0].Exec,dualarg)==32512) - gtk_widget_show(applist->infoWarningWindow); - } - else{ - launch_app_with_arguments(tempapp[0].Exec,arg); - gtk_widget_destroy(applist->socketbutton); - } - } - else { - launch_app(tempapp[0].Exec); - gtk_widget_destroy(applist->socketbutton); - } - } -} - -void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets){ - if (gtk_icon_view_get_selected_items(IV)>0){ - dictionary *next=widgets->ICSys->first; - for (dictionary *dct=next;dct!=NULL;dct=dct->next){ - IVGraphicals *IVG=(IVGraphicals*)dct->data; - if (GTK_ICON_VIEW(IVG->IV)!=GTK_ICON_VIEW(IV)) - if (gtk_icon_view_get_selected_items(GTK_ICON_VIEW(IVG->IV))>0) - gtk_icon_view_unselect_all(GTK_ICON_VIEW(IVG->IV)); - } - } -}; -void on_about_link(GtkWidget* self,gchar* uri,gpointer user_data){ - gtk_widget_destroy(self); - on_ButtonOpenHelp_activated(NULL,user_data); -} -void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,"AlwaysOpenHelpCheckbox")))) - { - #ifdef WEBKIT_FOUND - GtkBuilder *web_builder=gtk_builder_new_from_resource(GladePath); - GtkWidget *browser=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Window")); - GtkWidget *web_place=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Place")); - GtkWidget *WebView=webkit_web_view_new(); - webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),UBLINUX_WIKI_LINK); - gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); - gtk_widget_show_all(browser); - #else - if(system(UBLINUX_WIKI_COMMAND)){}; - #endif - } else - { - GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); - gtk_widget_show(window); - }; -}; - -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=NULL; - GtkWidget *backbutton=sctb->ButtonBackToMain; - gtk_widget_hide(backbutton); -}; - -void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder){ - GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); - gtk_widget_hide(window); -}; - -void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder){ - #ifdef WEBKIT_FOUND - GtkBuilder *web_builder=gtk_builder_new_from_resource(GladePath); - GtkWidget *browser=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Window")); - GtkWidget *web_place=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Place")); - GtkWidget *WebView=webkit_web_view_new(); - webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),UBLINUX_WIKI_LINK); - gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); - gtk_widget_show_all(browser); - #else - if(system(UBLINUX_WIKI_COMMAND)){}; - #endif - GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); - gtk_widget_hide(window); -}; - -int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ - if (main_config.WindowTheme==0) - main_config.curThemeName="Main"; - else if (main_config.WindowTheme==1) - main_config.curThemeName="Gnome"; - dictionary *widgetsD=yon_dictionary_find(widgetsDs,main_config.curThemeName); - actionWidgets *widgets=(actionWidgets*)widgetsD->data; - int theme=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); - gtk_window_get_position(GTK_WINDOW(widgets->window),&main_config.windowPosX,&main_config.windowPosY); - gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight); - if (theme==0) - main_config.curThemeName="Main"; - else if (theme==1) - main_config.curThemeName="Gnome"; - if (main_config.WindowTheme!=theme){ - main_config.WindowTheme=theme; - GtkWidget *loaderWindow=GTK_WIDGET(gtk_builder_get_object(widgets->builder,"LoaderWindow")); - gtk_window_resize(GTK_WINDOW(loaderWindow),main_config.windowWidth,main_config.windowHeight); - gtk_window_move(GTK_WINDOW(loaderWindow),main_config.windowPosX,main_config.windowPosY); - gtk_widget_show(loaderWindow); - yon_switch_theme(widgetsDs,yon_dictionary_find(&widgetsD,main_config.curThemeName)); - if (widgets!=(actionWidgets*)widgetsD->data) widgets=(actionWidgets*)widgetsD->data; - gtk_widget_hide(loaderWindow); - gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); - } - GKeyFile *gfile=g_key_file_new(); +// if (tempapp->DualPluggable==1){ +// char *dualarg=NULL; +// dualarg=yon_char_get_augumented("--socket-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket))),yon_char_get_augumented(" --socket-ext-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))),yon_char_get_augumented(" --socket-trd-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket)))))))); +// if (launch_app_with_arguments(tempapp[0].Exec,dualarg)==32512) +// gtk_widget_show(applist->infoWarningWindow); +// } +// else{ +// launch_app_with_arguments(tempapp[0].Exec,arg); +// gtk_widget_destroy(applist->socketbutton); +// } +// } +// else { +// launch_app(tempapp[0].Exec); +// gtk_widget_destroy(applist->socketbutton); +// } +// } +// } + +// void on_item_selection_changed(GtkIconView *IV, main_window *widgets){ +// if (gtk_icon_view_get_selected_items(IV)>0){ +// dictionary *next=widgets->ICSys->first; +// for (dictionary *dct=next;dct!=NULL;dct=dct->next){ +// IVGraphicals *IVG=(IVGraphicals*)dct->data; +// if (GTK_ICON_VIEW(IVG->IV)!=GTK_ICON_VIEW(IV)) +// if (gtk_icon_view_get_selected_items(GTK_ICON_VIEW(IVG->IV))>0) +// gtk_icon_view_unselect_all(GTK_ICON_VIEW(IVG->IV)); +// } +// } +// }; +// void on_about_link(GtkWidget* self,gchar* uri,gpointer user_data){ +// gtk_widget_destroy(self); +// on_ButtonOpenHelp_activated(NULL,user_data); +// } +// void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder){ +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,"AlwaysOpenHelpCheckbox")))) +// { +// #ifdef WEBKIT_FOUND +// GtkBuilder *web_builder=gtk_builder_new_from_resource(GladePath); +// GtkWidget *browser=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Window")); +// GtkWidget *web_place=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Place")); +// GtkWidget *WebView=webkit_web_view_new(); +// webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),UBLINUX_WIKI_LINK); +// gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); +// gtk_widget_show_all(browser); +// #else +// if(system(UBLINUX_WIKI_COMMAND)){}; +// #endif +// } else +// { +// GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); +// gtk_widget_show(window); +// }; +// }; + +// void on_backToSettingsButton_clicked(GtkWidget *button,main_window *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=NULL; +// GtkWidget *backbutton=sctb->ButtonBackToMain; +// gtk_widget_hide(backbutton); +// }; + +// void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder){ +// GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); +// gtk_widget_hide(window); +// }; + +// void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder){ +// #ifdef WEBKIT_FOUND +// GtkBuilder *web_builder=gtk_builder_new_from_resource(GladePath); +// GtkWidget *browser=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Window")); +// GtkWidget *web_place=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Place")); +// GtkWidget *WebView=webkit_web_view_new(); +// webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),UBLINUX_WIKI_LINK); +// gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); +// gtk_widget_show_all(browser); +// #else +// if(system(UBLINUX_WIKI_COMMAND)){}; +// #endif +// GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); +// gtk_widget_hide(window); +// }; + +// int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ +// if (main_config.WindowTheme==0) +// main_config.curThemeName="Main"; +// else if (main_config.WindowTheme==1) +// main_config.curThemeName="Gnome"; +// dictionary *widgetsD=yon_dictionary_find(widgetsDs,main_config.curThemeName); +// main_window *widgets=(main_window*)widgetsD->data; +// int theme=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); +// gtk_window_get_position(GTK_WINDOW(widgets->window),&main_config.windowPosX,&main_config.windowPosY); +// gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight); +// if (theme==0) +// main_config.curThemeName="Main"; +// else if (theme==1) +// main_config.curThemeName="Gnome"; +// if (main_config.WindowTheme!=theme){ +// main_config.WindowTheme=theme; +// GtkWidget *loaderWindow=GTK_WIDGET(gtk_builder_get_object(widgets->builder,"LoaderWindow")); +// gtk_window_resize(GTK_WINDOW(loaderWindow),main_config.windowWidth,main_config.windowHeight); +// gtk_window_move(GTK_WINDOW(loaderWindow),main_config.windowPosX,main_config.windowPosY); +// gtk_widget_show(loaderWindow); +// yon_switch_theme(widgetsDs,yon_dictionary_find(&widgetsD,main_config.curThemeName)); +// if (widgets!=(main_window*)widgetsD->data) widgets=(main_window*)widgetsD->data; +// gtk_widget_hide(loaderWindow); +// gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); +// } +// GKeyFile *gfile=g_key_file_new(); - int sz=1,szm=1; - if (main_config.Gnomeiconsize==64) sz=4; - else if (main_config.Gnomeiconsize==48) sz=3; - else if (main_config.Gnomeiconsize==32) sz=2; - else if (main_config.Gnomeiconsize==24) sz=1; - if (main_config.Mainiconsize==64) szm=4; - else if (main_config.Mainiconsize==48) szm=3; - else if (main_config.Mainiconsize==32) szm=2; - else if (main_config.Mainiconsize==24) szm=1; - char *fromint=malloc(5); - memset(fromint,0,5); - GError *err=NULL; - char *login=getlogin(); - if (geteuid()==0){ - login=main_config.lastUser; - } else { - main_config.lastUser=login; - } - char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); - sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); - g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); - if (err){ - struct stat st = {0}; - char *ptdir=malloc(36+strlen(getlogin())); - sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); - if (stat(ptdir, &st) == -1) { - mkdir(ptdir, 0777); - } - FILE *fp; - fp=fopen(pth,"w"); - fclose(fp); - } - g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); - if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){ - sprintf(fromint,"%d",main_config.windowPosX); - g_key_file_set_string(gfile,"window","WindowPosX",fromint); - sprintf(fromint,"%d",main_config.windowPosY); - g_key_file_set_string(gfile,"window","WindowPosY",fromint); - sprintf(fromint,"%d",main_config.windowWidth); - g_key_file_set_string(gfile,"window","WindowWidth",fromint); - sprintf(fromint,"%d",main_config.windowHeight); - g_key_file_set_string(gfile,"window","WindowHeight",fromint); - } - sprintf(fromint,"%d",main_config.WindowTheme); - g_key_file_set_string(gfile,"window","WindowTheme",fromint); - sprintf(fromint,"%d",sz); - g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); - sprintf(fromint,"%d",szm); - g_key_file_set_string(gfile,"window","MainIconSize",fromint); - sprintf(fromint,"%d",main_config.iconSegmentSize); - g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); - sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); - g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); - sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); - g_key_file_set_string(gfile,"window","MainLabelSize",fromint); - sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); - g_key_file_set_string(gfile,"window","LabelDensity",fromint); - g_key_file_set_string(gfile,"window","User",login); - g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick); - g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick); +// int sz=1,szm=1; +// if (main_config.Gnomeiconsize==64) sz=4; +// else if (main_config.Gnomeiconsize==48) sz=3; +// else if (main_config.Gnomeiconsize==32) sz=2; +// else if (main_config.Gnomeiconsize==24) sz=1; +// if (main_config.Mainiconsize==64) szm=4; +// else if (main_config.Mainiconsize==48) szm=3; +// else if (main_config.Mainiconsize==32) szm=2; +// else if (main_config.Mainiconsize==24) szm=1; +// char *fromint=malloc(5); +// memset(fromint,0,5); +// GError *err=NULL; +// char *login=getlogin(); +// if (geteuid()==0){ +// login=main_config.lastUser; +// } else { +// main_config.lastUser=login; +// } +// char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); +// sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); +// g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); +// if (err){ +// struct stat st = {0}; +// char *ptdir=malloc(36+strlen(getlogin())); +// sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); +// if (stat(ptdir, &st) == -1) { +// mkdir(ptdir, 0777); +// } +// FILE *fp; +// fp=fopen(pth,"w"); +// fclose(fp); +// } +// g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); +// if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){ +// sprintf(fromint,"%d",main_config.windowPosX); +// g_key_file_set_string(gfile,"window","WindowPosX",fromint); +// sprintf(fromint,"%d",main_config.windowPosY); +// g_key_file_set_string(gfile,"window","WindowPosY",fromint); +// sprintf(fromint,"%d",main_config.windowWidth); +// g_key_file_set_string(gfile,"window","WindowWidth",fromint); +// sprintf(fromint,"%d",main_config.windowHeight); +// g_key_file_set_string(gfile,"window","WindowHeight",fromint); +// } +// sprintf(fromint,"%d",main_config.WindowTheme); +// g_key_file_set_string(gfile,"window","WindowTheme",fromint); +// sprintf(fromint,"%d",sz); +// g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); +// sprintf(fromint,"%d",szm); +// g_key_file_set_string(gfile,"window","MainIconSize",fromint); +// sprintf(fromint,"%d",main_config.iconSegmentSize); +// g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); +// sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); +// g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); +// sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); +// g_key_file_set_string(gfile,"window","MainLabelSize",fromint); +// sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); +// g_key_file_set_string(gfile,"window","LabelDensity",fromint); +// g_key_file_set_string(gfile,"window","User",login); +// g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick); +// g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick); - g_key_file_remove_group(gfile, "sections",NULL); - for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){ - IVGraphicals *IV=(IVGraphicals*)dict->data; - g_key_file_set_string(gfile,"sections",IV->sectionName,IV->categories); - if (main_config.changed==1){ - load_apps_with_clear(IV,widgets->applist,widgets->appssize); - } - } - main_config.changed=0; - g_key_file_save_to_file(gfile,pth,NULL); - gtk_widget_hide(widgets->SettingsWindow); -}; - -void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets){ - int position=gtk_paned_get_position(GTK_PANED(widgets->GnomePaned)); - if (position<200) {position=200; gtk_paned_set_position(GTK_PANED(widgets->GnomePaned),200);} - main_config.iconSegmentSize=position; - double pos=((double)position-20); - if (pos<50) pos=50; - for (dictionary *dict=widgets->ICSys;dict!=NULL;dict=dict->next){ - IVGraphicals *IV=(IVGraphicals*)dict->data; - gtk_icon_view_set_item_width(GTK_ICON_VIEW(IV->IV),pos); - } +// g_key_file_remove_group(gfile, "sections",NULL); +// for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){ +// IVGraphicals *IV=(IVGraphicals*)dict->data; +// g_key_file_set_string(gfile,"sections",IV->sectionName,IV->categories); +// if (main_config.changed==1){ +// load_apps_with_clear(IV,widgets->applist,widgets->appssize); +// } +// } +// main_config.changed=0; +// g_key_file_save_to_file(gfile,pth,NULL); +// gtk_widget_hide(widgets->SettingsWindow); +// }; + +// void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, main_window *widgets){ +// int position=gtk_paned_get_position(GTK_PANED(widgets->GnomePaned)); +// if (position<200) {position=200; gtk_paned_set_position(GTK_PANED(widgets->GnomePaned),200);} +// main_config.iconSegmentSize=position; +// double pos=((double)position-20); +// if (pos<50) pos=50; +// for (dictionary *dict=widgets->ICSys;dict!=NULL;dict=dict->next){ +// IVGraphicals *IV=(IVGraphicals*)dict->data; +// gtk_icon_view_set_item_width(GTK_ICON_VIEW(IV->IV),pos); +// } -} - -int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){ - gtk_window_set_title(GTK_WINDOW(widgets->SettingsWindow),UBL_SETTINGS_MANAGER_TITLE); - gtk_widget_set_size_request(widgets->SettingsWindow,400,250); - GtkIconTheme *icthm=gtk_icon_theme_get_default(); - gtk_window_set_icon(GTK_WINDOW(widgets->SettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_widget_show_all(widgets->SettingsWindow); - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),main_config.WindowTheme); - gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); - int sz=1; - if (*main_config.currentThemeIconSize==64) sz=4; - if (*main_config.currentThemeIconSize==48) sz=3; - if (*main_config.currentThemeIconSize==32) sz=2; - if (*main_config.currentThemeIconSize==24) sz=1; - gtk_range_set_value(GTK_RANGE(widgets->settingsSizeSlider),sz); - char *tmp=malloc(6); - sprintf(tmp,"%dx%d\0",*main_config.currentThemeIconSize,*main_config.currentThemeIconSize); - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),tmp); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// } + +// int on_settingsOpen(GtkWidget *button, main_window *widgets){ +// gtk_window_set_title(GTK_WINDOW(widgets->SettingsWindow),UBL_SETTINGS_MANAGER_TITLE); +// gtk_widget_set_size_request(widgets->SettingsWindow,400,250); +// GtkIconTheme *icthm=gtk_icon_theme_get_default(); +// gtk_window_set_icon(GTK_WINDOW(widgets->SettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_widget_show_all(widgets->SettingsWindow); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),main_config.WindowTheme); +// gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); +// int sz=1; +// if (*main_config.currentThemeIconSize==64) sz=4; +// if (*main_config.currentThemeIconSize==48) sz=3; +// if (*main_config.currentThemeIconSize==32) sz=2; +// if (*main_config.currentThemeIconSize==24) sz=1; +// gtk_range_set_value(GTK_RANGE(widgets->settingsSizeSlider),sz); +// char *tmp=malloc(6); +// sprintf(tmp,"%dx%d\0",*main_config.currentThemeIconSize,*main_config.currentThemeIconSize); +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),tmp); +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); -}; - -int on_settings_icon_size_changed(GtkWidget* self, actionWidgets *widgets){ - int val=(int)gtk_range_get_value(GTK_RANGE(self)); - GtkIconTheme *icthm=gtk_icon_theme_get_default(); - if ((int)val==1||(int)val==0){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); - if (*main_config.currentThemeIconSize!=24) - main_config.changed=1; - *main_config.currentThemeIconSize=24; - } - if ((int)val==2){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); - if (*main_config.currentThemeIconSize!=32) - main_config.changed=1; - *main_config.currentThemeIconSize=32; - } - if ((int)val==3){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); - if (*main_config.currentThemeIconSize!=48) - main_config.changed=1; - *main_config.currentThemeIconSize=48; - } - if ((int)val==4){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); - if (*main_config.currentThemeIconSize!=64) - main_config.changed=1; - *main_config.currentThemeIconSize=64; - } -}; - -int on_settings_cancel(GtkWidget *button, actionWidgets *widgets){ - gtk_widget_hide(widgets->SettingsWindow); - setup_config(); -}; - -void on_caution_understand(GtkWidget *button,actionWidgets *widgets){ - gtk_widget_hide(widgets->CautionWindow); -} - -void on_section_settings_open(GtkButton* self,dictionary *cWidgets){ - actionWidgets *widgets=(actionWidgets*)cWidgets->data; - if (main_config.SettingsSections->first->data==NULL){ - char *name=((IconSection*)main_config.sections->first->data)->section; - char *categories=((IconSection*)main_config.sections->first->data)->categories; - main_config.SettingsSections->first->data=yon_create_section_setting(name, categories); - main_config.SettingsSections->first->key=name; - yon_segments_hide(widgets); - yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data); - for (dictionary *dct=main_config.sections->first->next;dct!=NULL;dct=dct->next){ - name=((IconSection*)dct->data)->section; - categories=((IconSection*)dct->data)->categories; - main_config.SettingsSections=yon_dictionary_create_with_data_connected(main_config.SettingsSections,name,yon_create_section_setting(name, categories)); - main_config.SettingsSections->key=name; - yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data); - } - yon_segments_show(widgets); - - - } - gtk_window_present(GTK_WINDOW(widgets->SectionSettingsWindow)); -} - -void on_sections_edit(GtkWidget *button, actionWidgets *widgets){ - for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ - SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; - if (segment!=NULL){ - if (button==segment->ButtonEdit){ - gtk_widget_hide(segment->NameLabel); - gtk_widget_hide(segment->CategoriesLabel); - gtk_widget_show(segment->NameEntry); - gtk_widget_show(segment->CategoriesEntry); - gtk_widget_show(segment->EditButtonBox); - gtk_widget_hide(segment->DeleditBox); - gtk_widget_set_sensitive(segment->DragButtonBox,0); +// gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); +// }; + +// int on_settings_icon_size_changed(GtkWidget* self, main_window *widgets){ +// int val=(int)gtk_range_get_value(GTK_RANGE(self)); +// GtkIconTheme *icthm=gtk_icon_theme_get_default(); +// if ((int)val==1||(int)val==0){ +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); +// if (*main_config.currentThemeIconSize!=24) +// main_config.changed=1; +// *main_config.currentThemeIconSize=24; +// } +// if ((int)val==2){ +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); +// if (*main_config.currentThemeIconSize!=32) +// main_config.changed=1; +// *main_config.currentThemeIconSize=32; +// } +// if ((int)val==3){ +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); +// if (*main_config.currentThemeIconSize!=48) +// main_config.changed=1; +// *main_config.currentThemeIconSize=48; +// } +// if ((int)val==4){ +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); +// if (*main_config.currentThemeIconSize!=64) +// main_config.changed=1; +// *main_config.currentThemeIconSize=64; +// } +// }; + +// int on_settings_cancel(GtkWidget *button, main_window *widgets){ +// gtk_widget_hide(widgets->SettingsWindow); +// setup_config(); +// }; + +// void on_caution_understand(GtkWidget *button,main_window *widgets){ +// gtk_widget_hide(widgets->CautionWindow); +// } + +// void on_section_settings_open(GtkButton* self,dictionary *cWidgets){ +// main_window *widgets=(main_window*)cWidgets->data; +// if (main_config.SettingsSections->first->data==NULL){ +// char *name=((IconSection*)main_config.sections->first->data)->section; +// char *categories=((IconSection*)main_config.sections->first->data)->categories; +// main_config.SettingsSections->first->data=yon_create_section_setting(name, categories); +// main_config.SettingsSections->first->key=name; +// yon_segments_hide(widgets); +// yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data); +// for (dictionary *dct=main_config.sections->first->next;dct!=NULL;dct=dct->next){ +// name=((IconSection*)dct->data)->section; +// categories=((IconSection*)dct->data)->categories; +// main_config.SettingsSections=yon_dictionary_create_with_data_connected(main_config.SettingsSections,name,yon_create_section_setting(name, categories)); +// main_config.SettingsSections->key=name; +// yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data); +// } +// yon_segments_show(widgets); + + +// } +// gtk_window_present(GTK_WINDOW(widgets->SectionSettingsWindow)); +// } + +// void on_sections_edit(GtkWidget *button, main_window *widgets){ +// for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ +// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; +// if (segment!=NULL){ +// if (button==segment->ButtonEdit){ +// gtk_widget_hide(segment->NameLabel); +// gtk_widget_hide(segment->CategoriesLabel); +// gtk_widget_show(segment->NameEntry); +// gtk_widget_show(segment->CategoriesEntry); +// gtk_widget_show(segment->EditButtonBox); +// gtk_widget_hide(segment->DeleditBox); +// gtk_widget_set_sensitive(segment->DragButtonBox,0); - } else { - gtk_widget_set_sensitive(segment->OptionBox,0); - gtk_widget_set_sensitive(segment->DragButtonBox,0); - } +// } else { +// gtk_widget_set_sensitive(segment->OptionBox,0); +// gtk_widget_set_sensitive(segment->DragButtonBox,0); +// } - } - } -}; - -void on_sections_accept(GtkWidget *button, actionWidgets *widgets){ - for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ - SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; - if (segment!=NULL){ - if (button==segment->EditButtonAccept){ - char *name=yon_char_get_augumented((char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)),""); - char *newname=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->NameEntry)),""); - char *newcats=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry)),""); - if (newcats[strlen(newcats)-1]!=';') - newcats=yon_char_get_augumented(newcats,";"); - gtk_label_set_text(GTK_LABEL(segment->NameLabel),gtk_entry_get_text(GTK_ENTRY(segment->NameEntry))); - gtk_label_set_text(GTK_LABEL(segment->CategoriesLabel),gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry))); - dictionary *toedit=yon_dictionary_find(&main_config.sections,name); - toedit->key=newname; - ((IconSection*)toedit->data)->section=newname; - ((IconSection*)toedit->data)->categories=newcats; - toedit=yon_dictionary_find(&main_config.SettingsSections,name); - toedit->key=newname; - ((IconSection*)toedit->data)->section=newname; - ((IconSection*)toedit->data)->categories=newcats; - gtk_widget_show(segment->NameLabel); - gtk_widget_show(segment->CategoriesLabel); - gtk_widget_hide(segment->NameEntry); - gtk_widget_hide(segment->CategoriesEntry); - gtk_widget_hide(segment->EditButtonBox); - gtk_widget_show(segment->DeleditBox); - gtk_widget_set_sensitive(segment->DragButtonBox,1); - - }else { - gtk_widget_set_sensitive(segment->OptionBox,1); - gtk_widget_set_sensitive(segment->DragButtonBox,1); - } - } - - } -}; - -void on_sections_cancel(GtkWidget *button, actionWidgets *widgets){ - for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ - SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; - if (segment!=NULL){ - if (button==segment->EditButtonCancel){ - gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),gtk_label_get_text(GTK_LABEL(segment->NameLabel))); - gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),gtk_label_get_text(GTK_LABEL(segment->CategoriesLabel))); - gtk_widget_show(segment->NameLabel); - gtk_widget_show(segment->CategoriesLabel); - gtk_widget_hide(segment->NameEntry); - gtk_widget_hide(segment->CategoriesEntry); - gtk_widget_hide(segment->EditButtonBox); - gtk_widget_show(segment->ButtonEdit); - gtk_widget_show(segment->DeleditBox); - gtk_widget_set_sensitive(segment->DragButtonBox,1); - - }else { - gtk_widget_set_sensitive(segment->OptionBox,1); - gtk_widget_set_sensitive(segment->DragButtonBox,1); - } - } - - } -}; - -void on_sections_move_up(GtkWidget *button, actionWidgets *widgets){ - for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ - SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; - if (segment!=NULL){ - if (button==segment->DragUpButton){ - yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1); - yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1); - yon_segments_hide(widgets); - yon_segments_show(widgets); - } - } - } -}; - -void on_sections_move_down(GtkWidget *button, actionWidgets *widgets){ - for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ - SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; - if (segment!=NULL){ - if (button==segment->DragDownButton){ - yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1); - yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1); - yon_segments_hide(widgets); - yon_segments_show(widgets); - } - } - } -}; - -void on_sections_add(GtkWidget *button, actionWidgets *widgets){ - char *category_name = yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry)),""); - if (strcmp(category_name,"")!=0){ - char *category_categories=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry)),""); - if (category_categories[strlen(category_categories)-1]!=';') - category_categories=yon_char_get_augumented(category_categories,";"); - 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); - 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); - - gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); - gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); - yon_segment_show(widgets, segment); - yon_segments_hide(widgets); - yon_segments_show(widgets); - } -} - -void on_sections_new_clear(GtkWidget *button, actionWidgets *widgets){ - gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); - gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); -} - -void on_sections_close(GtkWidget *button, actionWidgets *widgets){ - gtk_widget_hide(widgets->SectionSettingsWindow); -} - -void on_sections_save(GtkWidget *button, dictionary *widgetsD){ - int temptheme=main_config.WindowTheme; - for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ - actionWidgets *widgets=(actionWidgets*)dict->data; - if (strcmp(dict->key,"Gnome")==0) main_config.WindowTheme=1; - else main_config.WindowTheme=0; - - for (dictionary *ICSys=widgets->ICSys->first;ICSys!=NULL;ICSys=ICSys->next){ - gtk_container_remove(GTK_CONTAINER(widgets->icvpack),((IVGraphicals*)ICSys->data)->Box); - } - widgets->ICSys=yon_create_icon_section_list(main_config.sections); - for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){ - load_apps((IVGraphicals*)cur->data,widgets->applist,widgets->appssize); - } - yon_show_icon_views(widgets->ICSys,widgets); - hide_if_unfound(widgetsD); - if (main_config.WindowTheme==1) - yon_icv_resize_item(dict,widgets->GnomePaned); - } - main_config.WindowTheme=temptheme; -} - -void on_section_delete(GtkWidget *button, actionWidgets *widgets){ - gtk_widget_destroy(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))))); - for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ - SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; - if (segment!=NULL){ - if (button==segment->ButtonDelete){ - main_config.sections=yon_dictionary_rip(yon_dictionary_find(&main_config.sections, dct->key)); - main_config.SettingsSections=yon_dictionary_rip(yon_dictionary_find(&main_config.SettingsSections, dct->key)); - break; - } +// } +// } +// }; + +// void on_sections_accept(GtkWidget *button, main_window *widgets){ +// for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ +// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; +// if (segment!=NULL){ +// if (button==segment->EditButtonAccept){ +// char *name=yon_char_get_augumented((char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)),""); +// char *newname=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->NameEntry)),""); +// char *newcats=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry)),""); +// if (newcats[strlen(newcats)-1]!=';') +// newcats=yon_char_get_augumented(newcats,";"); +// gtk_label_set_text(GTK_LABEL(segment->NameLabel),gtk_entry_get_text(GTK_ENTRY(segment->NameEntry))); +// gtk_label_set_text(GTK_LABEL(segment->CategoriesLabel),gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry))); +// dictionary *toedit=yon_dictionary_find(&main_config.sections,name); +// toedit->key=newname; +// ((IconSection*)toedit->data)->section=newname; +// ((IconSection*)toedit->data)->categories=newcats; +// toedit=yon_dictionary_find(&main_config.SettingsSections,name); +// toedit->key=newname; +// ((IconSection*)toedit->data)->section=newname; +// ((IconSection*)toedit->data)->categories=newcats; +// gtk_widget_show(segment->NameLabel); +// gtk_widget_show(segment->CategoriesLabel); +// gtk_widget_hide(segment->NameEntry); +// gtk_widget_hide(segment->CategoriesEntry); +// gtk_widget_hide(segment->EditButtonBox); +// gtk_widget_show(segment->DeleditBox); +// gtk_widget_set_sensitive(segment->DragButtonBox,1); + +// }else { +// gtk_widget_set_sensitive(segment->OptionBox,1); +// gtk_widget_set_sensitive(segment->DragButtonBox,1); +// } +// } + +// } +// }; + +// void on_sections_cancel(GtkWidget *button, main_window *widgets){ +// for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ +// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; +// if (segment!=NULL){ +// if (button==segment->EditButtonCancel){ +// gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),gtk_label_get_text(GTK_LABEL(segment->NameLabel))); +// gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),gtk_label_get_text(GTK_LABEL(segment->CategoriesLabel))); +// gtk_widget_show(segment->NameLabel); +// gtk_widget_show(segment->CategoriesLabel); +// gtk_widget_hide(segment->NameEntry); +// gtk_widget_hide(segment->CategoriesEntry); +// gtk_widget_hide(segment->EditButtonBox); +// gtk_widget_show(segment->ButtonEdit); +// gtk_widget_show(segment->DeleditBox); +// gtk_widget_set_sensitive(segment->DragButtonBox,1); + +// }else { +// gtk_widget_set_sensitive(segment->OptionBox,1); +// gtk_widget_set_sensitive(segment->DragButtonBox,1); +// } +// } + +// } +// }; + +// void on_sections_move_up(GtkWidget *button, main_window *widgets){ +// for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ +// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; +// if (segment!=NULL){ +// if (button==segment->DragUpButton){ +// yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1); +// yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1); +// yon_segments_hide(widgets); +// yon_segments_show(widgets); +// } +// } +// } +// }; + +// void on_sections_move_down(GtkWidget *button, main_window *widgets){ +// for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ +// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; +// if (segment!=NULL){ +// if (button==segment->DragDownButton){ +// yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1); +// yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1); +// yon_segments_hide(widgets); +// yon_segments_show(widgets); +// } +// } +// } +// }; + +// void on_sections_add(GtkWidget *button, main_window *widgets){ +// char *category_name = yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry)),""); +// if (strcmp(category_name,"")!=0){ +// char *category_categories=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry)),""); +// if (category_categories[strlen(category_categories)-1]!=';') +// category_categories=yon_char_get_augumented(category_categories,";"); +// 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); +// 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); + +// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); +// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); +// yon_segment_show(widgets, segment); +// yon_segments_hide(widgets); +// yon_segments_show(widgets); +// } +// } + +// void on_sections_new_clear(GtkWidget *button, main_window *widgets){ +// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); +// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); +// } + +// void on_sections_close(GtkWidget *button, main_window *widgets){ +// gtk_widget_hide(widgets->SectionSettingsWindow); +// } + +// void on_sections_save(GtkWidget *button, dictionary *widgetsD){ +// int temptheme=main_config.WindowTheme; +// for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ +// main_window *widgets=(main_window*)dict->data; +// if (strcmp(dict->key,"Gnome")==0) main_config.WindowTheme=1; +// else main_config.WindowTheme=0; + +// for (dictionary *ICSys=widgets->ICSys->first;ICSys!=NULL;ICSys=ICSys->next){ +// gtk_container_remove(GTK_CONTAINER(widgets->icvpack),((IVGraphicals*)ICSys->data)->Box); +// } +// widgets->ICSys=yon_create_icon_section_list(main_config.sections); +// for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){ +// load_apps((IVGraphicals*)cur->data,widgets->applist,widgets->appssize); +// } +// yon_show_icon_views(widgets->ICSys,widgets); +// hide_if_unfound(widgetsD); +// if (main_config.WindowTheme==1) +// yon_icv_resize_item(dict,widgets->GnomePaned); +// } +// main_config.WindowTheme=temptheme; +// } + +// void on_section_delete(GtkWidget *button, main_window *widgets){ +// gtk_widget_destroy(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))))); +// for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ +// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; +// if (segment!=NULL){ +// if (button==segment->ButtonDelete){ +// main_config.sections=yon_dictionary_rip(yon_dictionary_find(&main_config.sections, dct->key)); +// main_config.SettingsSections=yon_dictionary_rip(yon_dictionary_find(&main_config.SettingsSections, dct->key)); +// break; +// } - } - } -} - -void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){ - actionWidgets *widgets=(actionWidgets*)widgetsD->data; - if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){ - main_config.fullscreen=0; - gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight); - gtk_window_get_position(GTK_WINDOW(window),&main_config.windowPosX,&main_config.windowPosY); - } - else - main_config.fullscreen=1; - gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),!gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer))); - gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer))); - -} - -void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){ - actionWidgets *widgets=(actionWidgets*)widgetsD->data; - if (event->type==GDK_CONFIGURE){ - if (stld==1){ - gtk_window_set_resizable(GTK_WINDOW(window),1); - } - } -} - - - -void on_theme_selection_changed(GtkWidget *self, actionWidgets *widgets){ - int *icsize; - int curthm=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); - if (curthm==0){ - main_config.currentThemeIconSize=&main_config.Mainiconsize; - main_config.currentThemeLabelSize=&main_config.MainlabelSize; - main_config.currentDoubleClick=&main_config.MainDoubleClick; - icsize=main_config.currentThemeIconSize; - } - else if (curthm==1){ - main_config.currentThemeIconSize=&main_config.Gnomeiconsize; - main_config.currentThemeLabelSize=&main_config.GnomelabelSize; - main_config.currentDoubleClick=&main_config.GnomeDoubleClick; - icsize=main_config.currentThemeIconSize; - } - gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); - GtkIconTheme *icthm=gtk_icon_theme_get_default(); - if (*icsize==24 || *icsize==1){ - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),1.0); - *icsize=24; - } else if (*icsize==32 || *icsize==2){ - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),2.0); - *icsize=32; - } else if (*icsize==48 || *icsize==3){ - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),3.0); - *icsize=48; - } else{ - gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),4.0); - *icsize=64; - } -} - -void on_reveal_banner(GtkWidget *button, actionWidgets *widgets){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->BannerRevealer))==1){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->BannerRevealer),0); - if (gtk_revealer_get_reveal_child(GTK_REVEALER(widgets->Revealer))==1){ - gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),0); - gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerRevealer),GTK_ARROW_RIGHT); - main_config.BannerHidden=1; - } - else { - gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),1); - gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerRevealer),GTK_ARROW_LEFT); - main_config.BannerHidden=0; - } - } -} - -void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){ - *main_config.currentDoubleClick=state; - update_double_clicks(widgetsD); -} - -void on_about(GtkWidget *button, GtkBuilder *buildr){ - GtkBuilder *builder = gtk_builder_new_from_resource(GladePath); - GtkWidget *AboutButtons = GTK_WIDGET(gtk_builder_get_object(builder,"AboutButtons")); - GtkWidget *AboutHeadLabel = GTK_WIDGET(gtk_builder_get_object(builder,"aboutHeadLabel")); - GtkWidget *About = GTK_WIDGET(gtk_builder_get_object(builder, "ublAbloutWindow")); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_COMMENTS_LABEL)); - gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(About),_(UBL_SETTINGS_MANAGER_TITLE)); - gtk_label_set_text(GTK_LABEL(AboutHeadLabel),UBL_SETTINGS_MANAGER_ABOUT_TITLE); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(About),version_application); - gtk_widget_show(About); - 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_about_dialog_set_website_label(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_HOME_PAGE_LABEL)); -} - -int launch(thread_output *thread){ - int a=0; - a=system(thread->command); - *thread->exitcode=a; - return *thread->exitcode; -} - -int launch_app_with_arguments(char *name, char *args){ - char *path=yon_char_get_augumented("/usr/bin/",name); - path=yon_char_get_augumented(path," "); - path=yon_char_get_augumented(path,args); - pthread_t thread_id; - thread_output *thread=malloc(sizeof(thread_output)); - thread->command=path; - thread->exitcode=malloc(sizeof(int)); - pthread_create(&thread_id, NULL, (void*)launch, thread); - return *thread->exitcode; -}; - -int launch_app(char *name){ - char *path=name; - thread_output *thread=malloc(sizeof(thread_output)); - thread->command=path; - thread->exitcode=malloc(sizeof(int)); - pthread_t thread_id; - pthread_create(&thread_id, NULL, (void*)launch, thread); - return *thread->exitcode; -}; - -int py_launch_app(char *name,char *args){ - char *path=malloc(strlen("python ./")+strlen(name)+6+strlen(args)); - sprintf(path,"python ./%s.py %s &",name,args); - pthread_t thread_id; - thread_output *thread=malloc(sizeof(thread_output)); - thread->command=path; - thread->exitcode=malloc(sizeof(int)); - pthread_create(&thread_id, NULL, (void*)launch, thread); - return *thread->exitcode; -}; - -apps *get_app_by_name(apps *applist,char *name, int size){ - for (int i=0;iIV),GTK_TREE_MODEL(section->LV)); -} - -void update_double_clicks(dictionary *widgetsD){ - for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ - actionWidgets *widgets=(actionWidgets*)dict->data; - for (dictionary *ivdct=widgets->ICSys->first;ivdct!=NULL;ivdct=ivdct->next){ - IVGraphicals *IV=(IVGraphicals*)ivdct->data; - if (strcmp(dict->key,"Gnome")==0){ - gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.GnomeDoubleClick); - } else{ - gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.MainDoubleClick); - } - } - } -} - -int load_apps(IVGraphicals *section, apps *applist, int size){ - int catstofind=sizeof(section->categories)/sizeof(char*); - int i=0,sz=0; - for (int i=0;icategories)==1){ - GError *err=NULL; - GtkTreeIter iter; - gtk_list_store_append(section->LV,&iter); - int sz= yon_get_icon_size(*main_config.currentThemeIconSize)+3; - if (sz<34) sz=34; - GtkIconTheme *icthm=gtk_icon_theme_get_default(); - GdkPixbuf *pixbuf=gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, applist[i].Icon,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SIZE),NULL); - GtkTreePath *pth = gtk_tree_model_get_path(GTK_TREE_MODEL(section->LV),&iter); - gtk_list_store_set(section->LV,&iter,0,applist[i].Name,1,0.0,2,0.5, 3, sz+5, 4, pixbuf, 5,yon_get_icon_size(*main_config.currentThemeIconSize)+10, -1); - int cols = gtk_icon_view_get_columns(GTK_ICON_VIEW(section->IV)); - gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), -1); - gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), cols); - - } - - } - gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV)); -}; - -int load_apps_with_clear(IVGraphicals *section, apps *applist, int size){ - gtk_list_store_clear(section->LV); - load_apps(section,applist,size); -}; - -int hide_if_unfound(dictionary *widgetsD){ - for (dictionary *widgetsDc=widgetsD->first;widgetsDc!=NULL;widgetsDc=widgetsDc->next){ - actionWidgets *widgets=(actionWidgets*)widgetsDc->data; - for (dictionary *icvd=widgets->ICSys->first;icvd!=NULL;icvd=icvd->next){ - IVGraphicals *icv=icvd->data; - GtkTreeIter iter; - if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(icv->LV),&iter)==0){ - gtk_widget_hide(icv->Box); - gtk_widget_hide(GTK_WIDGET(icv->sep)); - } - } - } -} - -GtkWidget *create_socket(actionWidgets *builder){ - GtkWidget *socket; - socket = gtk_socket_new(); - GtkWidget *socketbutton=gtk_socket_new(); - GtkWidget *ThirdSocket=gtk_socket_new(); - g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(on_plug_added),builder); - g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(on_plug_removed),builder); - g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(on_plug_removed),builder); - gtk_box_pack_start(GTK_BOX(builder->socketplace),socket,true,true,0); - gtk_box_pack_start(GTK_BOX(builder->socketbuttonplace),socketbutton,1,1,0); - builder->socketbutton=socketbutton; - gtk_box_pack_start(GTK_BOX(builder->ThirdSocketPlace),ThirdSocket,1,1,0); - builder->ThirdSocket=ThirdSocket; - return socket; -}; - -void sort_apps(apps *applist,int size){ - apps tmp; - if (size>2) - { - for (int i=1;id_name); - file=fopen(path,"r"); - if (strlen(de->d_name)>9) - { - char *extension=strstr(path,"."); - if (extension!=NULL) - { - if (strcmp(extension,".desktop")==0) - { - apps tempapp; - GKeyFile *gfile=g_key_file_new(); - g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); - char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL); - if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; - tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); - if (tempapp.Name==NULL) continue; - tempapp.Categories=g_key_file_get_string(gfile,"Desktop Entry", "Categories",NULL); - if (tempapp.Categories==NULL) continue; - tempapp.Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); - if (tempapp.Exec==NULL) continue; - tempapp.Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); - if (tempapp.Icon==NULL) continue; - tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL); - if (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); - if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); - if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==0) - if (size==0){ - applist=(apps*)malloc(size+1*sizeof(apps)); - applist[0].Name=yon_char_new(tempapp.Name); - applist[0].Categories=yon_char_new(tempapp.Categories); - applist[0].Exec=yon_char_new(tempapp.Exec); - applist[0].Icon=yon_char_new(tempapp.Icon); - applist[0].Type=tempapp.Type; - applist[0].Pluggable=tempapp.Pluggable; - applist[0].DualPluggable=tempapp.DualPluggable; - size++; - } else { - applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); - applist[size].Name=yon_char_new(tempapp.Name); - applist[size].Categories=yon_char_new(tempapp.Categories); - applist[size].Exec=yon_char_new(tempapp.Exec); - applist[size].Icon=yon_char_new(tempapp.Icon); - applist[size].Pluggable=tempapp.Pluggable; - applist[size].DualPluggable=tempapp.DualPluggable; - applist[size].Type=tempapp.Type; - size++; - } - } - } - } - } - } - *sizef=size; - return applist; -}; - -int check_categories(apps app, char *catstocheck){ - if (!catstocheck || strcmp(catstocheck,"")==0||strcmp(catstocheck,";")==0){ - char *found=strstr(app.Categories,"X-UBL-SettingsManager"); - char *perfound=strstr(app.Categories,"X-UBL-PersonalSettings"); - char *harfound=strstr(app.Categories,"X-UBL-HardwareSettings"); - char *sysfound=strstr(app.Categories,"X-UBL-SystemSettings"); - if (found!=NULL&&(perfound==NULL&&harfound==NULL&&sysfound==NULL)) return 1; - else if (found==NULL)return 0; - } else - { - char *left_cats=catstocheck; - char *cat=strstr(left_cats,";"); - if (!cat) return 0; - char *find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); - char *found=strstr(app.Categories,find_it); - int to_find=0, n_found=0; - to_find++; - if (!found) return 0; - n_found++; - while (cat){ - left_cats=cat+1; - char *fcat=app.Categories; - cat=strstr(cat+1,";"); - if (!cat) break; - find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); - char *found=strstr(app.Categories,find_it); - to_find++; - if (!found) break; - n_found++; - left_cats=cat+1; - if (strlen(left_cats)==0 ||strcmp(left_cats,"")==0) break; - } - if (to_find==n_found) return 1; else return 0; - } -}; - -int setup_config(){ - FILE *file; - GError *err=NULL; - main_config.sections=yon_dictionary_create_empty(); - main_config.SettingsSections=yon_dictionary_create_empty(); - GKeyFile *configfile = g_key_file_new(); - char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); - sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); +// } +// } +// } + +// void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){ +// main_window *widgets=(main_window*)widgetsD->data; +// if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){ +// main_config.fullscreen=0; +// gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight); +// gtk_window_get_position(GTK_WINDOW(window),&main_config.windowPosX,&main_config.windowPosY); +// } +// else +// main_config.fullscreen=1; +// gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),!gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer))); +// gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer))); - g_key_file_load_from_file(configfile,GlobalConfigPath,G_KEY_FILE_KEEP_TRANSLATIONS,&err); - if (err){ - g_error_free(err); - return 0; +// } + +// void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){ +// main_window *widgets=(main_window*)widgetsD->data; +// if (event->type==GDK_CONFIGURE){ +// if (stld==1){ +// gtk_window_set_resizable(GTK_WINDOW(window),1); +// } +// } +// } + + + +// void on_theme_selection_changed(GtkWidget *self, main_window *widgets){ +// int *icsize; +// int curthm=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); +// if (curthm==0){ +// main_config.currentThemeIconSize=&main_config.Mainiconsize; +// main_config.currentThemeLabelSize=&main_config.MainlabelSize; +// main_config.currentDoubleClick=&main_config.MainDoubleClick; +// icsize=main_config.currentThemeIconSize; +// } +// else if (curthm==1){ +// main_config.currentThemeIconSize=&main_config.Gnomeiconsize; +// main_config.currentThemeLabelSize=&main_config.GnomelabelSize; +// main_config.currentDoubleClick=&main_config.GnomeDoubleClick; +// icsize=main_config.currentThemeIconSize; +// } +// gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); +// GtkIconTheme *icthm=gtk_icon_theme_get_default(); +// if (*icsize==24 || *icsize==1){ +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),1.0); +// *icsize=24; +// } else if (*icsize==32 || *icsize==2){ +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),2.0); +// *icsize=32; +// } else if (*icsize==48 || *icsize==3){ +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),3.0); +// *icsize=48; +// } else{ +// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); +// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),4.0); +// *icsize=64; +// } +// } + +void on_reveal_banner(GtkWidget *, main_window *widgets){ + if (gtk_revealer_get_reveal_child(GTK_REVEALER(widgets->BannerRevealer))){ + gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT); + gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->BannerRevealer),0); + gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerArrow),GTK_ARROW_RIGHT); + int banner = 1; + yon_window_config_add_instant_parameter("HideBanner","Settings",&banner,YON_TYPE_BOOLEAN); } else { - - char *foroutput=NULL; - char *line=NULL; - main_config.GnomeDoubleClick=g_key_file_get_boolean(configfile,"window", "GnomeDoubleClick",NULL); - main_config.MainDoubleClick=g_key_file_get_boolean(configfile,"window", "MainDoubleClick",NULL); - main_config.windowPosX=g_key_file_get_integer(configfile,"window","WindowPosX",NULL); - main_config.windowPosY=g_key_file_get_integer(configfile,"window","WindowPosY",NULL); - main_config.windowWidth=g_key_file_get_integer(configfile,"window","WindowWidth",NULL); - main_config.windowHeight=g_key_file_get_integer(configfile,"window","WindowHeight",NULL); - main_config.WindowTheme=g_key_file_get_integer(configfile,"window","WindowTheme",NULL); - main_config.Mainiconsize=g_key_file_get_integer(configfile,"window","MainIconSize",NULL); - main_config.Gnomeiconsize=g_key_file_get_integer(configfile,"window","GnomeIconSize",NULL); - main_config.iconSegmentSize=g_key_file_get_integer(configfile,"window","IconSegmentSize",NULL); - main_config.MainlabelSize=g_key_file_get_integer(configfile,"window","MainLabelSize",NULL); - main_config.GnomelabelSize=g_key_file_get_integer(configfile,"window","GnomeLabelSize",NULL); - main_config.labelDensity=g_key_file_get_integer(configfile,"window","LabelDensity",NULL); - main_config.lastUser=g_key_file_get_string(configfile,"window","User",NULL); - main_config.fullscreen=g_key_file_get_boolean(configfile,"window","fullscreen",NULL); - main_config.BannerHidden=g_key_file_get_boolean(configfile,"window","BannerHidden",NULL); + gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT); + gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->BannerRevealer),1); + gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerArrow),GTK_ARROW_LEFT); + int banner = 0; + yon_window_config_add_instant_parameter("HideBanner","Settings",&banner,YON_TYPE_BOOLEAN); } +} - g_key_file_load_from_file(configfile,pth,G_KEY_FILE_KEEP_TRANSLATIONS,&err); - if (err||main_config.lock_settings==1){ - if(err) - g_error_free(err); - err=NULL; - g_key_file_load_from_file(configfile,GlobalConfigPath,G_KEY_FILE_KEEP_TRANSLATIONS,&err); +// void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){ +// *main_config.currentDoubleClick=state; +// update_double_clicks(widgetsD); +// } + +// void on_about(GtkWidget *button, GtkBuilder *buildr){ +// GtkBuilder *builder = gtk_builder_new_from_resource(GladePath); +// GtkWidget *AboutButtons = GTK_WIDGET(gtk_builder_get_object(builder,"AboutButtons")); +// GtkWidget *AboutHeadLabel = GTK_WIDGET(gtk_builder_get_object(builder,"aboutHeadLabel")); +// GtkWidget *About = GTK_WIDGET(gtk_builder_get_object(builder, "ublAbloutWindow")); +// gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_COMMENTS_LABEL)); +// gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(About),_(UBL_SETTINGS_MANAGER_TITLE)); +// gtk_label_set_text(GTK_LABEL(AboutHeadLabel),UBL_SETTINGS_MANAGER_ABOUT_TITLE); +// gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(About),version_application); +// gtk_widget_show(About); +// 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_about_dialog_set_website_label(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_HOME_PAGE_LABEL)); +// } + +// int launch(thread_output *thread){ +// int a=0; +// a=system(thread->command); +// *thread->exitcode=a; +// return *thread->exitcode; +// } + +// int launch_app_with_arguments(char *name, char *args){ +// char *path=yon_char_get_augumented("/usr/bin/",name); +// path=yon_char_get_augumented(path," "); +// path=yon_char_get_augumented(path,args); +// pthread_t thread_id; +// thread_output *thread=malloc(sizeof(thread_output)); +// thread->command=path; +// thread->exitcode=malloc(sizeof(int)); +// pthread_create(&thread_id, NULL, (void*)launch, thread); +// return *thread->exitcode; +// }; + +// int launch_app(char *name){ +// char *path=name; +// thread_output *thread=malloc(sizeof(thread_output)); +// thread->command=path; +// thread->exitcode=malloc(sizeof(int)); +// pthread_t thread_id; +// pthread_create(&thread_id, NULL, (void*)launch, thread); +// return *thread->exitcode; +// }; + +// int py_launch_app(char *name,char *args){ +// char *path=malloc(strlen("python ./")+strlen(name)+6+strlen(args)); +// sprintf(path,"python ./%s.py %s &",name,args); +// pthread_t thread_id; +// thread_output *thread=malloc(sizeof(thread_output)); +// thread->command=path; +// thread->exitcode=malloc(sizeof(int)); +// pthread_create(&thread_id, NULL, (void*)launch, thread); +// return *thread->exitcode; +// }; + +// apps *get_app_by_name(apps *applist,char *name, int size){ +// for (int i=0;iIV),GTK_TREE_MODEL(section->LV)); +// } + +// void update_double_clicks(dictionary *widgetsD){ +// for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ +// main_window *widgets=(main_window*)dict->data; +// for (dictionary *ivdct=widgets->ICSys->first;ivdct!=NULL;ivdct=ivdct->next){ +// IVGraphicals *IV=(IVGraphicals*)ivdct->data; +// if (strcmp(dict->key,"Gnome")==0){ +// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.GnomeDoubleClick); +// } else{ +// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.MainDoubleClick); +// } +// } +// } +// } + +// int load_apps(IVGraphicals *section, apps *applist, int size){ +// int catstofind=sizeof(section->categories)/sizeof(char*); +// int i=0,sz=0; +// for (int i=0;icategories)==1){ +// GError *err=NULL; +// GtkTreeIter iter; +// gtk_list_store_append(section->LV,&iter); +// int sz= yon_get_icon_size(*main_config.currentThemeIconSize)+3; +// if (sz<34) sz=34; +// GtkIconTheme *icthm=gtk_icon_theme_get_default(); +// GdkPixbuf *pixbuf=gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, applist[i].Icon,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SIZE),NULL); +// GtkTreePath *pth = gtk_tree_model_get_path(GTK_TREE_MODEL(section->LV),&iter); +// gtk_list_store_set(section->LV,&iter,0,applist[i].Name,1,0.0,2,0.5, 3, sz+5, 4, pixbuf, 5,yon_get_icon_size(*main_config.currentThemeIconSize)+10, -1); +// int cols = gtk_icon_view_get_columns(GTK_ICON_VIEW(section->IV)); +// gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), -1); +// gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), cols); + +// } - } else { - - int GnomeDoubleClick=g_key_file_get_boolean(configfile,"window", "GnomeDoubleClick",NULL); - int MainDoubleClick=g_key_file_get_boolean(configfile,"window", "MainDoubleClick",NULL); - int windowPosX=g_key_file_get_integer(configfile,"window","WindowPosX",NULL); - int windowPosY=g_key_file_get_integer(configfile,"window","WindowPosY",NULL); - int windowWidth=g_key_file_get_integer(configfile,"window","WindowWidth",NULL); - int windowHeight=g_key_file_get_integer(configfile,"window","WindowHeight",NULL); - int WindowTheme=g_key_file_get_integer(configfile,"window","WindowTheme",NULL); - int Mainiconsize=g_key_file_get_integer(configfile,"window","MainIconSize",NULL); - int Gnomeiconsize=g_key_file_get_integer(configfile,"window","GnomeIconSize",NULL); - int iconSegmentSize=g_key_file_get_integer(configfile,"window","IconSegmentSize",NULL); - int MainlabelSize=g_key_file_get_integer(configfile,"window","MainLabelSize",NULL); - int GnomelabelSize=g_key_file_get_integer(configfile,"window","GnomeLabelSize",NULL); - int labelDensity=g_key_file_get_integer(configfile,"window","LabelDensity",NULL); - char *lastUser=g_key_file_get_string(configfile,"window","User",NULL); - int fullscreen=g_key_file_get_boolean(configfile,"window","fullscreen",NULL); - int BannerHidden=g_key_file_get_boolean(configfile,"window","BannerHidden",NULL); - main_config.GnomeDoubleClick=GnomeDoubleClick; - main_config.MainDoubleClick=MainDoubleClick; - main_config.windowPosX=windowPosX; - main_config.windowPosY=windowPosY; - main_config.windowWidth=windowWidth; - main_config.windowHeight=windowHeight; - main_config.WindowTheme=WindowTheme; - main_config.Mainiconsize=Mainiconsize; - main_config.Gnomeiconsize=Gnomeiconsize; - main_config.iconSegmentSize=iconSegmentSize; - main_config.MainlabelSize=MainlabelSize; - main_config.GnomelabelSize=GnomelabelSize; - main_config.labelDensity=labelDensity; - if (lastUser) - main_config.lastUser=lastUser; - main_config.fullscreen=fullscreen; - main_config.BannerHidden=BannerHidden; - } - - if (main_config.MainlabelSize==0) main_config.MainlabelSize=12; - if (main_config.labelDensity==0) main_config.labelDensity=0; - main_config.MainlabelSize=main_config.MainlabelSize*1000; - if (main_config.GnomelabelSize==0) main_config.GnomelabelSize=12; - main_config.GnomelabelSize=main_config.GnomelabelSize*1000; - - if (main_config.WindowTheme==0){ - main_config.currentThemeLabelSize=&main_config.MainlabelSize; - main_config.currentThemeIconSize=&main_config.Mainiconsize; - main_config.currentDoubleClick=&main_config.MainDoubleClick; - } else if (main_config.WindowTheme==1){ - main_config.currentThemeLabelSize=&main_config.GnomelabelSize; - main_config.currentThemeIconSize=&main_config.Gnomeiconsize; - main_config.currentDoubleClick=&main_config.GnomeDoubleClick; - } - - yon_icon_size_convert(0); - gsize length=0; - char **a=g_key_file_get_keys(configfile,"sections",&length,NULL); - - if (!a){yon_set_default_sections(main_config.sections);} else { - for (int i=0;inext=NULL; - } - - return 1; +// } +// gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV)); +// }; + +// int load_apps_with_clear(IVGraphicals *section, apps *applist, int size){ +// gtk_list_store_clear(section->LV); +// load_apps(section,applist,size); +// }; + +// int hide_if_unfound(dictionary *widgetsD){ +// for (dictionary *widgetsDc=widgetsD->first;widgetsDc!=NULL;widgetsDc=widgetsDc->next){ +// main_window *widgets=(main_window*)widgetsDc->data; +// for (dictionary *icvd=widgets->ICSys->first;icvd!=NULL;icvd=icvd->next){ +// IVGraphicals *icv=icvd->data; +// GtkTreeIter iter; +// if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(icv->LV),&iter)==0){ +// gtk_widget_hide(icv->Box); +// gtk_widget_hide(GTK_WIDGET(icv->sep)); +// } +// } +// } +// } + +// GtkWidget *create_socket(main_window *builder){ +// GtkWidget *socket; +// socket = gtk_socket_new(); +// GtkWidget *socketbutton=gtk_socket_new(); +// GtkWidget *ThirdSocket=gtk_socket_new(); +// g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(on_plug_added),builder); +// g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(on_plug_removed),builder); +// g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(on_plug_removed),builder); +// gtk_box_pack_start(GTK_BOX(builder->socketplace),socket,true,true,0); +// gtk_box_pack_start(GTK_BOX(builder->socketbuttonplace),socketbutton,1,1,0); +// builder->socketbutton=socketbutton; +// gtk_box_pack_start(GTK_BOX(builder->ThirdSocketPlace),ThirdSocket,1,1,0); +// builder->ThirdSocket=ThirdSocket; +// return socket; +// }; + +// void sort_apps(apps *applist,int size){ +// apps tmp; +// if (size>2) +// { +// for (int i=1;id_name); +// file=fopen(path,"r"); +// if (strlen(de->d_name)>9) +// { +// char *extension=strstr(path,"."); +// if (extension!=NULL) +// { +// if (strcmp(extension,".desktop")==0) +// { +// apps tempapp; +// GKeyFile *gfile=g_key_file_new(); +// g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); +// char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL); +// if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; +// tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); +// if (tempapp.Name==NULL) continue; +// tempapp.Categories=g_key_file_get_string(gfile,"Desktop Entry", "Categories",NULL); +// if (tempapp.Categories==NULL) continue; +// tempapp.Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); +// if (tempapp.Exec==NULL) continue; +// tempapp.Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); +// if (tempapp.Icon==NULL) continue; +// tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL); +// if (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); +// if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); +// if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==0) +// if (size==0){ +// applist=(apps*)malloc(size+1*sizeof(apps)); +// applist[0].Name=yon_char_new(tempapp.Name); +// applist[0].Categories=yon_char_new(tempapp.Categories); +// applist[0].Exec=yon_char_new(tempapp.Exec); +// applist[0].Icon=yon_char_new(tempapp.Icon); +// applist[0].Type=tempapp.Type; +// applist[0].Pluggable=tempapp.Pluggable; +// applist[0].DualPluggable=tempapp.DualPluggable; +// size++; +// } else { +// applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); +// applist[size].Name=yon_char_new(tempapp.Name); +// applist[size].Categories=yon_char_new(tempapp.Categories); +// applist[size].Exec=yon_char_new(tempapp.Exec); +// applist[size].Icon=yon_char_new(tempapp.Icon); +// applist[size].Pluggable=tempapp.Pluggable; +// applist[size].DualPluggable=tempapp.DualPluggable; +// applist[size].Type=tempapp.Type; +// size++; +// } +// } +// } +// } +// } +// } +// *sizef=size; +// return applist; +// }; + +// int check_categories(apps app, char *catstocheck){ +// if (!catstocheck || strcmp(catstocheck,"")==0||strcmp(catstocheck,";")==0){ +// char *found=strstr(app.Categories,"X-UBL-SettingsManager"); +// char *perfound=strstr(app.Categories,"X-UBL-PersonalSettings"); +// char *harfound=strstr(app.Categories,"X-UBL-HardwareSettings"); +// char *sysfound=strstr(app.Categories,"X-UBL-SystemSettings"); +// if (found!=NULL&&(perfound==NULL&&harfound==NULL&&sysfound==NULL)) return 1; +// else if (found==NULL)return 0; +// } else +// { +// char *left_cats=catstocheck; +// char *cat=strstr(left_cats,";"); +// if (!cat) return 0; +// char *find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); +// char *found=strstr(app.Categories,find_it); +// int to_find=0, n_found=0; +// to_find++; +// if (!found) return 0; +// n_found++; +// while (cat){ +// left_cats=cat+1; +// char *fcat=app.Categories; +// cat=strstr(cat+1,";"); +// if (!cat) break; +// find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); +// char *found=strstr(app.Categories,find_it); +// to_find++; +// if (!found) break; +// n_found++; +// left_cats=cat+1; +// if (strlen(left_cats)==0 ||strcmp(left_cats,"")==0) break; +// } +// if (to_find==n_found) return 1; else return 0; +// } +// }; + +void config_init(){ + main_config.sections=NULL; + main_config.SettingsSections=NULL; + main_config.double_click=0; + main_config.apps_icon_size=24; + main_config.labelDensity=0; + main_config.themes = g_hash_table_new(g_str_hash,g_str_equal); + yon_theme_init(); }; -void save_config(actionWidgets *widgets){ - if (main_config.lock_settings==1) - return; - GKeyFile *gfile=g_key_file_new(); +// // void save_config(main_window *widgets){ +// // if (main_config.lock_settings==1) +// // return; +// // GKeyFile *gfile=g_key_file_new(); +// // int sz=1,szm=1; +// // if (main_config.Gnomeiconsize==64) sz=4; +// // else if (main_config.Gnomeiconsize==48) sz=3; +// // else if (main_config.Gnomeiconsize==32) sz=2; +// // else if (main_config.Gnomeiconsize==24) sz=1; +// // else sz=3; +// // if (main_config.Mainiconsize==64) szm=4; +// // else if (main_config.Mainiconsize==48) szm=3; +// // else if (main_config.Mainiconsize==32) szm=2; +// // else if (main_config.Mainiconsize==24) szm=1; +// // else szm=3; +// // char *fromint=malloc(5); +// // memset(fromint,0,5); +// // GError *err=NULL; +// // char *login=getlogin(); +// // if (geteuid()==0){ +// // login=main_config.lastUser; +// // } else { +// // main_config.lastUser=login; +// // } +// // char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); +// // sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); +// // g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); +// // if (err){ +// // struct stat st = {0}; +// // char *ptdir=malloc(36+strlen(getlogin())); +// // sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); +// // if (stat(ptdir, &st) == -1) { +// // mkdir(ptdir, 0777); +// // } +// // FILE *fp; +// // fp=fopen(pth,"w"); +// // fclose(fp); +// // } +// // g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); +// // if (main_config.fullscreen==0){ +// // sprintf(fromint,"%d",main_config.windowPosX); +// // g_key_file_set_string(gfile,"window","WindowPosX",fromint); +// // sprintf(fromint,"%d",main_config.windowPosY); +// // g_key_file_set_string(gfile,"window","WindowPosY",fromint); +// // sprintf(fromint,"%d",main_config.windowWidth); +// // g_key_file_set_string(gfile,"window","WindowWidth",fromint); +// // sprintf(fromint,"%d",main_config.windowHeight); +// // g_key_file_set_string(gfile,"window","WindowHeight",fromint); +// // } +// // g_key_file_set_boolean(gfile,"window","fullscreen",main_config.fullscreen); +// // g_key_file_set_boolean(gfile,"window","BannerHidden",main_config.BannerHidden); +// // g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick); +// // g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick); +// // sprintf(fromint,"%d",main_config.WindowTheme); +// // g_key_file_set_string(gfile,"window","WindowTheme",fromint); +// // sprintf(fromint,"%d",sz); +// // g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); +// // sprintf(fromint,"%d",szm); +// // g_key_file_set_string(gfile,"window","MainIconSize",fromint); +// // sprintf(fromint,"%d",main_config.iconSegmentSize); +// // g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); +// // sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); +// // g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); +// // sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); +// // g_key_file_set_string(gfile,"window","MainLabelSize",fromint); +// // sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); +// // g_key_file_set_string(gfile,"window","LabelDensity",fromint); +// // g_key_file_set_string(gfile,"window","User",login); +// // if (main_config.lock_settings==0) +// // g_key_file_save_to_file(gfile,pth,NULL); +// // } + +// void yon_set_default_sections(dictionary *section){ +// yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;"); +// yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;"); +// yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;"); +// yon_section_new(section,"Misc",""); +// } + +// IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ +// IVGraphicals *IVG = malloc(sizeof(IVGraphicals)); +// GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); +// GtkBuilder *builder = gtk_builder_new_from_resource(GladePath); +// GtkWidget *iv = GTK_WIDGET(gtk_builder_get_object(builder,"iconTemplate")); +// gtk_widget_show(iv); +// GtkWidget *label = gtk_label_new(_(name)); +// GtkCellRendererPixbuf *iconRender = GTK_CELL_RENDERER_PIXBUF(gtk_builder_get_object(builder, "iconPic")); +// PangoAttrList *attrs = pango_attr_list_new(); +// PangoFontDescription *descr = pango_font_description_new(); +// pango_font_description_set_weight(descr,PANGO_WEIGHT_BOLD); +// int stretch = main_config.labelDensity; +// if (stretch>8) +// stretch = 4; +// pango_font_description_set_stretch(descr,main_config.labelDensity); +// pango_attr_list_insert(attrs,pango_attr_size_new(*main_config.currentThemeLabelSize)); +// pango_attr_list_insert(attrs, pango_attr_font_desc_new(descr)); +// gtk_label_set_attributes(GTK_LABEL(label),attrs); +// gtk_widget_set_margin_end(label,6); +// gtk_widget_set_margin_start(label,6); +// gtk_widget_set_margin_bottom(label,2); +// gtk_icon_view_set_spacing(GTK_ICON_VIEW(iv),20); +// if (main_config.WindowTheme==1) { +// gtk_icon_view_set_columns(GTK_ICON_VIEW(iv),1); +// gtk_widget_set_name(iv,"GnomeIcon"); +// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.GnomeDoubleClick); +// gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); +// } else { +// gtk_icon_view_set_item_padding(GTK_ICON_VIEW(iv),3); +// gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); +// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.MainDoubleClick); +// gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(iv),2); +// } +// GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); +// GtkListStore *lv=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststoreTemplate")); +// gtk_widget_set_name(sep,"SepIcon"); +// gtk_widget_set_halign(box,0); +// gtk_widget_set_valign(box,1); +// gtk_widget_set_margin_end(sep,6); +// gtk_widget_set_margin_start(sep,6); +// gtk_icon_view_set_model(GTK_ICON_VIEW(iv),GTK_TREE_MODEL(lv)); +// gtk_label_set_xalign(GTK_LABEL(label),0); +// gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,0); +// gtk_box_pack_start(GTK_BOX(box),sep,FALSE,FALSE,0); +// gtk_box_pack_start(GTK_BOX(box),iv,FALSE,FALSE,0); +// IVG->sectionName=name; +// IVG->categories=cats; +// IVG->LV = lv; +// IVG->Box = box; +// IVG->IV = iv; +// IVG->label = label; +// IVG->sep = sep; +// IVG->iconRender = iconRender; +// return IVG; +// } + +// dictionary *yon_create_icon_section_list(dictionary *sections){ +// if (!sections) +// return NULL; +// IVGraphicals *IVSections; +// dictionary *IVDict=NULL; +// sections=sections->first; +// while (sections!=NULL){ +// IconSection *name=(IconSection*)sections->data; +// IVSections=yon_create_single_section_IV(name->section,name->categories); +// if (!IVDict) { +// IVDict=yon_dictionary_create_empty(); +// IVDict->key=name->section; +// IVDict->data=IVSections; +// IVDict->first=IVDict; +// } else { +// IVDict=yon_dictionary_create_conneced(IVDict); +// IVDict->key=name->section; +// IVDict->data=IVSections; +// } +// sections=sections->next; +// } +// IVDict->next=NULL; +// return IVDict->first; +// } + +// void yon_check_path(char *path){ +// FILE *fp; +// char *pth=malloc(255); +// memset(path,0,255); +// fp = popen("screenfetch -n -w -N", "r"); +// fgets(pth, 255,fp)!=NULL; +// } + +// dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ +// IconSection *sct=malloc(sizeof(IconSection)); +// sct->section=section_name; +// sct->categories=categories; +// if (!section->data&&!section->prev){ +// section->data=sct; +// section->first=section; +// section->key=section_name; +// } else { +// section=yon_dictionary_get_last(section); +// section->next=yon_dictionary_create_conneced(section); +// section->next->data=sct; +// section->next->key=section_name; +// section=section->next; +// } - int sz=1,szm=1; - if (main_config.Gnomeiconsize==64) sz=4; - else if (main_config.Gnomeiconsize==48) sz=3; - else if (main_config.Gnomeiconsize==32) sz=2; - else if (main_config.Gnomeiconsize==24) sz=1; - else sz=3; - if (main_config.Mainiconsize==64) szm=4; - else if (main_config.Mainiconsize==48) szm=3; - else if (main_config.Mainiconsize==32) szm=2; - else if (main_config.Mainiconsize==24) szm=1; - else szm=3; - char *fromint=malloc(5); - memset(fromint,0,5); - GError *err=NULL; - char *login=getlogin(); - if (geteuid()==0){ - login=main_config.lastUser; - } else { - main_config.lastUser=login; - } - char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); - sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); - g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); - if (err){ - struct stat st = {0}; - char *ptdir=malloc(36+strlen(getlogin())); - sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); - if (stat(ptdir, &st) == -1) { - mkdir(ptdir, 0777); - } - FILE *fp; - fp=fopen(pth,"w"); - fclose(fp); - } - g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); - if (main_config.fullscreen==0){ - sprintf(fromint,"%d",main_config.windowPosX); - g_key_file_set_string(gfile,"window","WindowPosX",fromint); - sprintf(fromint,"%d",main_config.windowPosY); - g_key_file_set_string(gfile,"window","WindowPosY",fromint); - sprintf(fromint,"%d",main_config.windowWidth); - g_key_file_set_string(gfile,"window","WindowWidth",fromint); - sprintf(fromint,"%d",main_config.windowHeight); - g_key_file_set_string(gfile,"window","WindowHeight",fromint); - } - g_key_file_set_boolean(gfile,"window","fullscreen",main_config.fullscreen); - g_key_file_set_boolean(gfile,"window","BannerHidden",main_config.BannerHidden); - g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick); - g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick); - sprintf(fromint,"%d",main_config.WindowTheme); - g_key_file_set_string(gfile,"window","WindowTheme",fromint); - sprintf(fromint,"%d",sz); - g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); - sprintf(fromint,"%d",szm); - g_key_file_set_string(gfile,"window","MainIconSize",fromint); - sprintf(fromint,"%d",main_config.iconSegmentSize); - g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); - sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); - g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); - sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); - g_key_file_set_string(gfile,"window","MainLabelSize",fromint); - sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); - g_key_file_set_string(gfile,"window","LabelDensity",fromint); - g_key_file_set_string(gfile,"window","User",login); - if (main_config.lock_settings==0) - g_key_file_save_to_file(gfile,pth,NULL); -} - -char *yon_cut(char *source, int size, int startpos){ - char *cut=NULL; - cut=malloc(size+1); - memset(cut,0,size+1); - memcpy(cut,source+startpos,size); - return cut; -} - -char *yon_char_divide(char *source, int dividepos){ - char *cut=malloc(dividepos+1); - memset(cut,0,dividepos+1); - memcpy(cut,source,dividepos); - char *left=malloc(strlen(source)-strlen(cut)); - memset(left,0,strlen(source)-strlen(cut)); - memcpy(left,source+dividepos+1,(strlen(source)-dividepos)); - memset(source,0,strlen(source)); - memcpy(source,left,strlen(left)); - return cut; -} - -char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){ - char *cut=strstr(source,dividepos); - int leng=strlen(source)-strlen(cut); - cut=yon_char_divide(source,leng); - return cut; -} - -void yon_set_default_sections(dictionary *section){ - yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;"); - yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;"); - yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;"); - yon_section_new(section,"Misc",""); -} - -IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ - IVGraphicals *IVG = malloc(sizeof(IVGraphicals)); - GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - GtkBuilder *builder = gtk_builder_new_from_resource(GladePath); - GtkWidget *iv = GTK_WIDGET(gtk_builder_get_object(builder,"iconTemplate")); - gtk_widget_show(iv); - GtkWidget *label = gtk_label_new(_(name)); - GtkCellRendererPixbuf *iconRender = GTK_CELL_RENDERER_PIXBUF(gtk_builder_get_object(builder, "iconPic")); - PangoAttrList *attrs = pango_attr_list_new(); - PangoFontDescription *descr = pango_font_description_new(); - pango_font_description_set_weight(descr,PANGO_WEIGHT_BOLD); - int stretch = main_config.labelDensity; - if (stretch>8) - stretch = 4; - pango_font_description_set_stretch(descr,main_config.labelDensity); - pango_attr_list_insert(attrs,pango_attr_size_new(*main_config.currentThemeLabelSize)); - pango_attr_list_insert(attrs, pango_attr_font_desc_new(descr)); - gtk_label_set_attributes(GTK_LABEL(label),attrs); - gtk_widget_set_margin_end(label,6); - gtk_widget_set_margin_start(label,6); - gtk_widget_set_margin_bottom(label,2); - gtk_icon_view_set_spacing(GTK_ICON_VIEW(iv),20); - if (main_config.WindowTheme==1) { - gtk_icon_view_set_columns(GTK_ICON_VIEW(iv),1); - gtk_widget_set_name(iv,"GnomeIcon"); - gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.GnomeDoubleClick); - gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); - } else { - gtk_icon_view_set_item_padding(GTK_ICON_VIEW(iv),3); - gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); - gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.MainDoubleClick); - gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(iv),2); - } - GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); - GtkListStore *lv=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststoreTemplate")); - gtk_widget_set_name(sep,"SepIcon"); - gtk_widget_set_halign(box,0); - gtk_widget_set_valign(box,1); - gtk_widget_set_margin_end(sep,6); - gtk_widget_set_margin_start(sep,6); - gtk_icon_view_set_model(GTK_ICON_VIEW(iv),GTK_TREE_MODEL(lv)); - gtk_label_set_xalign(GTK_LABEL(label),0); - gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,0); - gtk_box_pack_start(GTK_BOX(box),sep,FALSE,FALSE,0); - gtk_box_pack_start(GTK_BOX(box),iv,FALSE,FALSE,0); - IVG->sectionName=name; - IVG->categories=cats; - IVG->LV = lv; - IVG->Box = box; - IVG->IV = iv; - IVG->label = label; - IVG->sep = sep; - IVG->iconRender = iconRender; - return IVG; -} - -dictionary *yon_create_icon_section_list(dictionary *sections){ - if (!sections) - return NULL; - IVGraphicals *IVSections; - dictionary *IVDict=NULL; - sections=sections->first; - while (sections!=NULL){ - IconSection *name=(IconSection*)sections->data; - IVSections=yon_create_single_section_IV(name->section,name->categories); - if (!IVDict) { - IVDict=yon_dictionary_create_empty(); - IVDict->key=name->section; - IVDict->data=IVSections; - IVDict->first=IVDict; - } else { - IVDict=yon_dictionary_create_conneced(IVDict); - IVDict->key=name->section; - IVDict->data=IVSections; - } - sections=sections->next; - } - IVDict->next=NULL; - return IVDict->first; -} - -void yon_check_path(char *path){ - FILE *fp; - char *pth=malloc(255); - memset(path,0,255); - fp = popen("screenfetch -n -w -N", "r"); - fgets(pth, 255,fp)!=NULL; -} - -dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ - IconSection *sct=malloc(sizeof(IconSection)); - sct->section=section_name; - sct->categories=categories; - if (!section->data&&!section->prev){ - section->data=sct; - section->first=section; - section->key=section_name; - } else { - section=yon_dictionary_get_last(section); - section->next=yon_dictionary_create_conneced(section); - section->next->data=sct; - section->next->key=section_name; - section=section->next; - } - - return section; -} - -void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned){ - for (dictionary *dict=icdict->first;dict!=NULL;dict=dict->next){ - IVGraphicals *icv=(IVGraphicals*)dict->data; - int width=gtk_paned_get_position(GTK_PANED(paned)); - int pos=(int)((double)width-20); - if (pos < 100) pos=100; +// return section; +// } + +// void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned){ +// for (dictionary *dict=icdict->first;dict!=NULL;dict=dict->next){ +// IVGraphicals *icv=(IVGraphicals*)dict->data; +// int width=gtk_paned_get_position(GTK_PANED(paned)); +// int pos=(int)((double)width-20); +// if (pos < 100) pos=100; - gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),pos); - } -} - -char *yon_char_get_augumented(char *source, char *append){ - int size=strlen(source)+strlen(append)+1; - char *final=malloc(size); - memset(final,0,size); - sprintf(final,"%s%s",source,append); - return final; -} - -char *yon_char_new(char *chr){ - char *newchar=malloc(strlen(chr)+1); - memset(newchar,0,strlen(chr)+1); - memcpy(newchar,chr,strlen(chr)); - return newchar; -} - -int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets){ - for (dictionary *dct=IVS->first;dct!=NULL;dct=dct->next){ - IVGraphicals *iv=dct->data; - gtk_widget_show_all(iv->Box); - gtk_box_pack_start(GTK_BOX(widgets->icvpack),iv->Box,FALSE,FALSE,0); - if (main_config.WindowTheme==0) - g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_Item_activated),widgets); - else if (main_config.WindowTheme==1) - g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_gnome_Item_activated),widgets); - g_signal_connect(G_OBJECT(iv->IV),"selection-changed",G_CALLBACK(on_item_selection_changed),widgets); +// gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),pos); +// } +// } + +// int yon_show_icon_views(dictionary *IVS,main_window *widgets){ +// for (dictionary *dct=IVS->first;dct!=NULL;dct=dct->next){ +// IVGraphicals *iv=dct->data; +// gtk_widget_show_all(iv->Box); +// gtk_box_pack_start(GTK_BOX(widgets->icvpack),iv->Box,FALSE,FALSE,0); +// if (main_config.WindowTheme==0) +// g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_Item_activated),widgets); +// else if (main_config.WindowTheme==1) +// g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_gnome_Item_activated),widgets); +// g_signal_connect(G_OBJECT(iv->IV),"selection-changed",G_CALLBACK(on_item_selection_changed),widgets); - } -} - -dictionary *yon_dictionary_find(dictionary **dict, char *key){ - dictionary *dct=*dict; - for (dictionary *pointer=dct->first;pointer!=NULL;pointer=pointer->next){ - if (strcmp(pointer->key,key)==0){ - *dict=pointer; - return pointer; - } - } - return NULL; -} - -dictionary *yon_dictionary_rip(dictionary *dict){ - if (!dict->next){ - dictionary *prev=dict->prev; - if (prev){ - prev->next=NULL; - return prev; - } else return dict; - } - else if (!dict->prev){ - dictionary *next=dict->next; - if (next){ - yon_dictionary_make_first(next); - next->prev=NULL; - return next; - } - else return dict; - } - else { - dictionary *next=dict->next, *prev=dict->prev; - next->prev=prev; - prev->next=next; - return next; - } -} - -dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect){ - dictionary *dict=yon_dictionary_get_last(old); - dict->next=toconnect; - toconnect->prev=dict; - toconnect->first=dict->first; - return toconnect; -} +// } +// } -void yon_switch_theme(dictionary **dict, dictionary *newone){ - dictionary *dct=*dict; - actionWidgets *widgets=(actionWidgets*)dct->data; +// void yon_switch_theme(dictionary **dict, dictionary *newone){ +// dictionary *dct=*dict; +// main_window *widgets=(main_window*)dct->data; - gtk_widget_hide(widgets->window); - *dict=newone; - dct=*dict; - widgets=(actionWidgets*)dct->data; - gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); - gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); - if (strcmp(dct->key,"Gnome")==0){ - main_config.currentThemeIconSize=&main_config.Gnomeiconsize; - main_config.currentThemeLabelSize=&main_config.GnomelabelSize; - int x,y; - GdkRectangle workarea; - gdk_monitor_get_workarea(gdk_display_get_monitor(gdk_screen_get_display(gtk_window_get_screen(GTK_WINDOW(widgets->window))),0),&workarea); - gtk_window_get_size(GTK_WINDOW(widgets->window),&x, &y); - if (workarea.width<1240&&workarea.height<720){ - gtk_widget_show(widgets->CautionWindow); - dictionary *founddict=yon_dictionary_find(dict,"Main"); - dct=yon_dictionary_find(dict,"Gnome"); - yon_switch_theme(&dct,founddict); - gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); - gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); - main_config.WindowTheme=0; - main_config.curThemeName="Main"; - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),0); - gtk_window_present(GTK_WINDOW(widgets->CautionWindow)); - }else{ - main_config.WindowTheme=1; - main_config.curThemeName="Gnome"; - gtk_widget_show(widgets->window); - gtk_widget_hide(widgets->MenuItemAboutSystem); - } +// gtk_widget_hide(widgets->window); +// *dict=newone; +// dct=*dict; +// widgets=(main_window*)dct->data; +// gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); +// gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); +// if (strcmp(dct->key,"Gnome")==0){ +// main_config.currentThemeIconSize=&main_config.Gnomeiconsize; +// main_config.currentThemeLabelSize=&main_config.GnomelabelSize; +// int x,y; +// GdkRectangle workarea; +// gdk_monitor_get_workarea(gdk_display_get_monitor(gdk_screen_get_display(gtk_window_get_screen(GTK_WINDOW(widgets->window))),0),&workarea); +// gtk_window_get_size(GTK_WINDOW(widgets->window),&x, &y); +// if (workarea.width<1240&&workarea.height<720){ +// gtk_widget_show(widgets->CautionWindow); +// dictionary *founddict=yon_dictionary_find(dict,"Main"); +// dct=yon_dictionary_find(dict,"Gnome"); +// yon_switch_theme(&dct,founddict); +// gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); +// gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); +// main_config.WindowTheme=0; +// main_config.curThemeName="Main"; +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),0); +// gtk_window_present(GTK_WINDOW(widgets->CautionWindow)); +// }else{ +// main_config.WindowTheme=1; +// main_config.curThemeName="Gnome"; +// gtk_widget_show(widgets->window); +// gtk_widget_hide(widgets->MenuItemAboutSystem); +// } - } else { - main_config.currentThemeIconSize=&main_config.Mainiconsize; - main_config.currentThemeLabelSize=&main_config.MainlabelSize; - gtk_widget_show(widgets->window); - main_config.WindowTheme=0; - main_config.curThemeName="Main"; - gtk_widget_show(widgets->MenuItemAboutSystem); - } +// } else { +// main_config.currentThemeIconSize=&main_config.Mainiconsize; +// main_config.currentThemeLabelSize=&main_config.MainlabelSize; +// gtk_widget_show(widgets->window); +// main_config.WindowTheme=0; +// main_config.curThemeName="Main"; +// gtk_widget_show(widgets->MenuItemAboutSystem); +// } -} - -int yon_get_icon_size(int size){ - if (size==1||size==24) return 24; - if (size==2||size==32) return 32; - if (size==3||size==48) return 48; - if (size==4||size==64) return 64; -} - -void yon_icon_size_convert(int mode){ - if (mode==0){ - if (*main_config.currentThemeIconSize==1) *main_config.currentThemeIconSize=24; - if (*main_config.currentThemeIconSize==2) *main_config.currentThemeIconSize=32; - if (*main_config.currentThemeIconSize==3) *main_config.currentThemeIconSize=48; - if (*main_config.currentThemeIconSize==4) *main_config.currentThemeIconSize=64; - } else if (mode==1){ - if (*main_config.currentThemeIconSize==24) *main_config.currentThemeIconSize=1; - if (*main_config.currentThemeIconSize==32) *main_config.currentThemeIconSize=2; - if (*main_config.currentThemeIconSize==48) *main_config.currentThemeIconSize=3; - if (*main_config.currentThemeIconSize==64) *main_config.currentThemeIconSize=4; - } -} - -SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ - SectionSettingSegment *segment=malloc(sizeof(SectionSettingSegment)); - segment->MainFrame=gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(segment->MainFrame),GTK_SHADOW_IN); - segment->MainBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - segment->ElemBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - gtk_widget_set_size_request(segment->ElemBox,0,20); - segment->DragButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - gtk_widget_set_name(segment->DragButtonBox,"noborders"); - segment->DragUpButton=gtk_button_new_from_icon_name("go-top-symbolic",GTK_ICON_SIZE_BUTTON); - segment->DragDownButton=gtk_button_new_from_icon_name("go-bottom-symbolic",GTK_ICON_SIZE_BUTTON); - segment->NameBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - segment->CategoriesBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - segment->OptionBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - segment->NameEntry=gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),name); - segment->NameLabel=gtk_label_new(name); - segment->CategoriesEntry=gtk_entry_new(); - if (categories[strlen(categories)-1]!=';'){ - categories=yon_char_get_augumented(categories,";"); - } - gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),categories); - segment->CategoriesLabel=gtk_label_new(categories); - segment->EditButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - segment->EditButtonAccept=gtk_button_new_from_icon_name("emblem-ok-symbolic",GTK_ICON_SIZE_BUTTON); - segment->EditButtonCancel=gtk_button_new_from_icon_name("process-stop-symbolic",GTK_ICON_SIZE_BUTTON); - segment->ButtonEdit=gtk_button_new_from_icon_name("document-edit-symbolic",GTK_ICON_SIZE_BUTTON); - segment->DeleditBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete-symbolic",GTK_ICON_SIZE_BUTTON); - - gtk_widget_set_name(segment->NameLabel,"SegName"); - gtk_widget_set_name(segment->CategoriesLabel,"SegCat"); - - gtk_container_add(GTK_CONTAINER(segment->MainFrame),segment->MainBox); - - gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->DragButtonBox,FALSE,FALSE,0); - gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->ElemBox,TRUE,TRUE,0); - - gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragUpButton,FALSE,FALSE,0); - gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragDownButton,FALSE,FALSE,0); - - gtk_box_pack_start(GTK_BOX(segment->ElemBox),segment->NameBox,FALSE,FALSE,0); - gtk_box_pack_end(GTK_BOX(segment->ElemBox),segment->CategoriesBox,FALSE,FALSE,0); - - gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->OptionBox,FALSE,FALSE,0); +// } + +// int yon_get_icon_size(int size){ +// if (size==1||size==24) return 24; +// if (size==2||size==32) return 32; +// if (size==3||size==48) return 48; +// if (size==4||size==64) return 64; +// } + +// void yon_icon_size_convert(int mode){ +// if (mode==0){ +// if (*main_config.currentThemeIconSize==1) *main_config.currentThemeIconSize=24; +// if (*main_config.currentThemeIconSize==2) *main_config.currentThemeIconSize=32; +// if (*main_config.currentThemeIconSize==3) *main_config.currentThemeIconSize=48; +// if (*main_config.currentThemeIconSize==4) *main_config.currentThemeIconSize=64; +// } else if (mode==1){ +// if (*main_config.currentThemeIconSize==24) *main_config.currentThemeIconSize=1; +// if (*main_config.currentThemeIconSize==32) *main_config.currentThemeIconSize=2; +// if (*main_config.currentThemeIconSize==48) *main_config.currentThemeIconSize=3; +// if (*main_config.currentThemeIconSize==64) *main_config.currentThemeIconSize=4; +// } +// } + +// SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ +// SectionSettingSegment *segment=malloc(sizeof(SectionSettingSegment)); +// segment->MainFrame=gtk_frame_new(NULL); +// gtk_frame_set_shadow_type(GTK_FRAME(segment->MainFrame),GTK_SHADOW_IN); +// segment->MainBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// segment->ElemBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// gtk_widget_set_size_request(segment->ElemBox,0,20); +// segment->DragButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// gtk_widget_set_name(segment->DragButtonBox,"noborders"); +// segment->DragUpButton=gtk_button_new_from_icon_name("go-top-symbolic",GTK_ICON_SIZE_BUTTON); +// segment->DragDownButton=gtk_button_new_from_icon_name("go-bottom-symbolic",GTK_ICON_SIZE_BUTTON); +// segment->NameBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// segment->CategoriesBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// segment->OptionBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// segment->NameEntry=gtk_entry_new(); +// gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),name); +// segment->NameLabel=gtk_label_new(name); +// segment->CategoriesEntry=gtk_entry_new(); +// if (categories[strlen(categories)-1]!=';'){ +// categories=yon_char_get_augumented(categories,";"); +// } +// gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),categories); +// segment->CategoriesLabel=gtk_label_new(categories); +// segment->EditButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// segment->EditButtonAccept=gtk_button_new_from_icon_name("emblem-ok-symbolic",GTK_ICON_SIZE_BUTTON); +// segment->EditButtonCancel=gtk_button_new_from_icon_name("process-stop-symbolic",GTK_ICON_SIZE_BUTTON); +// segment->ButtonEdit=gtk_button_new_from_icon_name("document-edit-symbolic",GTK_ICON_SIZE_BUTTON); +// segment->DeleditBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); +// segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete-symbolic",GTK_ICON_SIZE_BUTTON); + +// gtk_widget_set_name(segment->NameLabel,"SegName"); +// gtk_widget_set_name(segment->CategoriesLabel,"SegCat"); + +// gtk_container_add(GTK_CONTAINER(segment->MainFrame),segment->MainBox); + +// gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->DragButtonBox,FALSE,FALSE,0); +// gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->ElemBox,TRUE,TRUE,0); + +// gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragUpButton,FALSE,FALSE,0); +// gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragDownButton,FALSE,FALSE,0); + +// gtk_box_pack_start(GTK_BOX(segment->ElemBox),segment->NameBox,FALSE,FALSE,0); +// gtk_box_pack_end(GTK_BOX(segment->ElemBox),segment->CategoriesBox,FALSE,FALSE,0); + +// gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->OptionBox,FALSE,FALSE,0); - gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameEntry,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameLabel,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameEntry,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameLabel,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesEntry,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesLabel,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesEntry,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesLabel,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonAccept,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonCancel,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonAccept,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonCancel,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonEdit,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonDelete,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonEdit,FALSE,FALSE,5); +// gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonDelete,FALSE,FALSE,5); - gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->DeleditBox,FALSE,FALSE,0); - gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->EditButtonBox,FALSE,FALSE,0); +// gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->DeleditBox,FALSE,FALSE,0); +// gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->EditButtonBox,FALSE,FALSE,0); - gtk_widget_set_size_request(segment->NameLabel,60,10); +// gtk_widget_set_size_request(segment->NameLabel,60,10); - gtk_widget_set_margin_start(segment->DragButtonBox,5); - gtk_widget_set_margin_end(segment->OptionBox,5); - gtk_widget_set_margin_bottom(segment->MainFrame,3); - gtk_widget_set_margin_bottom(segment->DragButtonBox,3); - gtk_widget_set_margin_top(segment->DragButtonBox,3); - gtk_widget_set_margin_end(segment->DragUpButton,3); +// gtk_widget_set_margin_start(segment->DragButtonBox,5); +// gtk_widget_set_margin_end(segment->OptionBox,5); +// gtk_widget_set_margin_bottom(segment->MainFrame,3); +// gtk_widget_set_margin_bottom(segment->DragButtonBox,3); +// gtk_widget_set_margin_top(segment->DragButtonBox,3); +// gtk_widget_set_margin_end(segment->DragUpButton,3); - gtk_widget_set_halign(segment->NameEntry,GTK_ALIGN_START); - gtk_widget_set_halign(segment->NameLabel,GTK_ALIGN_END); - gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); - gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); +// gtk_widget_set_halign(segment->NameEntry,GTK_ALIGN_START); +// gtk_widget_set_halign(segment->NameLabel,GTK_ALIGN_END); +// gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); +// gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); - gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); - gtk_widget_set_valign(segment->ElemBox,GTK_ALIGN_CENTER); - gtk_label_set_xalign(GTK_LABEL(segment->NameLabel),0); - gtk_label_set_xalign(GTK_LABEL(segment->CategoriesLabel),0); +// gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); +// gtk_widget_set_valign(segment->ElemBox,GTK_ALIGN_CENTER); +// gtk_label_set_xalign(GTK_LABEL(segment->NameLabel),0); +// gtk_label_set_xalign(GTK_LABEL(segment->CategoriesLabel),0); - gtk_widget_set_vexpand(segment->ElemBox,0); - gtk_widget_set_vexpand(segment->NameBox,0); - gtk_widget_set_vexpand(segment->CategoriesBox,0); - gtk_widget_set_vexpand(segment->NameEntry,0); - gtk_widget_set_vexpand(segment->NameLabel,0); - gtk_widget_set_vexpand(segment->CategoriesEntry,0); - gtk_widget_set_vexpand(segment->CategoriesLabel,0); - gtk_widget_show_all(segment->MainFrame); - gtk_widget_hide(segment->NameEntry); - gtk_widget_hide(segment->CategoriesEntry); - gtk_widget_hide(segment->EditButtonBox); - return segment; -} - -dictionary *yon_dictionary_create_empty(){ - dictionary *dict=malloc(sizeof(dictionary)); - dict->data=NULL; - dict->key=NULL; - dict->next=NULL; - dict->prev=NULL; - dict->first=dict; - return dict; -} - -void yon_dictionary_switch_to_last(dictionary **dict){ - if ((*dict)->next!=NULL) - for ((*dict)=(*dict)->first;(*dict)->next!=NULL;(*dict)=(*dict)->next){} -} - -dictionary * yon_dictionary_create_conneced(dictionary *targetdict){ - yon_dictionary_switch_to_last(&targetdict); - targetdict->next=yon_dictionary_create_empty(); - targetdict->next->prev=targetdict; - targetdict->next->first=targetdict->first; - return targetdict->next; -} - -char *yon_char_from_int(int int_to_convert) -{ - int i = 1; - float convert_check = (float)int_to_convert; - for (i = 1; convert_check > 10; i++) - { - convert_check = convert_check / 10; - } - char *ch = malloc(i * sizeof(char) + 1); - sprintf(ch, "%d", int_to_convert); - return ch; -}; - -void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm){ - gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); - g_signal_connect(G_OBJECT(sgm->ButtonEdit),"clicked",G_CALLBACK(on_sections_edit), widgets); - g_signal_connect(G_OBJECT(sgm->EditButtonAccept),"clicked",G_CALLBACK(on_sections_accept), widgets); - g_signal_connect(G_OBJECT(sgm->EditButtonCancel),"clicked",G_CALLBACK(on_sections_cancel), widgets); - g_signal_connect(G_OBJECT(sgm->DragUpButton),"clicked",G_CALLBACK(on_sections_move_up), widgets); - g_signal_connect(G_OBJECT(sgm->DragDownButton),"clicked",G_CALLBACK(on_sections_move_down), widgets); - g_signal_connect(G_OBJECT(sgm->ButtonDelete),"clicked",G_CALLBACK(on_section_delete), widgets); +// gtk_widget_set_vexpand(segment->ElemBox,0); +// gtk_widget_set_vexpand(segment->NameBox,0); +// gtk_widget_set_vexpand(segment->CategoriesBox,0); +// gtk_widget_set_vexpand(segment->NameEntry,0); +// gtk_widget_set_vexpand(segment->NameLabel,0); +// gtk_widget_set_vexpand(segment->CategoriesEntry,0); +// gtk_widget_set_vexpand(segment->CategoriesLabel,0); +// gtk_widget_show_all(segment->MainFrame); +// gtk_widget_hide(segment->NameEntry); +// gtk_widget_hide(segment->CategoriesEntry); +// gtk_widget_hide(segment->EditButtonBox); +// return segment; +// } + +// void yon_segment_show(main_window *widgets, SectionSettingSegment *sgm){ +// gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); +// g_signal_connect(G_OBJECT(sgm->ButtonEdit),"clicked",G_CALLBACK(on_sections_edit), widgets); +// g_signal_connect(G_OBJECT(sgm->EditButtonAccept),"clicked",G_CALLBACK(on_sections_accept), widgets); +// g_signal_connect(G_OBJECT(sgm->EditButtonCancel),"clicked",G_CALLBACK(on_sections_cancel), widgets); +// g_signal_connect(G_OBJECT(sgm->DragUpButton),"clicked",G_CALLBACK(on_sections_move_up), widgets); +// g_signal_connect(G_OBJECT(sgm->DragDownButton),"clicked",G_CALLBACK(on_sections_move_down), widgets); +// g_signal_connect(G_OBJECT(sgm->ButtonDelete),"clicked",G_CALLBACK(on_section_delete), widgets); -} - -void yon_segments_show(actionWidgets *widgets){ - if(widgets->SettingsSections) - for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){ - SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; - if (sgm!=NULL) - - gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); - else return; - } -}; +// } + +// void yon_segments_show(main_window *widgets){ +// if(widgets->SettingsSections) +// for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){ +// SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; +// if (sgm!=NULL) + +// gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); +// else return; +// } +// }; + +// void yon_segments_hide(main_window *widgets){ +// if(main_config.SettingsSections) +// for (dictionary *dict=main_config.SettingsSections->first;dict!=NULL;dict=dict->next){ +// SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; +// if (sgm!=NULL){ +// g_object_ref(G_OBJECT(sgm->MainFrame)); +// gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),sgm->MainFrame); +// } else return; +// } +// } + +// void yon_main_quit(GtkWidget *,GdkEvent*,main_window *widgets){ +// if (widgets->socket){ +// g_signal_handlers_disconnect_by_func(widgets->socket,on_plug_removed,widgets); +// } +// gtk_main_quit(); +// } + +void confugure_setings_window(main_window *widgets){ -void yon_segments_hide(actionWidgets *widgets){ - if(main_config.SettingsSections) - for (dictionary *dict=main_config.SettingsSections->first;dict!=NULL;dict=dict->next){ - SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; - if (sgm!=NULL){ - g_object_ref(G_OBJECT(sgm->MainFrame)); - gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),sgm->MainFrame); - } else return; - } -} - -void yon_dictionary_make_first(dictionary *dict){ - for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ - dct->first=dict; - } -} -void yon_dictionary_make_nth(dictionary *dict, int nth){ - dictionary *dct=dict->first; - for (int i=0;inext;} - yon_dictionary_rip(dict); - dictionary *prev=dct->prev; - prev->next=dict; - dict->prev=prev; - dict->next=dct; - dct->prev=dict; } -dictionary *yon_dictionary_create_with_data(char *key, void *data){ - dictionary *dct=yon_dictionary_create_empty(); - dct->key=key; - dct->data=data; - return dct; -} +void yon_interface_update(main_window *widgets){ + if (main_config.sections) yon_dictionary_free_all(main_config.sections,free); -dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data){ - dictionary *dct=yon_dictionary_create_conneced(dict); - dct->key=key; - dct->data=data; - return dct; -} + gsize size; + config_str section_settings = yon_window_config_get_section("Sections",&size); -dictionary *yon_dictionary_switch_places(dictionary *dict,int aim){ - if (aim<0){ - if (dict->prev){ - if (dict->prev->prev){ - dictionary *next = dict->next,*prev=dict->prev,*preprev=prev->prev; - if (next){ - preprev->next=dict; - dict->prev=preprev; - dict->next=prev; - prev->prev=dict; - prev->next=next; - next->prev=prev; - } else { - preprev->next=dict; - dict->prev=preprev; - dict->next=prev; - prev->prev=dict; - prev->next=NULL; - } - return prev; - } else { - dictionary *next = dict->next,*prev=dict->prev; - if (next){ - yon_dictionary_make_first(dict); - dict->prev=NULL; - dict->next=prev; - prev->prev=dict; - prev->next=next; - next->prev=prev; - } else { - dict->prev=NULL; - dict->next=prev; - prev->prev=dict; - prev->next=NULL; - } - return prev; - } + if (size){ + for (gsize i=0;iname = yon_char_new(section_settings[i]); + char *categories = NULL; + yon_window_config_get_parameter("Sections",cur_section->name,&categories,YON_TYPE_STRING); + cur_section->categories = yon_char_parse(categories,&cur_section->categories_size,";"); + yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section); } - } else if (aim>0){ - if (dict->next){ - if (dict->next->next){ - dictionary *next = dict->next,*prev=dict->prev,*afnext=next->next; - if (prev){ - prev->next=next; - next->prev=prev; - next->next=dict; - dict->prev=next; - dict->next=afnext; - afnext->prev=dict; - } else { - yon_dictionary_make_first(next); - next->prev=NULL; - next->next=dict; - dict->prev=next; - dict->next=afnext; - afnext->prev=dict; - } - return next; - } else { - dictionary *next = dict->next,*prev=dict->prev; - if (prev){ - prev->next=next; - next->prev=prev; - next->next=dict; - dict->prev=next; - dict->next=NULL; - } else { - next->prev=NULL; - next->next=dict; - dict->prev=next; - dict->next=NULL; - } - } + } else { + { + app_section *cur_section = yon_app_section_new(); + cur_section->name = yon_char_new("Personal"); + cur_section->categories = yon_char_parse("X-UBL-SettingsManager;X-UBL-PersonalSettings;",&cur_section->categories_size,";"); + yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section); + } + { + app_section *cur_section = yon_app_section_new(); + cur_section->name = yon_char_new("Hardware"); + cur_section->categories = yon_char_parse("X-UBL-SettingsManager;X-UBL-HardwareSettings;",&cur_section->categories_size,";"); + yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section); + } + { + app_section *cur_section = yon_app_section_new(); + cur_section->name = yon_char_new("System"); + cur_section->categories = yon_char_parse("X-UBL-SettingsManager;X-UBL-SystemSettings;",&cur_section->categories_size,";"); + yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section); + } + { + app_section *cur_section = yon_app_section_new(); + cur_section->name = yon_char_new("Misc"); + cur_section->categories = yon_char_parsed_new(&cur_section->categories_size,"",NULL); + yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section); } } } -dictionary *yon_dictionary_get_last(dictionary *dict){ - dictionary *dct=NULL; - for (dct=dict->first;dct->next!=NULL;dct=dct->next){} - return dct; -} -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(); -} +main_window *yon_main_window_setup(){ + main_window *widgets = malloc(sizeof(main_window)); -void confugure_setings_window(actionWidgets *widgets){ + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); + widgets->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + widgets->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel"); + widgets->ThemeBox = yon_gtk_builder_get_widget(builder,"ThemeBox"); + widgets->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox"); + widgets->SettingsButton = yon_gtk_builder_get_widget(builder,"SettingsButton"); + widgets->BannerImage = yon_gtk_builder_get_widget(builder,"BannerImage"); + widgets->BannerRevealer = yon_gtk_builder_get_widget(builder,"BannerRevealer"); + widgets->BannerButton = yon_gtk_builder_get_widget(builder,"BannerButton"); + widgets->BannerArrow = yon_gtk_builder_get_widget(builder,"BannerArrow"); -} + yon_apps_init(); -dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize){ - - dictionary *widgets=*widgetss; - actionWidgets *curWidgets=(actionWidgets*)widgets->data; - if (curWidgets==NULL) { - curWidgets=malloc(sizeof(actionWidgets)); - widgets->data=curWidgets; - } - widgets->key=theme_id; - curWidgets->builder=builder; - curWidgets->window=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Window"))); - curWidgets->DesktopBasic=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"HideWhileLaunch"))); - curWidgets->DesktopSocket=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketplace"))); - curWidgets->ButtonBackToMain=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"backToSettingsButton"))); - curWidgets->appSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"appSettings"))); - curWidgets->socketplace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketplace"))); - curWidgets->HideWhileLaunch=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"HideWhileLaunch"))); - curWidgets->workingwindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"workingwindow"))); - curWidgets->icvpack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"icvpack"))); - curWidgets->GnomePaned=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Paned"))); - curWidgets->GnomeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoLabel"))); - curWidgets->GnomeInfoDetailsLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoDetailsLabel"))); - curWidgets->socketbuttonplace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketbuttonplace"))); - curWidgets->Overlay=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Overlay"))); - curWidgets->ThirdSocketPlace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"ThirdSocketPlace"))); - curWidgets->MenuItemSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemSettings"))); - curWidgets->MenuItemDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemDocumentation"))); - curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemAbout"))); - curWidgets->BannerRevealer=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"RevealButton"))); - 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); - } - if (main_config.lock_settings==1){ - gtk_widget_set_sensitive(curWidgets->MenuItemSettings,0); - } - gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview"); - 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); - if (curWidgets->GnomePaned!=NULL){ - gtk_paned_set_position(GTK_PANED(curWidgets->GnomePaned),main_config.iconSegmentSize); - g_signal_connect(G_OBJECT(curWidgets->GnomePaned), "notify::position", G_CALLBACK(on_paned_move), curWidgets); + g_signal_connect(G_OBJECT(widgets->BannerButton),"clicked",G_CALLBACK(on_reveal_banner),widgets); + yon_window_config_setup(GTK_WINDOW(widgets->Window)); + char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL); + yon_window_config_load(path); + free(path); + { + int banner_hidden = 0; + yon_window_config_get_parameter("Settings","HideBanner", &banner_hidden,YON_TYPE_BOOLEAN); + gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),!banner_hidden?GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT:GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT); + gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->BannerRevealer),!banner_hidden); + gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerArrow),!banner_hidden?GTK_ARROW_LEFT:GTK_ARROW_RIGHT); } - g_signal_connect(G_OBJECT(curWidgets->window), "configure-event", G_CALLBACK(on_resized), 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); - gtk_window_move(GTK_WINDOW(curWidgets->window),main_config.windowPosX,main_config.windowPosY); - // Standard for all themes - - curWidgets->settingsThemeChooser=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsThemeChooser")); - curWidgets->SettingsWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SettingsWindow")); - curWidgets->DialogOpenDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"HelpSureWindow")); - curWidgets->CancelHelpButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CancelHelpButton")); - curWidgets->ReadHelpButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"ReadHelpButton")); - curWidgets->AlwaysOpenDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"AlwaysOpenHelpCheckbox")); - curWidgets->helpHeader=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"helpHeader")); - curWidgets->helpText=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"helpText")); - curWidgets->settingsSizeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSizeInfoLabel")); - curWidgets->settingsIcon=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsIcon")); - curWidgets->SectionSettingsWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsWindow")); - curWidgets->SectionSettingsPack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsPack")); - curWidgets->settingsSizeSlider=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSizeSlider")); - curWidgets->settingsAccept=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsAccept")); - curWidgets->settingsCancel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsCancel")); - curWidgets->settingsSubmenuLabelSize=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSubmenuLabelSize")); - curWidgets->settingsSubmenuLabelTheme=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSubmenuLabelTheme")); - curWidgets->settingsSectionsSettingsButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSectionsSettingsButton")); - curWidgets->SectionSettingAddButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddButton")); - curWidgets->SectionSettingAddNameEntry=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddNameEntry")); - curWidgets->SectionSettingAddCategoriesEntry=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddCategoriesEntry")); - curWidgets->SectionSettingsClearEntryButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsClearEntryButton")); - curWidgets->SectionSettingsSaveButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsSaveButton")); - curWidgets->SectionSettingsCloseButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsCloseButton")); - curWidgets->CautionWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CautionWindow")); - curWidgets->CautionUnderstandButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CautionUnderstandButton")); - curWidgets->infoWarningWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"windowSettings-infoWarning")); - curWidgets->infoWarningButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"buttonSettings-infoWarning")); - curWidgets->infoWarningLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"labelSettings-infoWarning")); - curWidgets->settingsDoubleClickSwitch=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsDoubleClickSwitch")); - curWidgets->settingsDoubleClickLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsDoubleClickLabel")); - curWidgets->applist=applist; - curWidgets->appssize=appsize; - GtkIconTheme *icthm=gtk_icon_theme_get_default(); - gtk_widget_set_size_request(curWidgets->window,800,600); - gtk_window_resize(GTK_WINDOW(curWidgets->window),main_config.windowWidth,main_config.windowHeight); - gtk_window_set_icon(GTK_WINDOW(curWidgets->window),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - gtk_window_set_icon(GTK_WINDOW(curWidgets->SectionSettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - g_signal_connect(G_OBJECT(curWidgets->MenuItemDocumentation), "activate", G_CALLBACK(on_ButtonOpenHelp_activated), curWidgets->builder); //on_ButtonOpenHelp_activated - g_signal_connect(G_OBJECT(curWidgets->MenuItemSettings), "activate", G_CALLBACK(on_settingsOpen), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->BannerRevealer), "clicked", G_CALLBACK(on_reveal_banner), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->MenuItemAboutSystem), "activate", G_CALLBACK(on_about), curWidgets->builder); - - if (gnld==0){ - gnld=1; - g_signal_connect(G_OBJECT(curWidgets->settingsThemeChooser), "changed", G_CALLBACK(on_theme_selection_changed), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->CancelHelpButton), "clicked", G_CALLBACK(on_CancelHelpButton_activated), curWidgets->builder); - g_signal_connect(G_OBJECT(curWidgets->ReadHelpButton), "clicked", G_CALLBACK(on_ReadHelpButton_activated), curWidgets->builder); - g_signal_connect(G_OBJECT(curWidgets->settingsSizeSlider), "value-changed", G_CALLBACK(on_settings_icon_size_changed), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->settingsCancel), "clicked", G_CALLBACK(on_settings_cancel), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->settingsAccept), "clicked", G_CALLBACK(on_settings_accept), widgetss); - g_signal_connect(G_OBJECT(curWidgets->SectionSettingAddButton), "clicked", G_CALLBACK(on_sections_add), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->SectionSettingsClearEntryButton), "clicked", G_CALLBACK(on_sections_new_clear), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->SectionSettingsCloseButton), "clicked", G_CALLBACK(on_sections_close), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->SectionSettingsSaveButton), "clicked", G_CALLBACK(on_sections_save), widgets); - g_signal_connect(G_OBJECT(curWidgets->CautionUnderstandButton), "clicked", G_CALLBACK(on_caution_understand), curWidgets); - g_signal_connect(G_OBJECT(curWidgets->settingsSectionsSettingsButton), "clicked", G_CALLBACK(on_section_settings_open), widgets); - 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), "delete-event", G_CALLBACK(yon_main_quit), curWidgets); + + gtk_widget_show(widgets->Window); + widgets->current_theme = yon_theme_update(widgets); + yon_interface_update(widgets); + widgets->current_theme->list_update_func(widgets->current_theme); return widgets; } int main(int argc, char *argv[]){ - local=setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); textdomain (LocaleName); static struct option long_options[] = { {"lock-settings", 0, 0, 'l'}, @@ -1796,112 +1410,18 @@ int main(int argc, char *argv[]){ if (socket_find=='l') main_config.lock_settings=1; if (socket_find=='h') { - printf("%s\n",cmdHelpText); + printf("%s\n",HELP_LABEL(NULL)); exit(0); } if (socket_find=='v') { - printf("%s\n",cmdVersionText); + printf("%s\n",VERSION_LABEL); exit(0); } } gtk_init(&argc, &argv); - if (setup_config()==0){ - printf(CONFIG_LOAD_ERROR); - return -1; - } - actionWidgets *widget=NULL; - widget=malloc(sizeof(actionWidgets)); - dictionary *widgets=yon_dictionary_create_empty(); - widgets->data=widget; - int *size=malloc(sizeof(int)); - apps *applist=find_apps(size); - sort_apps(applist,*size); - GtkBuilder *builder=gtk_builder_new_from_resource(GladePath); - actionWidgets *widg=(actionWidgets*)widgets->first->data; - char *theme; - if (main_config.WindowTheme==1){ theme="Gnome"; - yon_theme_new(&widgets->first, builder,theme,applist,*size); - widg->applist=applist; - widg->appssize=*size; - widg->ICSys=yon_create_icon_section_list(main_config.sections); - for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ - load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); - } - yon_show_icon_views(widg->ICSys,widg); - yon_icv_resize_item(widg->ICSys,widg->GnomePaned); - theme="Main"; - main_config.WindowTheme=0; - widgets->next=yon_dictionary_create_empty(); - widgets->next->first=widgets; - widgets->next->prev=widgets; - yon_theme_new(&widgets->next, builder,theme,applist,*size); - widg=(actionWidgets*)widgets->next->data; - widg->applist=applist; - widg->appssize=*size; - widg->ICSys=yon_create_icon_section_list(main_config.sections); - main_config.currentThemeIconSize=&main_config.Mainiconsize; - main_config.currentThemeLabelSize=&main_config.MainlabelSize; - for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ - load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); - } - yon_show_icon_views(widg->ICSys,widg); - main_config.WindowTheme=1; - main_config.currentThemeIconSize=&main_config.Gnomeiconsize; - main_config.currentThemeLabelSize=&main_config.GnomelabelSize; - } - else { - theme="Main"; - yon_theme_new(&widgets->first, builder,theme,applist,*size); - widg->applist=applist; - widg->appssize=*size; - widg->ICSys=yon_create_icon_section_list(main_config.sections); - for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ - load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); - } - yon_show_icon_views(widg->ICSys,widg); - theme="Gnome"; - main_config.WindowTheme=1; - widgets->next=yon_dictionary_create_empty(); - widgets->next->first=widgets; - widgets->next->prev=widgets; - yon_theme_new(&widgets->next, builder,theme,applist,*size); - widg=(actionWidgets*)widgets->next->data; - widg->applist=applist; - widg->appssize=*size; - main_config.currentThemeIconSize=&main_config.Gnomeiconsize; - main_config.currentThemeLabelSize=&main_config.GnomelabelSize; - widg->ICSys=yon_create_icon_section_list(main_config.sections); - for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ - load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); - } - yon_show_icon_views(widg->ICSys,widg); - main_config.WindowTheme=0; - yon_icv_resize_item(widg->ICSys,widg->GnomePaned); - main_config.currentThemeIconSize=&main_config.Mainiconsize; - main_config.currentThemeLabelSize=&main_config.MainlabelSize; - } - if (geteuid()==0){ - } - gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widg->settingsThemeChooser),NULL,_("Standard theme")); - gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widg->settingsThemeChooser),NULL,_("GNOME theme")); - widg=(actionWidgets*)widgets->data; - if (main_config.fullscreen==1) - gtk_window_maximize(GTK_WINDOW(widg->window)); - gtk_widget_show(widg->window); - hide_if_unfound(widgets); - if (main_config.WindowTheme==1) - gtk_widget_hide(widg->MenuItemAboutSystem); - GtkWidget *banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"MainBanner")); - gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_resource(AppBannerPath,NULL)); - banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"GnomeBanner")); - gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_resource(AppBannerPath,NULL)); - banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"loaderBanner")); - gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_resource(AppBannerPath,NULL)); - banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"GnomeInfoLogo")); - gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(gtk_icon_theme_get_default(), AppIconPath,512,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"settingsIcon")); - GtkIconTheme *icthm=gtk_icon_theme_get_default(); - gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + config_init(); + main_window *widgets = yon_main_window_setup(); + GtkCssProvider *css=gtk_css_provider_new(); gtk_css_provider_load_from_resource(css,CssPath); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), @@ -1909,5 +1429,4 @@ int main(int argc, char *argv[]){ -1); gtk_main(); -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index a34bc4c..bd1b3a5 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -20,18 +20,23 @@ #include #include #include +#include +#include +#include #ifdef WEBKIT_FOUND #include #endif +#include "ubl-strings.h" #define UBLINUX_WIKI_COMMAND "xdg-open https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-manager" #define UBLINUX_WIKI_LINK " https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-manager" #define check_web2kit_command "ldconfig -p |grep webkit2" -#define cmdVersionText yon_char_get_augumented(yon_char_get_augumented(_("Version: "),version_application),"\n") -#define cmdHelpText yon_char_get_augumented(yon_char_get_augumented(_("ubl-settings-manager version: "),version_application),_("\nGTK settings manager for UBLinux\nUsage: ubl-settings-manager [OPTIONS...]\nOptions:\n -h, --help Show this help\n -V, --version Show package version\n --lock-settings Lock menu settings\n")) -#define GladePath "/com/ublinux/ui/ubl-settings-manager.glade" +#define glade_path "/com/ublinux/ui/ubl-settings-manager.glade" +#define glade_path_gnome_theme "/com/ublinux/ui/ubl-settings-manager-theme-gnome.glade" +#define glade_path_gnome_section "/com/ublinux/ui/ubl-settings-manager-theme-gnome-section.glade" +#define glade_path_main_theme "/com/ublinux/ui/ubl-settings-manager-theme-main.glade" #define CssPath "/com/ublinux/css/ubl-settings-manager.css" #define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf" #define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf" @@ -44,55 +49,16 @@ #define ubl_settings_infoPath "ubl-settings-info" #define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id=" typedef char* string; +__attribute__((unused)) static \ string version_application; -#define UBL_SETTINGS_MANAGER_TITLE _("UBLinux Settings Manager") -#define UBL_SETTINGS_MANAGER_ABOUT_TITLE _("About UBLinux Settings Manager") -#define ABOUT_PROJECT_HOME_PAGE_LABEL _("Project Home Page") -#define ABOUT_PROJECT_COMMENTS_LABEL _("Settings manager for UBLinux") -#define CONFIG_LOAD_ERROR _("Config loading failed!\n") -#define DOUBLE_CLICK_SELECTION_LABEL _("Double click selection") -#define SECTIONS_MANAGEMENT_LABEL _("Sections management") -#define UNDERSTOOD_LABEL _("Understood") -#define ABOUT_LABEL _("About...") -#define DOCUMENTATION_LABEL _("Documentation") -#define SETTINGS_LABEL _("Settings") -#define ALWAYS_REDIRECT_LABEL _("Always redirect") -#define APPLY_LABEL _("Apply") -#define SAVE_AND_APPLY_LABEL _("Save and apply") -#define CLOSE_LABEL _("Close") -#define CANCEL_LABEL _("Cancel") -#define READ_ONLINE_LABEL _("Read online") -#define REDIRECTION_COMMENT_LABEL _("You will be redirected to documentation site, where user help pages are translated and supported by community.") -#define REDIRECTION_LABEL _("Would you like to read documentation in the Web?") -#define WINDOW_THEME_LABEL _("Window theme") -#define ICON_SIZE_LABEL _("Icon size") -#define BACK_TO_ALL_SETTINGS_LABEL _("All settings") - - -typedef struct apps{ - char *Name; - int Type; - char *Categories; - char *Exec; - char *Icon; - int Pluggable; - int DualPluggable; - } apps; +#define _(String) gettext(String) typedef struct { char *command; int *exitcode; } thread_output; -typedef struct dictionary { - char *key; - void *data; - struct dictionary *next; - struct dictionary *prev; - struct dictionary *first; -} dictionary; - typedef struct IVGrapgicals{ char *sectionName; char *categories; @@ -110,32 +76,20 @@ typedef struct IconSection{ } IconSection; typedef struct { - int windowWidth; - int windowHeight; - int windowPosX; - int windowPosY; - int WindowTheme; - char *curThemeName; - int Mainiconsize; - int Gnomeiconsize; - int iconSegmentSize; + template_config_fields; + int apps_icon_size; dictionary *sections; - int MainlabelSize; - int GnomelabelSize; - int *currentThemeLabelSize; - int *currentThemeIconSize; int labelDensity; - char *lastUser; - int changed; - int fullscreen; int lock_settings; - int GnomeDoubleClick; - int MainDoubleClick; - int *currentDoubleClick; + int double_click; dictionary *SettingsSections; - int BannerHidden; + int banner_hidden; + + GHashTable *themes; } config; +extern config main_config; + typedef struct { GtkWidget *MainFrame; GtkWidget *MainBox; @@ -158,140 +112,106 @@ typedef struct { GtkWidget *DeleditBox; } SectionSettingSegment; -typedef struct { - GtkBuilder *builder; - GtkWidget *window; - dictionary *ICSys; - GtkWidget *DesktopBasic; - GtkWidget *DesktopSocket; - GtkWidget *ButtonBackToMain; - GtkWidget *DialogOpenDocumentation; - GtkWidget *CancelHelpButton; - GtkWidget *ReadHelpButton; - GtkWidget *AlwaysOpenDocumentation; - GtkWidget *helpHeader; - GtkWidget *helpText; - GtkWidget *appSettings; - GtkWidget *SettingsWindow; - GtkWidget *settingsSizeSlider; - GtkWidget *settingsSizeInfoLabel; - GtkWidget *settingsThemeChooser; - GtkWidget *settingsCancel; - GtkWidget *settingsAccept; - GtkWidget *settingsIcon; - GtkWidget *socket; - GtkWidget *socketplace; - GtkWidget *HideWhileLaunch; - GtkWidget *MenuItemSettings; - GtkWidget *MenuItemDocumentation; - GtkWidget *MenuItemAboutSystem; - GtkWidget *LabelTitle; - GtkWidget *settingsSubmenuLabelSize; - GtkWidget *settingsSubmenuLabelTheme; +typedef struct theme_struct { + GtkWidget *MainBox; + GtkWidget *AppsTree; + GtkWidget *SocketBox; + GtkWidget *HideBox; + GtkWidget *Socket; + int (*list_update_func)(struct theme_struct*); + char *(*get_command_func)(struct theme_struct*); + void (*set_sections_func)(struct theme_struct*); + GtkTreeStore *AppsStore; +} theme_struct; + +typedef struct gnome_theme_struct { + GtkWidget *MainBox; + GtkWidget *AppsTree; + GtkWidget *SocketBox; + GtkWidget *HideBox; + GtkWidget *Socket; + int (*list_update_func)(struct gnome_theme_struct*); + char *(*get_command_func)(struct gnome_theme_struct*); + void (*set_sections_func)(struct gnome_theme_struct*); GtkWidget *GnomePaned; - GtkWidget *GnomeInfoLabel; - GtkWidget *workingwindow; - GtkWidget *settingsSectionsSettingsButton; - GtkWidget *SectionSettingsWindow; - GtkWidget *SectionSettingsPack; - dictionary *SettingsSections; - GtkWidget *SectionSettingAddButton; - GtkWidget *SectionSettingAddNameEntry; - GtkWidget *SectionSettingAddCategoriesEntry; - GtkWidget *SectionSettingsClearEntryButton; - GtkWidget *SectionSettingsSaveButton; - GtkWidget *SectionSettingsCloseButton; - GtkWidget *GnomeInfoDetailsLabel; - GtkWidget *CautionWindow; - GtkWidget *CautionUnderstandButton; - GtkWidget *socketbuttonplace; - GtkWidget *socketbutton; - GtkWidget *Overlay; - GtkWidget *ThirdSocketPlace; - GtkWidget *ThirdSocket; - int appssize; - apps *applist; - GtkWidget *icvpack; - GtkWidget *infoWarningWindow; - GtkWidget *infoWarningButton; - GtkWidget *infoWarningLabel; - GtkWidget *BannerRevealer; - GtkWidget *Revealer; - GtkWidget *settingsDoubleClickSwitch; - GtkWidget *settingsDoubleClickLabel; - GtkWidget *BackToSettingsLabel; - -} actionWidgets; + GtkWidget *GnomeInfoLogoImage; + GtkCellRenderer *IconCell; +} gnome_theme_struct; + +typedef struct main_theme_struct { + GtkWidget *MainBox; + GtkWidget *AppsIconView; + GtkWidget *SocketBox; + GtkWidget *HideBox; + GtkWidget *Socket; + int (*list_update_func)(struct main_theme_struct*); + char *(*get_command_func)(struct main_theme_struct*); + void (*set_sections_func)(struct main_theme_struct*); + GtkListStore *AppsList; +} main_theme_struct; -typedef enum { - ACTIONWIDGETS, - ICONSECTION, - IVGRAPHICALS, - OTHER +typedef struct { + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *TitleLabel; + GtkWidget *ThemeBox; + GtkWidget *SocketBox; + GtkWidget *SettingsButton; + GtkWidget *BannerImage; + GtkWidget *BannerArrow; + GtkWidget *BannerButton; + GtkWidget *BannerRevealer; -} DICT_TYPE; + theme_struct *current_theme; + +} main_window; -void on_plug_added(GtkSocket* self, actionWidgets *builder); -void on_plug_removed(GtkSocket* self, actionWidgets *widgets); -void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist); -void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist); -void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets); +typedef struct { + char *name; + int categories_size; + config_str categories; +} app_section; + +void on_plug_added(GtkSocket* self, main_window *builder); +void on_plug_removed(GtkSocket* self, main_window *widgets); +void on_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *applist); +void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *applist); +void on_item_selection_changed(GtkIconView *IV, main_window *widgets); void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder); -void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb); +void on_backToSettingsButton_clicked(GtkWidget *button,main_window *sctb); void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder); void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder); -int launch_app_with_arguments(char *name, char *args); -int launch_app(char *name); -int py_launch_app(char *name,char *args); int on_settings_accept(GtkWidget *button, dictionary **widgetsDs); -void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets); -int on_settingsOpen(GtkWidget *button, actionWidgets *widgets); -int on_settings_icon_size_changed(GtkWidget* self, actionWidgets *widgets); -int on_settings_cancel(GtkWidget *button, actionWidgets *widgets); -apps *get_app_by_name(apps *applist,char *name, int size); +void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, main_window *widgets); +int on_settingsOpen(GtkWidget *button, main_window *widgets); +int on_settings_icon_size_changed(GtkWidget* self, main_window *widgets); +int on_settings_cancel(GtkWidget *button, main_window *widgets); int reload_list(IVGraphicals *section); -int load_apps(IVGraphicals *section, apps *applist, int size); -int load_apps_with_clear(IVGraphicals *section, apps *applist, int size); int hide_if_unfound(dictionary *widgetsDc); -GtkWidget *create_socket(actionWidgets *builder); -void sort_apps(apps *applist,int size); -apps *find_apps(int *sizef); -int check_categories(apps app, char *catstocheck); +GtkWidget *create_socket(main_window *builder); int setup_config(); void update_double_clicks(dictionary *widgetsD); void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned); -dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize); -char *yon_char_get_augumented(char *source, char *append); -char *yon_cut(char *source, int size, int startpos); int yon_set_sections(IconSection *section); void yon_set_default_sections(dictionary *section); -char *yon_char_divide_search(char *source, char* dividepos, int delete_divider); -char *yon_char_divide(char *source, int dividepos); dictionary *yon_section_new(dictionary *section, char *section_name, char *categories); void yon_switch_theme(dictionary **dict, dictionary *newone); -dictionary *yon_dictionary_find(dictionary **dict, char *key); -void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm); -dictionary *yon_dictionary_create_empty(); -dictionary *yon_dictionary_rip(dictionary *dict); -dictionary *yon_dictionary_get_last(dictionary *dict); -dictionary *yon_dictionary_switch_places(dictionary *dict,int aim); -dictionary *yon_dictionary_create_with_data(char *key, void *data); -dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data); -dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect); +void yon_segment_show(main_window *widgets, SectionSettingSegment *sgm); SectionSettingSegment *yon_create_section_setting(char *name, char *categories); -void yon_segments_show(actionWidgets *widgets); -void yon_segments_hide(actionWidgets *widgets); -void yon_dictionary_make_first(dictionary *dict); +void yon_segments_show(main_window *widgets); +void yon_segments_hide(main_window *widgets); dictionary *yon_create_icon_section_list(dictionary *sections); -int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets); +int yon_show_icon_views(dictionary *IVS,main_window *widgets); void yon_icon_size_convert(int mode); -char *yon_char_new(char *chr); int launch(thread_output *thread); float yon_time_average(dictionary *times); void yon_time_reg_for_average(dictionary *listofregs, int size, time_t tm); -void yon_dictionary_switch_to_last(dictionary **dict); -dictionary *yon_dictionary_create_conneced(dictionary *targetdict); int yon_get_icon_size(int size); -char *yon_char_from_int(int int_to_convert); +void yon_theme_init(); +theme_struct *yon_theme_update(main_window *widgets); +gnome_theme_struct *yon_gnome_theme_new(); +main_theme_struct *yon_main_theme_new(); +app_section *yon_app_section_new(); +gnome_theme_struct *yon_gnome_theme_new(); #endif \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h new file mode 100644 index 0000000..3ef5e19 --- /dev/null +++ b/source/ubl-strings.h @@ -0,0 +1,26 @@ + + +#define TITLE_LABEL _("UBLinux Settings Manager") +#define TITLE_INFO_LABEL _("About UBLinux Settings Manager") + +#define WIKI_LINK _("https://wiki.ublinux.ru/software/programs_and_utilities/all/ubl-settings-manager") + +#define ABOUT_PROJECT_COMMENTS_LABEL _("Settings manager for UBLinux") +#define CONFIG_LOAD_ERROR _("Config loading failed!\n") +#define DOUBLE_CLICK_SELECTION_LABEL _("Double click selection") +#define SECTIONS_MANAGEMENT_LABEL _("Sections management") +#define UNDERSTOOD_LABEL _("Understood") +#define SETTINGS_LABEL _("Settings") +#define APPLY_LABEL _("Apply") +#define SAVE_AND_APPLY_LABEL _("Save and apply") +#define CLOSE_LABEL _("Close") +#define CANCEL_LABEL _("Cancel") +#define READ_ONLINE_LABEL _("Read online") +#define REDIRECTION_COMMENT_LABEL _("You will be redirected to documentation site, where user help pages are translated and supported by community.") +#define REDIRECTION_LABEL _("Would you like to read documentation in the Web?") +#define WINDOW_THEME_LABEL _("Window theme") +#define ICON_SIZE_LABEL _("Icon size") +#define BACK_TO_ALL_SETTINGS_LABEL _("All settings") +#define THEME_ERROR_LABEL _("Failed to load theme") +#define MAIN_THEME_LABEL _("Main theme") +#define GNOME_THEME_LABEL _("GNOME theme") \ No newline at end of file diff --git a/ubl-settings-manager-settings-sections.glade b/ubl-settings-manager-settings-sections.glade new file mode 100644 index 0000000..2fa7881 --- /dev/null +++ b/ubl-settings-manager-settings-sections.glade @@ -0,0 +1,299 @@ + + + + + + + False + 800 + 600 + + + True + False + vertical + + + True + True + 5 + 5 + 5 + 5 + 5 + 5 + in + + + True + False + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 3 + 3 + 5 + 5 + + + True + False + + + True + True + True + center + 3 + 3 + image2 + + + False + True + 0 + + + + + True + True + True + False + Section name + name + + + True + True + 1 + + + + + True + False + + + True + False + center + + + True + True + True + 5 + 5 + image4 + + + False + True + end + 2 + + + + + True + False + 2 + + + True + True + 5 + 10 + 5 + 10 + False + Identifier + + + True + True + 0 + + + + + True + True + 2 + + + + + True + True + 1 + + + + + True + True + 2 + + + + + + + + + + + + False + True + 1 + + + + + + + + + True + True + 0 + + + + + True + False + + + Save and apply + True + True + True + 5 + 5 + 5 + image7 + + + False + True + end + 0 + + + + + Close + True + True + True + 15 + 15 + 5 + image6 + + + False + True + end + 1 + + + + + False + True + 1 + + + + + + + True + False + + + True + False + UBLinux Settings Manager + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-manager + 5 + + + + + + + True + False + 16 + user-trash-symbolic + + + True + False + 16 + object-select-symbolic + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + diff --git a/ubl-settings-manager-settings-sections.glade~ b/ubl-settings-manager-settings-sections.glade~ new file mode 100644 index 0000000..39f38f8 --- /dev/null +++ b/ubl-settings-manager-settings-sections.glade~ @@ -0,0 +1,298 @@ + + + + + + False + 800 + 600 + + + True + False + vertical + + + True + True + 5 + 5 + 5 + 5 + 5 + 5 + in + + + True + False + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 3 + 3 + 5 + 5 + + + True + False + + + True + True + True + center + 3 + 3 + image2 + + + False + True + 0 + + + + + True + True + True + False + Section name + name + + + True + True + 1 + + + + + True + False + + + True + False + center + + + True + True + True + 5 + 5 + image4 + + + False + True + end + 2 + + + + + True + False + 2 + + + True + True + 5 + 10 + 5 + 10 + False + Identifier + + + True + True + 0 + + + + + True + True + 2 + + + + + True + True + 1 + + + + + True + True + 2 + + + + + + + + + + + + False + True + 1 + + + + + + + + + True + True + 0 + + + + + True + False + + + Save and apply + True + True + True + 5 + 5 + 5 + image7 + + + False + True + end + 0 + + + + + Close + True + True + True + 15 + 15 + 5 + image6 + + + False + True + end + 1 + + + + + False + True + 1 + + + + + + + True + False + + + True + False + UBLinux Settings Manager + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-manager + 5 + + + + + + + True + False + 16 + user-trash-symbolic + + + True + False + 16 + object-select-symbolic + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + diff --git a/ubl-settings-manager-settings.glade b/ubl-settings-manager-settings.glade new file mode 100644 index 0000000..7bf5d44 --- /dev/null +++ b/ubl-settings-manager-settings.glade @@ -0,0 +1,353 @@ + + + + + + False + 440 + 250 + ru.ublinux.ubl-settings-manager + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 2 + 0.019999999552965164 + in + + + True + False + 12 + + + True + False + + + True + False + vertical + + + True + False + 5 + 32x32 + + + False + True + 0 + + + + + True + True + 10 + 10 + 10 + 10 + adjustment1 + 5 + 0 + False + + + True + True + 1 + + + + + True + True + 0 + + + + + 64 + 64 + True + False + 32 + com.ublinux.ubl-settings-manager + + + False + True + 1 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + Icon size + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 2 + 5 + 0.019999999552965164 + in + + + True + False + + + True + False + vertical + + + combo + True + False + center + 10 + 10 + 10 + 10 + 5 + True + 0 + + + True + True + 0 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + Window theme + + + + + True + True + 1 + + + + + True + False + 3 + 3 + + + True + False + center + 12 + 12 + Double click selection + 0.019999999552965164 + + + True + True + 0 + + + + + True + True + 10 + 10 + + + False + True + end + 1 + + + + + False + True + 2 + + + + + Sections management + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + False + True + 3 + + + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 3 + 30 + True + + + Close + 200 + True + True + True + 2 + image8 + + + False + True + 0 + + + + + Apply + 200 + True + True + True + 2 + image9 + + + False + True + 1 + + + + + True + True + 0 + + + + + False + True + 1 + + + + + False + True + 5 + + + + + + + True + False + + + True + False + UBLinux Settings Manager + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-manager + 5 + + + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + diff --git a/ubl-settings-manager-theme-gnome-section.glade b/ubl-settings-manager-theme-gnome-section.glade new file mode 100644 index 0000000..8e73fdb --- /dev/null +++ b/ubl-settings-manager-theme-gnome-section.glade @@ -0,0 +1,23 @@ + + + + + + True + True + + + True + False + False + + + + + True + False + expander + + + + diff --git a/ubl-settings-manager-theme-gnome-section.glade~ b/ubl-settings-manager-theme-gnome-section.glade~ new file mode 100644 index 0000000..0764de4 --- /dev/null +++ b/ubl-settings-manager-theme-gnome-section.glade~ @@ -0,0 +1,23 @@ + + + + + + True + True + + + True + False + False + + + + + True + False + expander + + + + diff --git a/ubl-settings-manager-theme-gnome.glade b/ubl-settings-manager-theme-gnome.glade new file mode 100644 index 0000000..b855a17 --- /dev/null +++ b/ubl-settings-manager-theme-gnome.glade @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + True + False + vertical + + + True + True + 256 + True + True + + + True + True + in + + + True + False + + + True + False + vertical + 5 + + + + + + + + + + False + True + + + + + True + False + vertical + + + True + False + vertical + + + True + False + 3 + 3 + 3 + 3 + 3 + 0 + in + + + True + False + center + center + + + True + False + center + center + + + True + False + center + center + 156 + com.ublinux.libublsettingsui-gtk3 + + + False + True + 0 + + + + + + + + + + + + True + True + 0 + + + + + True + True + 0 + + + + + False + vertical + + + + + + False + True + 1 + + + + + True + True + + + + + True + True + end + 0 + + + + diff --git a/ubl-settings-manager-theme-gnome.glade~ b/ubl-settings-manager-theme-gnome.glade~ new file mode 100644 index 0000000..ffc4df9 --- /dev/null +++ b/ubl-settings-manager-theme-gnome.glade~ @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + True + False + vertical + + + True + True + 256 + True + True + + + True + True + in + + + True + False + + + True + False + False + + + + + + + False + True + + + + + True + False + vertical + + + True + False + vertical + + + True + False + 3 + 3 + 3 + 3 + 3 + 0 + in + + + True + False + center + center + + + True + False + center + center + + + True + False + center + center + 156 + com.ublinux.libublsettingsui-gtk3 + + + False + True + 0 + + + + + + + + + + + + True + True + 0 + + + + + True + True + 0 + + + + + False + vertical + + + + + + False + True + 1 + + + + + True + True + + + + + True + True + end + 0 + + + + diff --git a/ubl-settings-manager-theme-main-IconView.glade b/ubl-settings-manager-theme-main-IconView.glade new file mode 100644 index 0000000..5d4daf1 --- /dev/null +++ b/ubl-settings-manager-theme-main-IconView.glade @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + True + True + 4 + natural + horizontal + liststoreTemplate + 135 + 0 + 2 + 5 + True + + + 2 + + + 5 + 3 + 1 + 2 + 4 + + + + + 0 + word + 130 + + + 3 + 0 + + + + + diff --git a/ubl-settings-manager-theme-main.glade b/ubl-settings-manager-theme-main.glade new file mode 100644 index 0000000..306a248 --- /dev/null +++ b/ubl-settings-manager-theme-main.glade @@ -0,0 +1,69 @@ + + + + + + + + True + False + vertical + + + True + False + vertical + + + 5 + 5 + True + True + immediate + never + always + in + + + True + True + 6 + AppsList + + + + + True + True + 0 + + + + + True + True + 0 + + + + + False + vertical + + + + + + + False + True + 1 + + + + + diff --git a/ubl-settings-manager-theme-main.glade~ b/ubl-settings-manager-theme-main.glade~ new file mode 100644 index 0000000..102e348 --- /dev/null +++ b/ubl-settings-manager-theme-main.glade~ @@ -0,0 +1,73 @@ + + + + + + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + + + 5 + 5 + True + True + immediate + never + always + in + + + True + True + 6 + AppsList + + + + + True + True + 0 + + + + + True + True + 0 + + + + + False + vertical + + + + + + + False + True + 1 + + + + + diff --git a/ubl-settings-manager.css b/ubl-settings-manager.css index 614bb95..a042536 100644 --- a/ubl-settings-manager.css +++ b/ubl-settings-manager.css @@ -1,145 +1,342 @@ -.bannerbackground { -background-color: #404040; +.thin { + margin:0px; + padding:0px; } - -.thin{ - padding:0px; - margin:0px; - transition: 0ms ease-out; +.noborder { + border:none; +} +.borders *{ + border-width:0.5px; + border-style: solid; + } -.thin:active { - background-color: @theme_selected_bg_color; - transition: 10ms ease-out; +.nobackground { +background:transparent; } -.transparent { - background:none; - border:none; - transition: 0ms ease-out; +.nobackground:active { +background:transparent; +} +.textHead{ + text-shadow: 2px 2px @theme_bg_color; + color: @theme_text_color; } -#GnomeIcon{ +.bggrey{ + border-radius:5px; + border-color:@theme_text_color; border-style:solid; - border-bottom-width: 1px; - border-image: linear-gradient(90deg, alpha(@theme_text_color,0.4) 55%, alpha(@theme_bg_color, 0) 100%); - border-image-slice: 1; + border-width:0.3px; + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); } -#SepIcon{ - background-color: alpha(@theme_text_color, 0.6); +.inherited>* { + border:none; + background:inherit; } +.workingbg { + background:@theme_base_color; +} +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } -#iconlabel { - font-size:14px; - font-weight: bold; + .menuitemtop{ + margin-bottom:0px; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemtop >*{ + margin:4px 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitemmiddle >*{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitembottom >*{ + margin:0 2px 2px 2px; + padding: 3px 10px 3px 5px; + } + .menuitemtop:hover { + background:@theme_bg_color; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle:hover { + background:@theme_bg_color; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitembottom:hover { + background:@theme_bg_color; + border-color:inherit; + border-bottom-width:0px; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemtop:hover>* { + margin:4px 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitemmiddle:hover>* { + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitembottom:hover>* { + margin:0 2px 2px 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .boxInfoMessError{ + background-color: #ea9999; } -.roundborder > * { - border-width:0px; + +.boxInfoMessOK{ + background-color: #f3f0ac; } -.roundborder:backdrop > * { - border-width:0px; - border-radius:5px; + +.boxInfoMessGray{ + background-color: darker(@theme_bg_color); } -.noborder { - border: none; +.errorBox { + border-width: 2px; + border-color: #ea9999; + border-style:solid; } -.menuitembottom{ - margin-top:0px; - margin-bottom:3px; - border-color:inherit; - border-left-width:inherit; - border-right-width:inherit; -} -.menuitemmiddle{ - margin-top:0px; - margin-bottom:0px; - border-color:inherit; - border-left-width:inherit; - border-right-width:inherit; -} - -.menuitemtop{ - margin-bottom:0px; - border-color:inherit; - border-top-width:inherit; - border-left-width:inherit; - border-right-width:inherit; -} -.menuitemtop *{ - margin:2px 2px 0 2px; - padding: 5px 10px 3px 5px; - border:transparent; -} -.menuitemmiddle *{ - margin:0 2px 0 2px; - padding: 3px 10px 3px 5px; - border:transparent; -} -.menuitembottom *{ - margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; -} -.menuitemtop:hover { - background:@theme_bg_color; - border-color:inherit; - border-top-width:inherit; - border-left-width:inherit; - border-right-width:inherit; -} -.menuitemmiddle:hover { - background:@theme_bg_color; - border-color:inherit; - border-left-width:inherit; - border-right-width:inherit; -} -.menuitembottom:hover { - background:@theme_bg_color; - border-color:inherit; - border-bottom-width:0px; - border-left-width:inherit; - border-right-width:inherit; - +.chosenOutline{ + transition: 0ms; + border-width: 1px; + border-color: #f3f0ac; + border-style:solid; } -.menuitemtop:hover* { - margin:2px 2px 0 2px; - padding: 5px 10px 3px 5px; - background:@theme_selected_bg_color; - border-radius:2px; + +.separatorTop{ + border-color: darker (@theme_bg_color); + border-top-width:1px; + border-style:solid; +} + +.separatorBottom{ + border-color: darker (@theme_bg_color); + border-bottom-width:1px; + border-style:solid; +} + +.marginright image{ + margin-right: 2px; +} + +.spinner_image{ + -gtk-icon-transform: scale(2); } -.menuitemmiddle:hover* { - margin:0 2px 0 2px; - padding: 3px 10px 3px 5px; - background:@theme_selected_bg_color; - border-radius:2px; + +treeview row:nth-child(odd) { background-color: #000000; } + +treeview row:nth-child(even) { background-color: #ffffff; } + +.blackbg { + background-color: @theme_text_color; } -.menuitembottom:hover* { - margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; - background:@theme_selected_bg_color; - border-radius:2px; + +.toggletabs { + background-color: @background_color; + border:none; + border-radius:0px; + transition:0; + padding-top:7px; + padding-bottom:7px; } -.workingbg, #workingbg { - background-color:@theme_base_color; +.toggletabs:disabled { + background-color: @background_color; + border:none; + border-radius:0px; + transition:0; + padding-top:7px; + padding-bottom:7px; + opacity:1; } -.workingbg.view.cell:selected { - background-color:@theme_selected_bg_color; +.toggletabs:checked:disabled { + background:@theme_base_color; + border-radius:0px; + color:@theme_text_color; + padding-top:7px; + padding-bottom:7px; + opacity:1; } -.workingbg.view.cell:hover { - background-color:darker(@theme_selected_bg_color); - color:@theme_selected_text_color; - border-radius:3px; +.toggletabs:checked:disabled>* { + background:@theme_base_color; + color:@theme_text_color; + opacity:1; } -.bkim { - transition: 200ms ease-out; - background-image: none; + +.toggletabs:checked:active:disabled { + background:@theme_base_color; + border-radius:0px; + color:inherit; + padding-top:7px; + padding-bottom:7px; + opacity:1; +} + + +.toggletabs:disabled:active { + background-color: @theme_base_color; + border:none; + border-radius:0px; + transition:0; + padding-top:7px; + padding-bottom:7px; + color:black; + opacity:1; +} +.toggletabs:active { + background-color: @theme_base_color; + border:none; + border-radius:0px; + transition:0; + padding-top:7px; + padding-bottom:7px; + color:inherit; + opacity:1; +} + +.menubox { + background-color:@theme_text_color; +} +.menubox *{ + color:@theme_base_color; +} +.bggrey{ + border-radius:5px; + border-color:@theme_text_color; + border-style:solid; + border-width:0.3px; + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); +} + +.tag_red{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#660000; + border-color: #cf2a27; + + background-color:#ea9999 +} +.tag_blue{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#073763; + border-color: #2b78e4; + + background-color:#9fc5f8 +} +.tag_purple{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#073763; + border-color: #9900ff; + + background-color:#b4a7d6 +} +.tag_orange{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#783f04; + border-color: #ff9900; + + background-color:#f9cb9c +} +.tag_yellow{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#7f6000; + border-color: #bf9000; + + background-color:#ffe599 +} +.tag_green{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + border-color: #009e0f; + background-color:#b6d7a8; + color:#274e13; +} +.tag_grey{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#5f5f5f; + border-color: #777777; + + background-color:#999999 +} + +.tableborderbottom { + border-bottom:0.5px; + border-style: solid; + border-color: @theme_fg_color; + } button { min-width: 26px; min-height: 24px; +} + +.unsensitiveblock:disabled { + opacity:1; + background:@theme_selected_bg_color; +} +.bannerbackground { + background-color: #404040; + } + +.sharpborder { + border-radius: 0px; +} + +.instant { + transition-duration: 0ms; } \ No newline at end of file diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 4a048cf..9225025 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -147,202 +147,6 @@ - - False - False - 450 - dialog-question-symbolic - - - True - False - vertical - - - True - False - - - True - False - start - 20 - 20 - dialog-question-symbolic - 6 - - - False - True - 0 - - - - - True - False - vertical - - - True - False - start - 10 - 5 - Would you like to read documentation in the Web? - True - 0 - - - - - - - False - True - 0 - - - - - True - False - start - 15 - 10 - You will be redirected to documentation site, where user help pages are -translated and supported by community. - True - 0 - - - - False - True - 1 - - - - - Always redirect - True - True - False - end - True - - - - False - True - end - 2 - - - - - - True - True - 1 - - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 30 - True - - - Cancel - True - True - True - - - - - True - True - 0 - - - - - Read online - True - True - True - - - - - True - True - 1 - - - - - False - True - 1 - - - - - - - True - False - - - True - False - UBLinux Settings Manager - - - - - - - - True - False - 32 - dialog-question-symbolic - - - - - True False @@ -383,96 +187,13 @@ translated and supported by community. - + 800 - 558 - False - 800 - 558 - ubconfig-gui - - - True - False - vertical - - - - - - - - True - False - True - - - True - False - True - - - True - False - UBLinux Settings Web View - - - - - - True - True - 0 - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - - - - True - False - menu - - - True - False - - - - - True - False - - - - - True - False - True - - - - - + 540 False 800 558 - ubconfig-gui + com.ublinux.libublsettingsui-gtk3 True @@ -486,18 +207,20 @@ translated and supported by community. True False - True - + True False - start slide-left + 0 + True - + True False center + start + /com/ublinux/images/manager-banner.png 3 - - True - True - 1 - @@ -554,6 +274,7 @@ translated and supported by community. @@ -563,154 +284,58 @@ translated and supported by community. - + True - True - 52 - True - True + False + vertical - + True - True - external - in + False + vertical - - True - False - immediate - natural - - - True - False - vertical - - - - - - - + - False - True + False + True + 0 - + + Icon True False - vertical + 5 + 5 + 5 + 5 - - True - False - vertical - - - True - False - 3 - 3 - 3 - 3 - 3 - 0 - in - - - True - False - center - center - 12 - - - True - False - center - center - - - - False - True - 0 - - - - - - - - - - - - True - True - 0 - - - - - True - True - 0 - - - - - True - False - vertical - - - False - vertical - - - - - - False - True - 0 - - - - - False - True - 1 - + + - True - True + True + True + 1 True True - end 1 + True @@ -726,7 +351,7 @@ translated and supported by community. False True - + True False UBLinux Settings Manager @@ -751,7 +376,6 @@ translated and supported by community. False center center - 10 True @@ -799,28 +423,16 @@ translated and supported by community. - + True - False + True + False + True + menu1 + none + settingsPopover - - True - True - False - True - center - center - GnomeMenu - none - - - - - - False - True - 0 - + @@ -829,1212 +441,216 @@ translated and supported by community. - + True False center center + vertical - end 3 - + True False center center - vertical + end 4 - + - + + True + False + menu + + + True + False + + + + + True + False + + + + + True + False + True + + + + + + 1 + 5 + 2 + 1 + 1 + + + 1 + 1 + 10 + + + + True False - 800 - 558 ubconfig-gui + 6 + + + True + False - + True - True False - vertical + Element 1 + + + + + True + False + Element 2 + + + True + False + + + True + False + Element 3 + + + + + + + + + Element 4 + True + False + image3 + False + + + + + + + + + + + Стандартная тема + + + GNOME тема + + + + + True + False + + + True + False + + + + + + + + + False + + + True + False + 0 + none - + True - True False + 5 + 5 + 5 + 5 - + True False + 4 + 4 + 4 + 4 + vertical - + True - False - start - slide-left - - - True - False - start - start - 3 - - - + True + True + Settings False True - 0 + 3 - + True - False - vertical - - - action1 - True - True - False - True - right - - - - - - - True - True - 1 - - - + True + True + Documentation False True - 1 + 4 - - - - False - True - 0 - - - - - True - False - vertical - + True - False - 5 - 5 - 5 - 5 - vertical - - - 5 - 5 - True - True - immediate - never - always - in - - - True - False - natural - - - True - False - vertical - 2 - - - - - - - - - - - True - True - 0 - - + True + True + About system - True + False True - 0 - - - - - False - vertical - - - - - - - False - True - 1 - - - - - - True - True - 1 - - - - - True - True - 0 - - - - - - - True - False - True - - - True - False - UBLinux Settings Manager - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - True - False - False - False - center - center - 10 - - - - True - False - 5 - - - True - True - False - True - left - - - - - - - False - True - 0 - - - - - True - False - Back to settings - - - False - True - 1 - - - - - - - 1 - - - - - True - False - center - center - vertical - - - - - - - 2 - - - - - True - False - vertical - - - True - True - False - True - center - center - MainMenu - none - False - - - - - - False - True - 0 - - - - - end - 3 - - - - - True - False - center - center - - - - - - - end - 4 - - - - - - - - 1 - 5 - 2 - 1 - 1 - - - 1 - 1 - 10 - - - - True - False - 16 - user-trash-symbolic - - - True - False - ubconfig-gui - 6 - - - True - False - - - True - False - Element 1 - - - - - True - False - Element 2 - - - True - False - - - True - False - Element 3 - - - - - - - - - Element 4 - True - False - image3 - False - - - - - True - False - 16 - object-select-symbolic - - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic - - - False - 800 - 600 - - - True - False - vertical - - - True - True - 5 - 5 - 5 - 5 - in - - - True - False - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - vertical - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - - True - False - 3 - 3 - 5 - 5 - - - True - False - - - True - True - True - center - 3 - image2 - - - False - True - 0 - - - - - True - True - True - False - Section name - name - - - True - True - 1 - - - - - True - False - - - True - False - center - - - True - True - True - 5 - image4 - - - False - True - end - 2 - - - - - True - False - 2 - - - True - True - 5 - 5 - 5 - 10 - False - Identifier - - - True - True - 0 - - - - - True - True - 2 - - - - - True - True - 1 - - - - - True - True - 2 - - - - - - - - - - - - False - True - 1 - - - - - - - - - True - True - 0 - - - - - True - False - - - Save and apply - True - True - True - 5 - 5 - image7 - - - False - True - end - 0 - - - - - Close - True - True - True - 15 - 5 - image6 - - - False - True - end - 1 - - - - - False - True - 1 - - - - - - - True - False - - - True - False - UBLinux Settings Manager - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic - - - False - 440 - 250 - ru.ublinux.ubl-settings-manager - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 2 - 0.019999999552965164 - in - - - True - False - 12 - - - True - False - - - True - False - vertical - - - True - False - 5 - 32x32 - - - False - True - 0 - - - - - True - True - 10 - 10 - 10 - 10 - adjustment1 - 5 - 0 - 0 - False - - - True - True - 1 - - - - - True - True - 0 - - - - - 64 - 64 - True - False - 32 - com.ublinux.ubl-settings-manager - - - False - True - 1 - - - - - - - - - True - False - 5 - 5 - Icon size - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 2 - 5 - 0.019999999552965164 - in - - - True - False - - - True - False - vertical - - - combo - True - False - center - 10 - 10 - 5 - True - 0 - - - True - True - 0 - - - - - - - - - True - False - 5 - 5 - Window theme - - - - - True - True - 1 - - - - - True - False - 3 - 3 - - - True - False - center - 12 - 12 - Double click selection - 0.019999999552965164 - - - True - True - 0 - - - - - True - True - 10 - 10 - - - False - True - end - 1 - - - - - False - True - 2 - - - - - Sections management - True - True - True - 5 - 5 - 5 - 5 - - - False - True - 3 - - - - - True - False - vertical - - - True - False - - - True - False - 5 - 5 - 3 - 30 - True - - - Close - 200 - True - True - True - 2 - image8 - - - False - True - 0 - - - - - Apply - 200 - True - True - True - 2 - image9 - - - False - True - 1 - - - - - True - True - 0 - - - - - False - True - 1 - - - - - False - True - 5 - - - - - - - True - False - - - True - False - UBLinux Settings Manager - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - - - - - - - - - Стандартная тема - - - GNOME тема - - - - - - - - - - - - - - - - - - - - - True - True - 4 - natural - horizontal - liststoreTemplate - 135 - 0 - 2 - 5 - True - - - 2 - - - 5 - 3 - 1 - 2 - 4 - - - - - 0 - word - 130 - - - 3 - 0 - - - - - - True - False - - - True - False - - - - - - - - - False - - - True - False - 0 - none - - - True - False - 5 - 5 - 5 - 5 - - - True - False - 4 - 4 - 4 - 4 - vertical - - - True - True - True - Settings - - - False - True - 3 - - - - - True - True - True - Documentation - - - False - True - 4 - - - - - True - True - True - About system - - - False - True - 5 + 5 - - - False - True - 0 - - - - - - False - True - 0 - - - - - True - False - vertical - - - Icon - True - False - 2 - 2 - 2 - 2 - 2 - 2 - - - True - True - in - - - True - False - natural - - - - - - - - - True - True - 0 - - - - - - True - True - 0 - - - - - True - False - vertical - - - - - - - False - True - 1 - - - - - True - True - 1 - - - - - - True - True - 0 - - - - - - - True - False - - - True - False - True - - - True - False - UBLinux Settings Manager - - - - - - True - True - 0 - - - - - True - True - False - True - menu1 - none - settingsPopover - - - - - - False - True - 1 - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - - - - False - - - True - False - 4 - 4 - 4 - 4 - 4 - 4 - vertical - - - True - True - True - Settings - - - False - True - 3 - - - - - True - True - True - Documentation - - - False - True - 4 - - - - - True - True - True - About system - - - False - True - 5 - - - - - - - - False - False - True - center - com.ublinux.ubl-settings-manager - dialog - True - UBLinux Settings Manager - 1.6 - Copyright © 2022 - 2023 - UBSoft Software LLC - Settings manager for UBLinux - https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-manager - Project Home Page - UBGroup - UBGroup - com.ublinux.ubl-settings-manager - gpl-2-0 - - - False - vertical - 2 - - - False - end - - - False - False - 0 - - - - - - - True - False - True - - - True - False - UBLinux Settings Manager - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - -- 2.35.1 From d47128cf569f3dacd017826edd50dbc8a604025b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 20 Nov 2025 18:04:28 +0600 Subject: [PATCH 2/3] Fixed gitignore --- .gitignore | 30 +- ubl-settings-manager-settings-sections.glade~ | 298 ------------------ ...ettings-manager-theme-gnome-section.glade~ | 23 -- ubl-settings-manager-theme-gnome.glade~ | 149 --------- ubl-settings-manager-theme-main.glade~ | 73 ----- 5 files changed, 11 insertions(+), 562 deletions(-) delete mode 100644 ubl-settings-manager-settings-sections.glade~ delete mode 100644 ubl-settings-manager-theme-gnome-section.glade~ delete mode 100644 ubl-settings-manager-theme-gnome.glade~ delete mode 100644 ubl-settings-manager-theme-main.glade~ diff --git a/.gitignore b/.gitignore index 6356553..251e638 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,14 @@ .vscode/ -config.conf -ubconfig-main-back.conf -gtk-dark.css -msgformat.py -calendarApp.glade -calendarApp.glade~ -ubl-settings-manager.glade~ -*ubl-settings-manager.glade# +*# ubl-settings-manager -**base.mo -home/ -css/ -.config/ -images/ -locale/ -ui/ -ubl-settings-manager_ru.pos -ubl-settings-manager_ru.po~ -deleted +ubl-settings-TEMPLATE +ubl-settings-repo-back/ubl-settings-repo-back +*~ +build/ compile/ -.install.sh \ No newline at end of file +terminal-commands/ +source/ubl-cmake.h +.BUILD.md +.updatebuild.sh +.install.sh +*vgcore* diff --git a/ubl-settings-manager-settings-sections.glade~ b/ubl-settings-manager-settings-sections.glade~ deleted file mode 100644 index 39f38f8..0000000 --- a/ubl-settings-manager-settings-sections.glade~ +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - False - 800 - 600 - - - True - False - vertical - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - in - - - True - False - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - vertical - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - - True - False - 3 - 3 - 5 - 5 - - - True - False - - - True - True - True - center - 3 - 3 - image2 - - - False - True - 0 - - - - - True - True - True - False - Section name - name - - - True - True - 1 - - - - - True - False - - - True - False - center - - - True - True - True - 5 - 5 - image4 - - - False - True - end - 2 - - - - - True - False - 2 - - - True - True - 5 - 10 - 5 - 10 - False - Identifier - - - True - True - 0 - - - - - True - True - 2 - - - - - True - True - 1 - - - - - True - True - 2 - - - - - - - - - - - - False - True - 1 - - - - - - - - - True - True - 0 - - - - - True - False - - - Save and apply - True - True - True - 5 - 5 - 5 - image7 - - - False - True - end - 0 - - - - - Close - True - True - True - 15 - 15 - 5 - image6 - - - False - True - end - 1 - - - - - False - True - 1 - - - - - - - True - False - - - True - False - UBLinux Settings Manager - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-manager - 5 - - - - - - - True - False - 16 - user-trash-symbolic - - - True - False - 16 - object-select-symbolic - - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic - - diff --git a/ubl-settings-manager-theme-gnome-section.glade~ b/ubl-settings-manager-theme-gnome-section.glade~ deleted file mode 100644 index 0764de4..0000000 --- a/ubl-settings-manager-theme-gnome-section.glade~ +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - True - True - - - True - False - False - - - - - True - False - expander - - - - diff --git a/ubl-settings-manager-theme-gnome.glade~ b/ubl-settings-manager-theme-gnome.glade~ deleted file mode 100644 index ffc4df9..0000000 --- a/ubl-settings-manager-theme-gnome.glade~ +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - True - False - vertical - - - True - True - 256 - True - True - - - True - True - in - - - True - False - - - True - False - False - - - - - - - False - True - - - - - True - False - vertical - - - True - False - vertical - - - True - False - 3 - 3 - 3 - 3 - 3 - 0 - in - - - True - False - center - center - - - True - False - center - center - - - True - False - center - center - 156 - com.ublinux.libublsettingsui-gtk3 - - - False - True - 0 - - - - - - - - - - - - True - True - 0 - - - - - True - True - 0 - - - - - False - vertical - - - - - - False - True - 1 - - - - - True - True - - - - - True - True - end - 0 - - - - diff --git a/ubl-settings-manager-theme-main.glade~ b/ubl-settings-manager-theme-main.glade~ deleted file mode 100644 index 102e348..0000000 --- a/ubl-settings-manager-theme-main.glade~ +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - vertical - - - 5 - 5 - True - True - immediate - never - always - in - - - True - True - 6 - AppsList - - - - - True - True - 0 - - - - - True - True - 0 - - - - - False - vertical - - - - - - - False - True - 1 - - - - - -- 2.35.1 From c9b36c023ccaa0af826274e316dd3bbe579b6529 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 21 Nov 2025 18:18:01 +0600 Subject: [PATCH 3/3] WIP settings manager rework --- gresource.xml | 1 + source/CMakeLists.txt | 2 + source/ubl-settings-manager-settings.c | 82 ++ source/ubl-settings-manager-theme-gnome.c | 91 +- source/ubl-settings-manager-theme.c | 18 +- source/ubl-settings-manager.c | 960 ++---------------- source/ubl-settings-manager.h | 145 +-- ubl-settings-manager-settings.glade | 206 ++-- ...settings-manager-theme-gnome-section.glade | 7 +- ubl-settings-manager-theme-gnome.glade | 37 +- ubl-settings-manager.glade | 261 +---- 11 files changed, 461 insertions(+), 1349 deletions(-) create mode 100644 source/ubl-settings-manager-settings.c diff --git a/gresource.xml b/gresource.xml index 87d8e0d..15ccfb7 100644 --- a/gresource.xml +++ b/gresource.xml @@ -2,6 +2,7 @@ ubl-settings-manager.glade + ubl-settings-manager-settings.glade ubl-settings-manager-theme-gnome.glade ubl-settings-manager-theme-gnome-section.glade ubl-settings-manager-theme-main.glade diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 3c99c95..ffb5543 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,6 +30,7 @@ add_custom_target(GLADE ubl-settings-manager.glade) set(DEPENDFILES ../ubl-settings-manager.glade + ../ubl-settings-manager-settings.glade ../ubl-settings-manager-theme-gnome.glade ../ubl-settings-manager-theme-gnome-section.glade ../ubl-settings-manager-theme-main.glade @@ -69,6 +70,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin set(SOURCE_FILES ubl-settings-manager.c + ubl-settings-manager-settings.c ubl-settings-manager-theme.c ubl-settings-manager-theme-gnome.c ubl-settings-manager-app-sections.c diff --git a/source/ubl-settings-manager-settings.c b/source/ubl-settings-manager-settings.c new file mode 100644 index 0000000..07c10e0 --- /dev/null +++ b/source/ubl-settings-manager-settings.c @@ -0,0 +1,82 @@ +#include "ubl-settings-manager.h" + +gboolean on_settings_size_changed(GtkRange* , GtkScrollType* , gdouble value, settings_window *window){ + long val = (long)value; + int size = val-val%8; + if (size<24) size=24; + if (size>64) size=64; + window->icon_size = size; + + char *size_full = g_strdup_printf("%dx%d",size,size); + gtk_label_set_text(GTK_LABEL(window->SizeLabel),size_full); + gtk_image_set_from_pixbuf(GTK_IMAGE(window->SizeIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(gtk_icon_theme_get_default(), icon_path,size,1,GTK_ICON_LOOKUP_FORCE_SIZE),NULL)); + free(size_full); + return 0; +} + +void on_settings_accept(GtkWidget *, settings_window *window){ + main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); + yon_window_config_add_instant_parameter(icon_size_parameter,"Settings",&window->icon_size,YON_TYPE_INT); + + char *cur_theme = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->ThemeCombo)); + if (cur_theme) + yon_window_config_add_instant_parameter(theme_parameter,"Settings",cur_theme,YON_TYPE_STRING); + + int double_click = gtk_switch_get_active(GTK_SWITCH(window->DoubleClickSwitch)); + yon_window_config_add_instant_parameter(double_click_parameter,"Settings",&double_click,YON_TYPE_INT); + yon_interface_update(widgets); + on_subwindow_close(window->Window); +} + +settings_window *yon_settings_window_new(){ + settings_window *window = malloc(sizeof(settings_window)); + memset(window,0,sizeof(window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_settings); + window->Window = yon_gtk_builder_get_widget(builder,"Window"); + window->SizeSlider = yon_gtk_builder_get_widget(builder,"SizeSlider"); + window->SizeLabel = yon_gtk_builder_get_widget(builder,"SizeLabel"); + window->SizeIcon = yon_gtk_builder_get_widget(builder,"SizeIcon"); + window->ThemeCombo = yon_gtk_builder_get_widget(builder,"ThemeCombo"); + window->DoubleClickSwitch = yon_gtk_builder_get_widget(builder,"DoubleClickSwitch"); + window->SectionsConfigurationButton = yon_gtk_builder_get_widget(builder,"SectionsConfigurationButton"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_settings_accept),window); + g_signal_connect(G_OBJECT(window->SizeSlider),"change-value",G_CALLBACK(on_settings_size_changed),window); + + int size; + config_str themes = (config_str)g_hash_table_get_keys_as_array(main_config.themes,&size); + qsort(themes,size,sizeof(char*),yon_char_parsed_compare); + for (int i=0;iThemeCombo),themes[i],themes[i]); + } + char *theme_id = NULL; + if (yon_window_config_get_parameter("Settings",theme_parameter,&theme_id,YON_TYPE_STRING)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->ThemeCombo),theme_id); + } else { + gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->ThemeCombo),GNOME_THEME_LABEL); + } + window->icon_size; + if (!yon_window_config_get_parameter("Settings",icon_size_parameter,&window->icon_size,YON_TYPE_INT)){ + window->icon_size=32; + } + gtk_range_set_value(GTK_RANGE(window->SizeSlider),window->icon_size); + + int double_click_activate; + if (!yon_window_config_get_parameter("Settings",double_click_parameter,&double_click_activate,YON_TYPE_BOOLEAN)){ + double_click_activate=0; + } + gtk_switch_set_active(GTK_SWITCH(window->DoubleClickSwitch),double_click_activate); + + return window; +} + +void on_settings_open(GtkWidget *, main_window *widgets){ + settings_window *window = yon_settings_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"settings_window"); + gtk_widget_show(window->Window); + g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); + +} \ No newline at end of file diff --git a/source/ubl-settings-manager-theme-gnome.c b/source/ubl-settings-manager-theme-gnome.c index 4d8ceb3..16eee5a 100644 --- a/source/ubl-settings-manager-theme-gnome.c +++ b/source/ubl-settings-manager-theme-gnome.c @@ -1,19 +1,61 @@ #include "ubl-settings-manager.h" +typedef struct { + GtkWidget *expander; + GtkWidget *AppsList; + app_section *section; +} gnome_section; -void on_gnome_activate(){ +void on_gnome_plug_connected(GtkWidget *,gnome_theme_struct *theme){ + gtk_widget_show(theme->SocketBox); + gtk_widget_hide(theme->HideBox); +} +void on_gnome_plug_disconnected(GtkWidget *,gnome_theme_struct *theme){ + gtk_widget_show(theme->HideBox); + gtk_widget_hide(theme->SocketBox); + on_plug_disconnected(GTK_SOCKET(theme->Socket),main_config.widgets); } -void on_gnome_socket_add(){ +void on_gnome_activate(GtkWidget *,GtkListBoxRow *self, gnome_theme_struct *theme); +void on_gnome_activate(GtkWidget *,GtkListBoxRow *self, gnome_theme_struct *theme){ + theme->Socket = GTK_WIDGET(yon_sockets_init(GTK_BOX(theme->SocketBox))); + g_signal_connect(G_OBJECT(theme->Socket),"plug_added",G_CALLBACK(on_gnome_plug_connected),theme); + g_signal_connect(G_OBJECT(theme->Socket),"destroy",G_CALLBACK(on_gnome_plug_disconnected),theme); + apps *cur_app = g_object_get_data(G_OBJECT(self),"apps"); + char *command = cur_app->Exec;//launch_command(cur_app->Desktop_path); + char *command_args = NULL; + if (cur_app->DualPluggable==1){ + char *save_socket = yon_get_save_socket(); + char *load_socket = yon_get_load_socket(); + char *main_socket_id = yon_char_from_long((long)gtk_socket_get_id(GTK_SOCKET(theme->Socket))); + command_args = launch_args_command(main_socket_id,load_socket,save_socket); + } else if (cur_app->Pluggable){ + char *main_socket_id = yon_char_from_long((long)gtk_socket_get_id(GTK_SOCKET(theme->Socket))); + command_args = yon_char_unite("--socket-id=",main_socket_id,NULL); + } + yon_launch_app_with_arguments(command,command_args); + } -typedef struct { - GtkWidget *expander; - GtkWidget *AppsList; - app_section *section; -} gnome_section; +void on_gnome_selected(GtkWidget *self_list,GtkListBoxRow *self, gnome_theme_struct *theme); +void on_gnome_selected(GtkWidget *self_list,GtkListBoxRow *self, gnome_theme_struct *theme){ + GList *list = gtk_container_get_children(GTK_CONTAINER(theme->AppsTree)); + GList *iter; + for (iter=list;iter;iter=iter->next){ + gnome_section *cur_section = g_object_get_data(G_OBJECT(iter->data),"gnome_section"); + if (cur_section->AppsList != self_list){ + g_signal_handlers_block_by_func(G_OBJECT(cur_section->AppsList),G_CALLBACK(on_gnome_selected),theme); + gtk_list_box_unselect_all(GTK_LIST_BOX(cur_section->AppsList)); + g_signal_handlers_unblock_by_func(G_OBJECT(cur_section->AppsList),G_CALLBACK(on_gnome_selected),theme); + } + } +} + +void on_gnome_socket_add(){ + +} gnome_section *yon_gnome_section_new(){ gnome_section *cur_section = malloc(sizeof(gnome_section)); @@ -26,21 +68,32 @@ gnome_section *yon_gnome_section_new(){ void yon_gnome_section_setup_apps(gnome_section *cur_section, const char *target){ apps *cur_app = yon_apps_get((char*)target); - GtkWidget *Image = gtk_image_new_from_icon_name(cur_app->Icon,GTK_ICON_SIZE_BUTTON); + GtkIconInfo *info = gtk_icon_theme_lookup_icon_for_scale(gtk_icon_theme_get_default(), !yon_char_is_empty(cur_app->Icon)?cur_app->Icon:icon_path, main_config.apps_icon_size,1,GTK_ICON_LOOKUP_FORCE_SIZE); + GtkWidget *Image = NULL; + if (info){ + Image = gtk_image_new_from_pixbuf(gtk_icon_info_load_icon(info,NULL)); + } else { + info = gtk_icon_theme_lookup_icon_for_scale(gtk_icon_theme_get_default(), icon_path, main_config.apps_icon_size,1,GTK_ICON_LOOKUP_FORCE_SIZE); + Image = gtk_image_new_from_pixbuf(gtk_icon_info_load_icon(info,NULL)); + + } GtkWidget *Label = gtk_label_new(cur_app->Name); GtkWidget *Row = gtk_list_box_row_new(); GtkWidget *Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); - // g_signal_connect(G_OBJECT(theme->AppsTree),"row-activated",G_CALLBACK(on_gnome_activate),theme); - g_object_set_data(G_OBJECT(Row),"gnome_section",cur_section); + gtk_container_add(GTK_CONTAINER(Row),Box); gtk_box_pack_start(GTK_BOX(Box),Image,0,0,0); gtk_box_pack_start(GTK_BOX(Box),Label,0,0,0); gtk_label_set_xalign(GTK_LABEL(Label),0); gtk_list_box_insert(GTK_LIST_BOX(cur_section->AppsList),Row,-1); + + g_object_set_data(G_OBJECT(Row),"gnome_section",cur_section); + g_object_set_data(G_OBJECT(Row),"apps",cur_app); + gtk_widget_show_all(Row); } -void yon_gnome_section_setup(GtkBox *target,app_section *section){ +void yon_gnome_section_setup(gnome_theme_struct *theme,app_section *section){ gnome_section *cur_section = yon_gnome_section_new(); cur_section->section = section; gtk_expander_set_label(GTK_EXPANDER(cur_section->expander),section->name); @@ -49,7 +102,10 @@ void yon_gnome_section_setup(GtkBox *target,app_section *section){ for(int i=0;iexpander,0,0,0); + gtk_box_pack_start(GTK_BOX(theme->AppsTree),cur_section->expander,0,0,0); + g_object_set_data(G_OBJECT(cur_section->expander),"gnome_section",cur_section); + g_signal_connect(G_OBJECT(cur_section->AppsList),"row-activated",G_CALLBACK(on_gnome_activate),theme); + g_signal_connect(G_OBJECT(cur_section->AppsList),"row-selected",G_CALLBACK(on_gnome_selected),theme); } int yon_gnome_update(gnome_theme_struct *theme){ @@ -66,7 +122,7 @@ int yon_gnome_update(gnome_theme_struct *theme){ dictionary *cur; for_dictionaries(cur,main_config.sections){ app_section *section_data = yon_dictionary_get_data(cur,app_section*); - yon_gnome_section_setup(GTK_BOX(theme->AppsTree),section_data); + yon_gnome_section_setup(theme,section_data); } return 1; } @@ -80,11 +136,14 @@ gnome_theme_struct *yon_gnome_theme_new(){ theme->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox"); theme->GnomePaned = yon_gtk_builder_get_widget(builder,"GnomePaned"); theme->GnomeInfoLogoImage = yon_gtk_builder_get_widget(builder,"GnomeInfoLogoImage"); + theme->HideBox = yon_gtk_builder_get_widget(builder,"HideBox"); theme->IconCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"IconCell")); - theme->Socket = NULL; - theme->get_command_func = NULL; + theme->theme_name = yon_char_new(GNOME_THEME_LABEL); + theme->Socket = gtk_socket_new(); theme->list_update_func = (int(*)(struct gnome_theme_struct*))yon_gnome_update; - theme->set_sections_func = NULL; + + gtk_box_pack_start(GTK_BOX(theme->SocketBox),theme->Socket,1,1,0); + gtk_widget_show(theme->Socket); g_signal_connect(G_OBJECT(theme->SocketBox),"add",G_CALLBACK(on_gnome_socket_add),theme); // gtk_cell_renderer_set_fixed_size(theme->IconCell,main_config.apps_icon_size,main_config.apps_icon_size); diff --git a/source/ubl-settings-manager-theme.c b/source/ubl-settings-manager-theme.c index a2c7ce3..4eee16f 100644 --- a/source/ubl-settings-manager-theme.c +++ b/source/ubl-settings-manager-theme.c @@ -6,7 +6,7 @@ theme_struct *yon_theme_update(main_window *widgets){ theme_id = yon_char_new(GNOME_THEME_LABEL); } - theme_struct *theme = g_hash_table_lookup(main_config.themes,theme_id); + theme_struct *theme = ((theme_struct*(*)())g_hash_table_lookup(main_config.themes,theme_id))(); if (theme){ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->ThemeBox)); GList *iter; @@ -25,10 +25,14 @@ theme_struct *yon_theme_update(main_window *widgets){ } void yon_theme_init(){ - theme_struct *gnome_struct = (theme_struct*)yon_gnome_theme_new(); - theme_struct *main_struct = (theme_struct*)yon_main_theme_new(); - g_hash_table_insert(main_config.themes,yon_char_new(GNOME_THEME_LABEL),gnome_struct); - g_hash_table_insert(main_config.themes,yon_char_new(MAIN_THEME_LABEL),main_struct); + // theme_struct *gnome_struct = (theme_struct*)yon_gnome_theme_new(); + // theme_struct *main_struct = (theme_struct*)yon_main_theme_new(); + g_hash_table_insert(main_config.themes,yon_char_new(GNOME_THEME_LABEL),yon_gnome_theme_new); + g_hash_table_insert(main_config.themes,yon_char_new(MAIN_THEME_LABEL),yon_main_theme_new); +} + +void yon_main_update(main_theme_struct *theme){ + } void on_main_activate(){ @@ -40,14 +44,16 @@ void on_main_socket_add(){ } main_theme_struct *yon_main_theme_new(){ - main_theme_struct *theme = malloc(sizeof(gnome_theme_struct)); + main_theme_struct *theme = malloc(sizeof(main_theme_struct)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_main_theme); theme->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); theme->AppsIconView = yon_gtk_builder_get_widget(builder,"AppsIconView"); theme->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox"); theme->AppsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AppsList")); + theme->theme_name = yon_char_new(MAIN_THEME_LABEL); theme->Socket = NULL; + theme->list_update_func = (int(*)(struct main_theme_struct*))yon_main_update; g_signal_connect(G_OBJECT(theme->AppsIconView),"item-activated",G_CALLBACK(on_main_activate),theme); g_signal_connect(G_OBJECT(theme->SocketBox),"add",G_CALLBACK(on_main_socket_add),theme); diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index 125f48f..2cee476 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -4,161 +4,6 @@ config main_config; -// void on_plug_added(GtkSocket* self, main_window *builder){ -// gtk_widget_show(builder->socketbutton); -// gtk_widget_show(builder->ThirdSocket); -// gtk_widget_set_vexpand(builder->HideWhileLaunch,0); -// gtk_widget_hide(builder->HideWhileLaunch); -// gtk_widget_set_vexpand(GTK_WIDGET(builder->socketplace),1); -// gtk_widget_set_vexpand(GTK_WIDGET(self),1); -// gtk_widget_show(builder->socketplace); -// gtk_widget_hide(builder->appSettings); -// if (builder->ButtonBackToMain!=NULL) gtk_widget_show(builder->ButtonBackToMain); -// gtk_widget_show(GTK_WIDGET(self)); -// gtk_widget_show(builder->socketbuttonplace); -// gtk_widget_show(builder->ThirdSocketPlace); -// gtk_widget_show(builder->socketbutton); -// gtk_widget_show(builder->ThirdSocket); -// } - -// void on_plug_removed(GtkSocket* self, main_window *widgets){ -// on_backToSettingsButton_clicked(widgets->ButtonBackToMain,widgets); -// gtk_widget_show(widgets->socketbuttonplace); -// gtk_widget_show(widgets->appSettings); -// gtk_widget_show(widgets->HideWhileLaunch); -// gtk_widget_set_vexpand(widgets->socketplace,0); -// gtk_widget_set_vexpand(widgets->HideWhileLaunch,1); -// } - -// void on_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *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); - -// apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); -// if (!tempapp){}else{ -// char *arg=NULL; -// arg=yon_char_get_augumented("--socket-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket)))); - -// if (tempapp[0].Type==1){ -// if (tempapp->Pluggable==1) -// if (tempapp->DualPluggable==1){ -// char *dualarg=NULL; -// dualarg=yon_char_get_augumented("--socket-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket))),yon_char_get_augumented(" --socket-ext-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))),yon_char_get_augumented(" --socket-trd-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket)))))))); -// launch_app_with_arguments(tempapp[0].Exec,dualarg); -// } else -// launch_app_with_arguments(tempapp[0].Exec,arg); -// else launch_app(tempapp[0].Exec); -// } -// } -// }; - -// void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *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); - -// apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); -// char *arg=NULL; -// arg=yon_char_get_augumented("--socket-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket)))); -// if (tempapp[0].Type==1){ -// if (tempapp->Pluggable==1){ - -// if (tempapp->DualPluggable==1){ -// char *dualarg=NULL; -// dualarg=yon_char_get_augumented("--socket-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socket))),yon_char_get_augumented(" --socket-ext-id=",yon_char_get_augumented(yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))),yon_char_get_augumented(" --socket-trd-id=",yon_char_from_int((int)gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket)))))))); -// if (launch_app_with_arguments(tempapp[0].Exec,dualarg)==32512) -// gtk_widget_show(applist->infoWarningWindow); -// } -// else{ -// launch_app_with_arguments(tempapp[0].Exec,arg); -// gtk_widget_destroy(applist->socketbutton); -// } -// } -// else { -// launch_app(tempapp[0].Exec); -// gtk_widget_destroy(applist->socketbutton); -// } -// } -// } - -// void on_item_selection_changed(GtkIconView *IV, main_window *widgets){ -// if (gtk_icon_view_get_selected_items(IV)>0){ -// dictionary *next=widgets->ICSys->first; -// for (dictionary *dct=next;dct!=NULL;dct=dct->next){ -// IVGraphicals *IVG=(IVGraphicals*)dct->data; -// if (GTK_ICON_VIEW(IVG->IV)!=GTK_ICON_VIEW(IV)) -// if (gtk_icon_view_get_selected_items(GTK_ICON_VIEW(IVG->IV))>0) -// gtk_icon_view_unselect_all(GTK_ICON_VIEW(IVG->IV)); -// } -// } -// }; -// void on_about_link(GtkWidget* self,gchar* uri,gpointer user_data){ -// gtk_widget_destroy(self); -// on_ButtonOpenHelp_activated(NULL,user_data); -// } -// void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder){ -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,"AlwaysOpenHelpCheckbox")))) -// { -// #ifdef WEBKIT_FOUND -// GtkBuilder *web_builder=gtk_builder_new_from_resource(GladePath); -// GtkWidget *browser=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Window")); -// GtkWidget *web_place=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Place")); -// GtkWidget *WebView=webkit_web_view_new(); -// webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),UBLINUX_WIKI_LINK); -// gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); -// gtk_widget_show_all(browser); -// #else -// if(system(UBLINUX_WIKI_COMMAND)){}; -// #endif -// } else -// { -// GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); -// gtk_widget_show(window); -// }; -// }; - -// void on_backToSettingsButton_clicked(GtkWidget *button,main_window *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=NULL; -// GtkWidget *backbutton=sctb->ButtonBackToMain; -// gtk_widget_hide(backbutton); -// }; - -// void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder){ -// GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); -// gtk_widget_hide(window); -// }; - -// void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder){ -// #ifdef WEBKIT_FOUND -// GtkBuilder *web_builder=gtk_builder_new_from_resource(GladePath); -// GtkWidget *browser=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Window")); -// GtkWidget *web_place=GTK_WIDGET(gtk_builder_get_object(web_builder,"Web_Place")); -// GtkWidget *WebView=webkit_web_view_new(); -// webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),UBLINUX_WIKI_LINK); -// gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); -// gtk_widget_show_all(browser); -// #else -// if(system(UBLINUX_WIKI_COMMAND)){}; -// #endif -// GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); -// gtk_widget_hide(window); -// }; - // int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ // if (main_config.WindowTheme==0) // main_config.curThemeName="Main"; @@ -260,84 +105,6 @@ config main_config; // gtk_widget_hide(widgets->SettingsWindow); // }; -// void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, main_window *widgets){ -// int position=gtk_paned_get_position(GTK_PANED(widgets->GnomePaned)); -// if (position<200) {position=200; gtk_paned_set_position(GTK_PANED(widgets->GnomePaned),200);} -// main_config.iconSegmentSize=position; -// double pos=((double)position-20); -// if (pos<50) pos=50; -// for (dictionary *dict=widgets->ICSys;dict!=NULL;dict=dict->next){ -// IVGraphicals *IV=(IVGraphicals*)dict->data; -// gtk_icon_view_set_item_width(GTK_ICON_VIEW(IV->IV),pos); -// } - - -// } - -// int on_settingsOpen(GtkWidget *button, main_window *widgets){ -// gtk_window_set_title(GTK_WINDOW(widgets->SettingsWindow),UBL_SETTINGS_MANAGER_TITLE); -// gtk_widget_set_size_request(widgets->SettingsWindow,400,250); -// GtkIconTheme *icthm=gtk_icon_theme_get_default(); -// gtk_window_set_icon(GTK_WINDOW(widgets->SettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_widget_show_all(widgets->SettingsWindow); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),main_config.WindowTheme); -// gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); -// int sz=1; -// if (*main_config.currentThemeIconSize==64) sz=4; -// if (*main_config.currentThemeIconSize==48) sz=3; -// if (*main_config.currentThemeIconSize==32) sz=2; -// if (*main_config.currentThemeIconSize==24) sz=1; -// gtk_range_set_value(GTK_RANGE(widgets->settingsSizeSlider),sz); -// char *tmp=malloc(6); -// sprintf(tmp,"%dx%d\0",*main_config.currentThemeIconSize,*main_config.currentThemeIconSize); -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),tmp); -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); - -// gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); -// }; - -// int on_settings_icon_size_changed(GtkWidget* self, main_window *widgets){ -// int val=(int)gtk_range_get_value(GTK_RANGE(self)); -// GtkIconTheme *icthm=gtk_icon_theme_get_default(); -// if ((int)val==1||(int)val==0){ -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); -// if (*main_config.currentThemeIconSize!=24) -// main_config.changed=1; -// *main_config.currentThemeIconSize=24; -// } -// if ((int)val==2){ -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); -// if (*main_config.currentThemeIconSize!=32) -// main_config.changed=1; -// *main_config.currentThemeIconSize=32; -// } -// if ((int)val==3){ -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); -// if (*main_config.currentThemeIconSize!=48) -// main_config.changed=1; -// *main_config.currentThemeIconSize=48; -// } -// if ((int)val==4){ -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); -// if (*main_config.currentThemeIconSize!=64) -// main_config.changed=1; -// *main_config.currentThemeIconSize=64; -// } -// }; - -// int on_settings_cancel(GtkWidget *button, main_window *widgets){ -// gtk_widget_hide(widgets->SettingsWindow); -// setup_config(); -// }; - -// void on_caution_understand(GtkWidget *button,main_window *widgets){ -// gtk_widget_hide(widgets->CautionWindow); -// } - // void on_section_settings_open(GtkButton* self,dictionary *cWidgets){ // main_window *widgets=(main_window*)cWidgets->data; // if (main_config.SettingsSections->first->data==NULL){ @@ -564,60 +331,19 @@ config main_config; // } - -// void on_theme_selection_changed(GtkWidget *self, main_window *widgets){ -// int *icsize; -// int curthm=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); -// if (curthm==0){ -// main_config.currentThemeIconSize=&main_config.Mainiconsize; -// main_config.currentThemeLabelSize=&main_config.MainlabelSize; -// main_config.currentDoubleClick=&main_config.MainDoubleClick; -// icsize=main_config.currentThemeIconSize; -// } -// else if (curthm==1){ -// main_config.currentThemeIconSize=&main_config.Gnomeiconsize; -// main_config.currentThemeLabelSize=&main_config.GnomelabelSize; -// main_config.currentDoubleClick=&main_config.GnomeDoubleClick; -// icsize=main_config.currentThemeIconSize; -// } -// gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); -// GtkIconTheme *icthm=gtk_icon_theme_get_default(); -// if (*icsize==24 || *icsize==1){ -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),1.0); -// *icsize=24; -// } else if (*icsize==32 || *icsize==2){ -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),2.0); -// *icsize=32; -// } else if (*icsize==48 || *icsize==3){ -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),3.0); -// *icsize=48; -// } else{ -// gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); -// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); -// gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),4.0); -// *icsize=64; -// } -// } - void on_reveal_banner(GtkWidget *, main_window *widgets){ if (gtk_revealer_get_reveal_child(GTK_REVEALER(widgets->BannerRevealer))){ gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT); gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->BannerRevealer),0); gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerArrow),GTK_ARROW_RIGHT); int banner = 1; - yon_window_config_add_instant_parameter("HideBanner","Settings",&banner,YON_TYPE_BOOLEAN); + yon_window_config_add_instant_parameter(hide_banner_parameter,"Settings",&banner,YON_TYPE_BOOLEAN); } else { gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT); gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->BannerRevealer),1); gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerArrow),GTK_ARROW_LEFT); int banner = 0; - yon_window_config_add_instant_parameter("HideBanner","Settings",&banner,YON_TYPE_BOOLEAN); + yon_window_config_add_instant_parameter(hide_banner_parameter,"Settings",&banner,YON_TYPE_BOOLEAN); } } @@ -626,51 +352,6 @@ void on_reveal_banner(GtkWidget *, main_window *widgets){ // update_double_clicks(widgetsD); // } -// void on_about(GtkWidget *button, GtkBuilder *buildr){ -// GtkBuilder *builder = gtk_builder_new_from_resource(GladePath); -// GtkWidget *AboutButtons = GTK_WIDGET(gtk_builder_get_object(builder,"AboutButtons")); -// GtkWidget *AboutHeadLabel = GTK_WIDGET(gtk_builder_get_object(builder,"aboutHeadLabel")); -// GtkWidget *About = GTK_WIDGET(gtk_builder_get_object(builder, "ublAbloutWindow")); -// gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_COMMENTS_LABEL)); -// gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(About),_(UBL_SETTINGS_MANAGER_TITLE)); -// gtk_label_set_text(GTK_LABEL(AboutHeadLabel),UBL_SETTINGS_MANAGER_ABOUT_TITLE); -// gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(About),version_application); -// gtk_widget_show(About); -// 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_about_dialog_set_website_label(GTK_ABOUT_DIALOG(About),_(ABOUT_PROJECT_HOME_PAGE_LABEL)); -// } - -// int launch(thread_output *thread){ -// int a=0; -// a=system(thread->command); -// *thread->exitcode=a; -// return *thread->exitcode; -// } - -// int launch_app_with_arguments(char *name, char *args){ -// char *path=yon_char_get_augumented("/usr/bin/",name); -// path=yon_char_get_augumented(path," "); -// path=yon_char_get_augumented(path,args); -// pthread_t thread_id; -// thread_output *thread=malloc(sizeof(thread_output)); -// thread->command=path; -// thread->exitcode=malloc(sizeof(int)); -// pthread_create(&thread_id, NULL, (void*)launch, thread); -// return *thread->exitcode; -// }; - -// int launch_app(char *name){ -// char *path=name; -// thread_output *thread=malloc(sizeof(thread_output)); -// thread->command=path; -// thread->exitcode=malloc(sizeof(int)); -// pthread_t thread_id; -// pthread_create(&thread_id, NULL, (void*)launch, thread); -// return *thread->exitcode; -// }; - // int py_launch_app(char *name,char *args){ // char *path=malloc(strlen("python ./")+strlen(name)+6+strlen(args)); // sprintf(path,"python ./%s.py %s &",name,args); @@ -682,13 +363,6 @@ void on_reveal_banner(GtkWidget *, main_window *widgets){ // return *thread->exitcode; // }; -// apps *get_app_by_name(apps *applist,char *name, int size){ -// for (int i=0;iIV),GTK_TREE_MODEL(section->LV)); // } @@ -750,140 +424,7 @@ void on_reveal_banner(GtkWidget *, main_window *widgets){ // } // } -// GtkWidget *create_socket(main_window *builder){ -// GtkWidget *socket; -// socket = gtk_socket_new(); -// GtkWidget *socketbutton=gtk_socket_new(); -// GtkWidget *ThirdSocket=gtk_socket_new(); -// g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(on_plug_added),builder); -// g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(on_plug_removed),builder); -// g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(on_plug_removed),builder); -// gtk_box_pack_start(GTK_BOX(builder->socketplace),socket,true,true,0); -// gtk_box_pack_start(GTK_BOX(builder->socketbuttonplace),socketbutton,1,1,0); -// builder->socketbutton=socketbutton; -// gtk_box_pack_start(GTK_BOX(builder->ThirdSocketPlace),ThirdSocket,1,1,0); -// builder->ThirdSocket=ThirdSocket; -// return socket; -// }; - -// void sort_apps(apps *applist,int size){ -// apps tmp; -// if (size>2) -// { -// for (int i=1;id_name); -// file=fopen(path,"r"); -// if (strlen(de->d_name)>9) -// { -// char *extension=strstr(path,"."); -// if (extension!=NULL) -// { -// if (strcmp(extension,".desktop")==0) -// { -// apps tempapp; -// GKeyFile *gfile=g_key_file_new(); -// g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); -// char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL); -// if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; -// tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); -// if (tempapp.Name==NULL) continue; -// tempapp.Categories=g_key_file_get_string(gfile,"Desktop Entry", "Categories",NULL); -// if (tempapp.Categories==NULL) continue; -// tempapp.Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); -// if (tempapp.Exec==NULL) continue; -// tempapp.Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); -// if (tempapp.Icon==NULL) continue; -// tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL); -// if (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); -// if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); -// if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==0) -// if (size==0){ -// applist=(apps*)malloc(size+1*sizeof(apps)); -// applist[0].Name=yon_char_new(tempapp.Name); -// applist[0].Categories=yon_char_new(tempapp.Categories); -// applist[0].Exec=yon_char_new(tempapp.Exec); -// applist[0].Icon=yon_char_new(tempapp.Icon); -// applist[0].Type=tempapp.Type; -// applist[0].Pluggable=tempapp.Pluggable; -// applist[0].DualPluggable=tempapp.DualPluggable; -// size++; -// } else { -// applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); -// applist[size].Name=yon_char_new(tempapp.Name); -// applist[size].Categories=yon_char_new(tempapp.Categories); -// applist[size].Exec=yon_char_new(tempapp.Exec); -// applist[size].Icon=yon_char_new(tempapp.Icon); -// applist[size].Pluggable=tempapp.Pluggable; -// applist[size].DualPluggable=tempapp.DualPluggable; -// applist[size].Type=tempapp.Type; -// size++; -// } -// } -// } -// } -// } -// } -// *sizef=size; -// return applist; -// }; -// int check_categories(apps app, char *catstocheck){ -// if (!catstocheck || strcmp(catstocheck,"")==0||strcmp(catstocheck,";")==0){ -// char *found=strstr(app.Categories,"X-UBL-SettingsManager"); -// char *perfound=strstr(app.Categories,"X-UBL-PersonalSettings"); -// char *harfound=strstr(app.Categories,"X-UBL-HardwareSettings"); -// char *sysfound=strstr(app.Categories,"X-UBL-SystemSettings"); -// if (found!=NULL&&(perfound==NULL&&harfound==NULL&&sysfound==NULL)) return 1; -// else if (found==NULL)return 0; -// } else -// { -// char *left_cats=catstocheck; -// char *cat=strstr(left_cats,";"); -// if (!cat) return 0; -// char *find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); -// char *found=strstr(app.Categories,find_it); -// int to_find=0, n_found=0; -// to_find++; -// if (!found) return 0; -// n_found++; -// while (cat){ -// left_cats=cat+1; -// char *fcat=app.Categories; -// cat=strstr(cat+1,";"); -// if (!cat) break; -// find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); -// char *found=strstr(app.Categories,find_it); -// to_find++; -// if (!found) break; -// n_found++; -// left_cats=cat+1; -// if (strlen(left_cats)==0 ||strcmp(left_cats,"")==0) break; -// } -// if (to_find==n_found) return 1; else return 0; -// } -// }; void config_init(){ main_config.sections=NULL; @@ -895,426 +436,96 @@ void config_init(){ yon_theme_init(); }; -// // void save_config(main_window *widgets){ -// // if (main_config.lock_settings==1) -// // return; -// // GKeyFile *gfile=g_key_file_new(); -// // int sz=1,szm=1; -// // if (main_config.Gnomeiconsize==64) sz=4; -// // else if (main_config.Gnomeiconsize==48) sz=3; -// // else if (main_config.Gnomeiconsize==32) sz=2; -// // else if (main_config.Gnomeiconsize==24) sz=1; -// // else sz=3; -// // if (main_config.Mainiconsize==64) szm=4; -// // else if (main_config.Mainiconsize==48) szm=3; -// // else if (main_config.Mainiconsize==32) szm=2; -// // else if (main_config.Mainiconsize==24) szm=1; -// // else szm=3; -// // char *fromint=malloc(5); -// // memset(fromint,0,5); -// // GError *err=NULL; -// // char *login=getlogin(); -// // if (geteuid()==0){ -// // login=main_config.lastUser; -// // } else { -// // main_config.lastUser=login; -// // } -// // char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); -// // sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); -// // g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); -// // if (err){ -// // struct stat st = {0}; -// // char *ptdir=malloc(36+strlen(getlogin())); -// // sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); -// // if (stat(ptdir, &st) == -1) { -// // mkdir(ptdir, 0777); -// // } -// // FILE *fp; -// // fp=fopen(pth,"w"); -// // fclose(fp); -// // } -// // g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); -// // if (main_config.fullscreen==0){ -// // sprintf(fromint,"%d",main_config.windowPosX); -// // g_key_file_set_string(gfile,"window","WindowPosX",fromint); -// // sprintf(fromint,"%d",main_config.windowPosY); -// // g_key_file_set_string(gfile,"window","WindowPosY",fromint); -// // sprintf(fromint,"%d",main_config.windowWidth); -// // g_key_file_set_string(gfile,"window","WindowWidth",fromint); -// // sprintf(fromint,"%d",main_config.windowHeight); -// // g_key_file_set_string(gfile,"window","WindowHeight",fromint); -// // } -// // g_key_file_set_boolean(gfile,"window","fullscreen",main_config.fullscreen); -// // g_key_file_set_boolean(gfile,"window","BannerHidden",main_config.BannerHidden); -// // g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick); -// // g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick); -// // sprintf(fromint,"%d",main_config.WindowTheme); -// // g_key_file_set_string(gfile,"window","WindowTheme",fromint); -// // sprintf(fromint,"%d",sz); -// // g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); -// // sprintf(fromint,"%d",szm); -// // g_key_file_set_string(gfile,"window","MainIconSize",fromint); -// // sprintf(fromint,"%d",main_config.iconSegmentSize); -// // g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); -// // sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); -// // g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); -// // sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); -// // g_key_file_set_string(gfile,"window","MainLabelSize",fromint); -// // sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); -// // g_key_file_set_string(gfile,"window","LabelDensity",fromint); -// // g_key_file_set_string(gfile,"window","User",login); -// // if (main_config.lock_settings==0) -// // g_key_file_save_to_file(gfile,pth,NULL); -// // } - -// void yon_set_default_sections(dictionary *section){ -// yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;"); -// yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;"); -// yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;"); -// yon_section_new(section,"Misc",""); -// } - -// IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ -// IVGraphicals *IVG = malloc(sizeof(IVGraphicals)); -// GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); -// GtkBuilder *builder = gtk_builder_new_from_resource(GladePath); -// GtkWidget *iv = GTK_WIDGET(gtk_builder_get_object(builder,"iconTemplate")); -// gtk_widget_show(iv); -// GtkWidget *label = gtk_label_new(_(name)); -// GtkCellRendererPixbuf *iconRender = GTK_CELL_RENDERER_PIXBUF(gtk_builder_get_object(builder, "iconPic")); -// PangoAttrList *attrs = pango_attr_list_new(); -// PangoFontDescription *descr = pango_font_description_new(); -// pango_font_description_set_weight(descr,PANGO_WEIGHT_BOLD); -// int stretch = main_config.labelDensity; -// if (stretch>8) -// stretch = 4; -// pango_font_description_set_stretch(descr,main_config.labelDensity); -// pango_attr_list_insert(attrs,pango_attr_size_new(*main_config.currentThemeLabelSize)); -// pango_attr_list_insert(attrs, pango_attr_font_desc_new(descr)); -// gtk_label_set_attributes(GTK_LABEL(label),attrs); -// gtk_widget_set_margin_end(label,6); -// gtk_widget_set_margin_start(label,6); -// gtk_widget_set_margin_bottom(label,2); -// gtk_icon_view_set_spacing(GTK_ICON_VIEW(iv),20); -// if (main_config.WindowTheme==1) { -// gtk_icon_view_set_columns(GTK_ICON_VIEW(iv),1); -// gtk_widget_set_name(iv,"GnomeIcon"); -// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.GnomeDoubleClick); -// gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); -// } else { -// gtk_icon_view_set_item_padding(GTK_ICON_VIEW(iv),3); -// gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); -// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.MainDoubleClick); -// gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(iv),2); -// } -// GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); -// GtkListStore *lv=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststoreTemplate")); -// gtk_widget_set_name(sep,"SepIcon"); -// gtk_widget_set_halign(box,0); -// gtk_widget_set_valign(box,1); -// gtk_widget_set_margin_end(sep,6); -// gtk_widget_set_margin_start(sep,6); -// gtk_icon_view_set_model(GTK_ICON_VIEW(iv),GTK_TREE_MODEL(lv)); -// gtk_label_set_xalign(GTK_LABEL(label),0); -// gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,0); -// gtk_box_pack_start(GTK_BOX(box),sep,FALSE,FALSE,0); -// gtk_box_pack_start(GTK_BOX(box),iv,FALSE,FALSE,0); -// IVG->sectionName=name; -// IVG->categories=cats; -// IVG->LV = lv; -// IVG->Box = box; -// IVG->IV = iv; -// IVG->label = label; -// IVG->sep = sep; -// IVG->iconRender = iconRender; -// return IVG; -// } - -// dictionary *yon_create_icon_section_list(dictionary *sections){ -// if (!sections) -// return NULL; -// IVGraphicals *IVSections; -// dictionary *IVDict=NULL; -// sections=sections->first; -// while (sections!=NULL){ -// IconSection *name=(IconSection*)sections->data; -// IVSections=yon_create_single_section_IV(name->section,name->categories); -// if (!IVDict) { -// IVDict=yon_dictionary_create_empty(); -// IVDict->key=name->section; -// IVDict->data=IVSections; -// IVDict->first=IVDict; -// } else { -// IVDict=yon_dictionary_create_conneced(IVDict); -// IVDict->key=name->section; -// IVDict->data=IVSections; -// } -// sections=sections->next; -// } -// IVDict->next=NULL; -// return IVDict->first; -// } - -// void yon_check_path(char *path){ -// FILE *fp; -// char *pth=malloc(255); -// memset(path,0,255); -// fp = popen("screenfetch -n -w -N", "r"); -// fgets(pth, 255,fp)!=NULL; -// } - -// dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ -// IconSection *sct=malloc(sizeof(IconSection)); -// sct->section=section_name; -// sct->categories=categories; -// if (!section->data&&!section->prev){ -// section->data=sct; -// section->first=section; -// section->key=section_name; -// } else { -// section=yon_dictionary_get_last(section); -// section->next=yon_dictionary_create_conneced(section); -// section->next->data=sct; -// section->next->key=section_name; -// section=section->next; -// } - -// return section; -// } - -// void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned){ -// for (dictionary *dict=icdict->first;dict!=NULL;dict=dict->next){ -// IVGraphicals *icv=(IVGraphicals*)dict->data; -// int width=gtk_paned_get_position(GTK_PANED(paned)); -// int pos=(int)((double)width-20); -// if (pos < 100) pos=100; - -// gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),pos); -// } -// } - -// int yon_show_icon_views(dictionary *IVS,main_window *widgets){ -// for (dictionary *dct=IVS->first;dct!=NULL;dct=dct->next){ -// IVGraphicals *iv=dct->data; -// gtk_widget_show_all(iv->Box); -// gtk_box_pack_start(GTK_BOX(widgets->icvpack),iv->Box,FALSE,FALSE,0); -// if (main_config.WindowTheme==0) -// g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_Item_activated),widgets); -// else if (main_config.WindowTheme==1) -// g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_gnome_Item_activated),widgets); -// g_signal_connect(G_OBJECT(iv->IV),"selection-changed",G_CALLBACK(on_item_selection_changed),widgets); - -// } -// } - -// void yon_switch_theme(dictionary **dict, dictionary *newone){ -// dictionary *dct=*dict; -// main_window *widgets=(main_window*)dct->data; - -// gtk_widget_hide(widgets->window); -// *dict=newone; -// dct=*dict; -// widgets=(main_window*)dct->data; -// gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); -// gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); -// if (strcmp(dct->key,"Gnome")==0){ -// main_config.currentThemeIconSize=&main_config.Gnomeiconsize; -// main_config.currentThemeLabelSize=&main_config.GnomelabelSize; -// int x,y; -// GdkRectangle workarea; -// gdk_monitor_get_workarea(gdk_display_get_monitor(gdk_screen_get_display(gtk_window_get_screen(GTK_WINDOW(widgets->window))),0),&workarea); -// gtk_window_get_size(GTK_WINDOW(widgets->window),&x, &y); -// if (workarea.width<1240&&workarea.height<720){ -// gtk_widget_show(widgets->CautionWindow); -// dictionary *founddict=yon_dictionary_find(dict,"Main"); -// dct=yon_dictionary_find(dict,"Gnome"); -// yon_switch_theme(&dct,founddict); -// gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); -// gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); -// main_config.WindowTheme=0; -// main_config.curThemeName="Main"; -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),0); -// gtk_window_present(GTK_WINDOW(widgets->CautionWindow)); -// }else{ -// main_config.WindowTheme=1; -// main_config.curThemeName="Gnome"; -// gtk_widget_show(widgets->window); -// gtk_widget_hide(widgets->MenuItemAboutSystem); -// } - -// } else { -// main_config.currentThemeIconSize=&main_config.Mainiconsize; -// main_config.currentThemeLabelSize=&main_config.MainlabelSize; -// gtk_widget_show(widgets->window); -// main_config.WindowTheme=0; -// main_config.curThemeName="Main"; -// gtk_widget_show(widgets->MenuItemAboutSystem); -// } - - -// } - -// int yon_get_icon_size(int size){ -// if (size==1||size==24) return 24; -// if (size==2||size==32) return 32; -// if (size==3||size==48) return 48; -// if (size==4||size==64) return 64; -// } - -// void yon_icon_size_convert(int mode){ -// if (mode==0){ -// if (*main_config.currentThemeIconSize==1) *main_config.currentThemeIconSize=24; -// if (*main_config.currentThemeIconSize==2) *main_config.currentThemeIconSize=32; -// if (*main_config.currentThemeIconSize==3) *main_config.currentThemeIconSize=48; -// if (*main_config.currentThemeIconSize==4) *main_config.currentThemeIconSize=64; -// } else if (mode==1){ -// if (*main_config.currentThemeIconSize==24) *main_config.currentThemeIconSize=1; -// if (*main_config.currentThemeIconSize==32) *main_config.currentThemeIconSize=2; -// if (*main_config.currentThemeIconSize==48) *main_config.currentThemeIconSize=3; -// if (*main_config.currentThemeIconSize==64) *main_config.currentThemeIconSize=4; -// } -// } - -// SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ -// SectionSettingSegment *segment=malloc(sizeof(SectionSettingSegment)); -// segment->MainFrame=gtk_frame_new(NULL); -// gtk_frame_set_shadow_type(GTK_FRAME(segment->MainFrame),GTK_SHADOW_IN); -// segment->MainBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// segment->ElemBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// gtk_widget_set_size_request(segment->ElemBox,0,20); -// segment->DragButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// gtk_widget_set_name(segment->DragButtonBox,"noborders"); -// segment->DragUpButton=gtk_button_new_from_icon_name("go-top-symbolic",GTK_ICON_SIZE_BUTTON); -// segment->DragDownButton=gtk_button_new_from_icon_name("go-bottom-symbolic",GTK_ICON_SIZE_BUTTON); -// segment->NameBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// segment->CategoriesBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// segment->OptionBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// segment->NameEntry=gtk_entry_new(); -// gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),name); -// segment->NameLabel=gtk_label_new(name); -// segment->CategoriesEntry=gtk_entry_new(); -// if (categories[strlen(categories)-1]!=';'){ -// categories=yon_char_get_augumented(categories,";"); -// } -// gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),categories); -// segment->CategoriesLabel=gtk_label_new(categories); -// segment->EditButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// segment->EditButtonAccept=gtk_button_new_from_icon_name("emblem-ok-symbolic",GTK_ICON_SIZE_BUTTON); -// segment->EditButtonCancel=gtk_button_new_from_icon_name("process-stop-symbolic",GTK_ICON_SIZE_BUTTON); -// segment->ButtonEdit=gtk_button_new_from_icon_name("document-edit-symbolic",GTK_ICON_SIZE_BUTTON); -// segment->DeleditBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); -// segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete-symbolic",GTK_ICON_SIZE_BUTTON); - -// gtk_widget_set_name(segment->NameLabel,"SegName"); -// gtk_widget_set_name(segment->CategoriesLabel,"SegCat"); - -// gtk_container_add(GTK_CONTAINER(segment->MainFrame),segment->MainBox); - -// gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->DragButtonBox,FALSE,FALSE,0); -// gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->ElemBox,TRUE,TRUE,0); - -// gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragUpButton,FALSE,FALSE,0); -// gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragDownButton,FALSE,FALSE,0); - -// gtk_box_pack_start(GTK_BOX(segment->ElemBox),segment->NameBox,FALSE,FALSE,0); -// gtk_box_pack_end(GTK_BOX(segment->ElemBox),segment->CategoriesBox,FALSE,FALSE,0); +void yon_config_update(){ + if (!yon_window_config_get_parameter("Setings",double_click_parameter,&main_config.double_click,YON_TYPE_INT)){ + main_config.double_click=0; -// gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->OptionBox,FALSE,FALSE,0); - -// gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameEntry,FALSE,FALSE,5); -// gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameLabel,FALSE,FALSE,5); - -// gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesEntry,FALSE,FALSE,5); -// gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesLabel,FALSE,FALSE,5); + } + if (!yon_window_config_get_parameter("Setings",icon_size_parameter,&main_config.apps_icon_size,YON_TYPE_INT)){ + main_config.apps_icon_size=24; + } +} -// gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonAccept,FALSE,FALSE,5); -// gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonCancel,FALSE,FALSE,5); - -// gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonEdit,FALSE,FALSE,5); -// gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonDelete,FALSE,FALSE,5); +int yon_char_parsed_compare(const void *a, const void *b){ + const config_str str_a = (const config_str)a; + const config_str str_b = (const config_str)b; -// gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->DeleditBox,FALSE,FALSE,0); -// gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->EditButtonBox,FALSE,FALSE,0); - -// gtk_widget_set_size_request(segment->NameLabel,60,10); - -// gtk_widget_set_margin_start(segment->DragButtonBox,5); -// gtk_widget_set_margin_end(segment->OptionBox,5); -// gtk_widget_set_margin_bottom(segment->MainFrame,3); -// gtk_widget_set_margin_bottom(segment->DragButtonBox,3); -// gtk_widget_set_margin_top(segment->DragButtonBox,3); -// gtk_widget_set_margin_end(segment->DragUpButton,3); - -// gtk_widget_set_halign(segment->NameEntry,GTK_ALIGN_START); -// gtk_widget_set_halign(segment->NameLabel,GTK_ALIGN_END); -// gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); -// gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); + return strcmp(*str_a,*str_b); +} -// gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); -// gtk_widget_set_valign(segment->ElemBox,GTK_ALIGN_CENTER); -// gtk_label_set_xalign(GTK_LABEL(segment->NameLabel),0); -// gtk_label_set_xalign(GTK_LABEL(segment->CategoriesLabel),0); - -// gtk_widget_set_vexpand(segment->ElemBox,0); -// gtk_widget_set_vexpand(segment->NameBox,0); -// gtk_widget_set_vexpand(segment->CategoriesBox,0); -// gtk_widget_set_vexpand(segment->NameEntry,0); -// gtk_widget_set_vexpand(segment->NameLabel,0); -// gtk_widget_set_vexpand(segment->CategoriesEntry,0); -// gtk_widget_set_vexpand(segment->CategoriesLabel,0); -// gtk_widget_show_all(segment->MainFrame); -// gtk_widget_hide(segment->NameEntry); -// gtk_widget_hide(segment->CategoriesEntry); -// gtk_widget_hide(segment->EditButtonBox); -// return segment; -// } +void on_back_clicked(GtkWidget *, GtkWidget *socket){ + gtk_widget_destroy(socket); +} -// void yon_segment_show(main_window *widgets, SectionSettingSegment *sgm){ -// gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); -// g_signal_connect(G_OBJECT(sgm->ButtonEdit),"clicked",G_CALLBACK(on_sections_edit), widgets); -// g_signal_connect(G_OBJECT(sgm->EditButtonAccept),"clicked",G_CALLBACK(on_sections_accept), widgets); -// g_signal_connect(G_OBJECT(sgm->EditButtonCancel),"clicked",G_CALLBACK(on_sections_cancel), widgets); -// g_signal_connect(G_OBJECT(sgm->DragUpButton),"clicked",G_CALLBACK(on_sections_move_up), widgets); -// g_signal_connect(G_OBJECT(sgm->DragDownButton),"clicked",G_CALLBACK(on_sections_move_down), widgets); -// g_signal_connect(G_OBJECT(sgm->ButtonDelete),"clicked",G_CALLBACK(on_section_delete), widgets); - -// } +void on_plug_connected(GtkSocket *self, main_window *widgets){ + gtk_widget_show(widgets->BackButton); + gtk_widget_hide(widgets->SettingsButton); + g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_back_clicked),self); +} -// void yon_segments_show(main_window *widgets){ -// if(widgets->SettingsSections) -// for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){ -// SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; -// if (sgm!=NULL) +void on_plug_disconnected(GtkSocket *self, main_window *widgets){ + gtk_widget_hide(widgets->BackButton); + gtk_widget_show(widgets->SettingsButton); + g_signal_handlers_disconnect_by_func(G_OBJECT(widgets->BackButton),G_CALLBACK(on_back_clicked),self); +} -// gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); -// else return; -// } -// }; +GtkSocket *yon_sockets_init(GtkBox *socketBox){ + GtkWidget *main_socket = NULL; + GList *list = gtk_container_get_children(GTK_CONTAINER(main_config.widgets->SaveSocketBox)); + if (list){ + gtk_widget_destroy(list->data); + g_list_free(list); + } + list = gtk_container_get_children(GTK_CONTAINER(main_config.widgets->LoadSocketBox)); + if (list){ + gtk_widget_destroy(list->data); + g_list_free(list); + } + list = gtk_container_get_children(GTK_CONTAINER(socketBox)); + if (list){ + gtk_widget_destroy(list->data); + g_list_free(list); + } + main_socket = gtk_socket_new(); + main_config.widgets->SaveSocket = gtk_socket_new(); + main_config.widgets->LoadSocket = gtk_socket_new(); + gtk_widget_show(main_config.widgets->SaveSocket); + gtk_widget_show(main_config.widgets->LoadSocket); + gtk_widget_show(main_socket); + gtk_box_pack_start(GTK_BOX(socketBox),main_socket,1,1,0); + gtk_box_pack_start(GTK_BOX(main_config.widgets->SaveSocketBox),main_config.widgets->SaveSocket,0,0,0); + gtk_box_pack_start(GTK_BOX(main_config.widgets->LoadSocketBox),main_config.widgets->LoadSocket,0,0,0); + + g_signal_connect(G_OBJECT(main_socket),"plug_added",G_CALLBACK(on_plug_connected),main_config.widgets); + g_signal_connect(G_OBJECT(main_socket),"destroy",G_CALLBACK(on_plug_disconnected),main_config.widgets); + return GTK_SOCKET(main_socket); +} -// void yon_segments_hide(main_window *widgets){ -// if(main_config.SettingsSections) -// for (dictionary *dict=main_config.SettingsSections->first;dict!=NULL;dict=dict->next){ -// SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; -// if (sgm!=NULL){ -// g_object_ref(G_OBJECT(sgm->MainFrame)); -// gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),sgm->MainFrame); -// } else return; -// } -// } +char *yon_get_save_socket(){ + long socket_id = (guint)gtk_socket_get_id(GTK_SOCKET(main_config.widgets->SaveSocket)); + if (socket_id){ + return yon_char_from_long(socket_id); + } + return NULL; +} -// void yon_main_quit(GtkWidget *,GdkEvent*,main_window *widgets){ -// if (widgets->socket){ -// g_signal_handlers_disconnect_by_func(widgets->socket,on_plug_removed,widgets); -// } -// gtk_main_quit(); -// } +char *yon_get_load_socket(){ + long socket_id = (guint)gtk_socket_get_id(GTK_SOCKET(main_config.widgets->LoadSocket)); + if (socket_id){ + return yon_char_from_long(socket_id); + } + return NULL; +} void confugure_setings_window(main_window *widgets){ } void yon_interface_update(main_window *widgets){ - if (main_config.sections) yon_dictionary_free_all(main_config.sections,free); + if (main_config.sections) { + yon_dictionary_free_all(main_config.sections,free); + main_config.sections = NULL; + } gsize size; config_str section_settings = yon_window_config_get_section("Sections",&size); @@ -1354,11 +565,16 @@ void yon_interface_update(main_window *widgets){ yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section); } } + + widgets->current_theme = yon_theme_update(widgets); + + widgets->current_theme->list_update_func(widgets->current_theme); } main_window *yon_main_window_setup(){ main_window *widgets = malloc(sizeof(main_window)); + main_config.widgets=widgets; GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); @@ -1366,14 +582,22 @@ main_window *yon_main_window_setup(){ widgets->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel"); widgets->ThemeBox = yon_gtk_builder_get_widget(builder,"ThemeBox"); widgets->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox"); + widgets->BackButton = yon_gtk_builder_get_widget(builder,"BackButton"); widgets->SettingsButton = yon_gtk_builder_get_widget(builder,"SettingsButton"); widgets->BannerImage = yon_gtk_builder_get_widget(builder,"BannerImage"); widgets->BannerRevealer = yon_gtk_builder_get_widget(builder,"BannerRevealer"); widgets->BannerButton = yon_gtk_builder_get_widget(builder,"BannerButton"); widgets->BannerArrow = yon_gtk_builder_get_widget(builder,"BannerArrow"); + widgets->SaveSocketBox = yon_gtk_builder_get_widget(builder,"SaveSocketBox"); + widgets->LoadSocketBox = yon_gtk_builder_get_widget(builder,"LoadSocketBox"); + + widgets->MainMenuItemSettings = yon_gtk_builder_get_widget(builder,"MainMenuItemSettings"); + widgets->MainMenuItemAbout = yon_gtk_builder_get_widget(builder,"MainMenuItemAbout"); + widgets->MainMenuItemDocumentation = yon_gtk_builder_get_widget(builder,"MainMenuItemDocumentation"); yon_apps_init(); + g_signal_connect(G_OBJECT(widgets->MainMenuItemSettings),"activate",G_CALLBACK(on_settings_open),widgets); g_signal_connect(G_OBJECT(widgets->BannerButton),"clicked",G_CALLBACK(on_reveal_banner),widgets); yon_window_config_setup(GTK_WINDOW(widgets->Window)); @@ -1382,16 +606,14 @@ main_window *yon_main_window_setup(){ free(path); { int banner_hidden = 0; - yon_window_config_get_parameter("Settings","HideBanner", &banner_hidden,YON_TYPE_BOOLEAN); + yon_window_config_get_parameter("Settings",hide_banner_parameter, &banner_hidden,YON_TYPE_BOOLEAN); gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),!banner_hidden?GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT:GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT); gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->BannerRevealer),!banner_hidden); gtk_menu_button_set_direction(GTK_MENU_BUTTON(widgets->BannerArrow),!banner_hidden?GTK_ARROW_LEFT:GTK_ARROW_RIGHT); } gtk_widget_show(widgets->Window); - widgets->current_theme = yon_theme_update(widgets); yon_interface_update(widgets); - widgets->current_theme->list_update_func(widgets->current_theme); return widgets; } diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index bd1b3a5..783c4e5 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -37,10 +37,11 @@ #define glade_path_gnome_theme "/com/ublinux/ui/ubl-settings-manager-theme-gnome.glade" #define glade_path_gnome_section "/com/ublinux/ui/ubl-settings-manager-theme-gnome-section.glade" #define glade_path_main_theme "/com/ublinux/ui/ubl-settings-manager-theme-main.glade" +#define glade_path_settings "/com/ublinux/ui/ubl-settings-manager-settings.glade" #define CssPath "/com/ublinux/css/ubl-settings-manager.css" #define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf" #define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf" -#define AppIconPath "com.ublinux.ubl-settings-manager" +#define icon_path "com.ublinux.ubl-settings-manager" #define AppBannerPath "/com/ublinux/images/ubl-settings-manager-banner.png" #define DesktopPath "/usr/share/applications/" #define IconPicturesPath "/usr/share/icons/hicolor/scalable/apps/" @@ -48,6 +49,15 @@ #define LocaleName "ubl-settings-manager" #define ubl_settings_infoPath "ubl-settings-info" #define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id=" + +#define launch_command(target) yon_char_unite("xdg-open ",target,NULL) +#define launch_args_command(main_socket,load_socket,save_socket) yon_char_unite("--socket-id=",main_socket," --socket-ext-id=",save_socket," --socket-trd-id=",load_socket,NULL) + +#define double_click_parameter "double_click" +#define icon_size_parameter "icon_size" +#define theme_parameter "theme" +#define hide_banner_parameter "hide_banner" + typedef char* string; __attribute__((unused)) static \ string version_application; @@ -75,21 +85,6 @@ typedef struct IconSection{ char *categories; } IconSection; -typedef struct { - template_config_fields; - int apps_icon_size; - dictionary *sections; - int labelDensity; - int lock_settings; - int double_click; - dictionary *SettingsSections; - int banner_hidden; - - GHashTable *themes; -} config; - -extern config main_config; - typedef struct { GtkWidget *MainFrame; GtkWidget *MainBox; @@ -113,40 +108,36 @@ typedef struct { } SectionSettingSegment; typedef struct theme_struct { - GtkWidget *MainBox; - GtkWidget *AppsTree; - GtkWidget *SocketBox; - GtkWidget *HideBox; - GtkWidget *Socket; - int (*list_update_func)(struct theme_struct*); - char *(*get_command_func)(struct theme_struct*); - void (*set_sections_func)(struct theme_struct*); - GtkTreeStore *AppsStore; + char *theme_name; + GtkWidget *MainBox; //theme main box, which connects to window + GtkWidget *SocketBox; //main socket box, where socket is being parented to + GtkWidget *HideBox; //box to hide when socket has been connected + int (*list_update_func)(struct theme_struct*); //function to update theme's lits of application + // GtkWidget *AppsTree; //theme application list container + // GtkWidget *Socket; } theme_struct; typedef struct gnome_theme_struct { + char *theme_name; GtkWidget *MainBox; - GtkWidget *AppsTree; GtkWidget *SocketBox; GtkWidget *HideBox; - GtkWidget *Socket; int (*list_update_func)(struct gnome_theme_struct*); - char *(*get_command_func)(struct gnome_theme_struct*); - void (*set_sections_func)(struct gnome_theme_struct*); + GtkWidget *AppsTree; + GtkWidget *Socket; GtkWidget *GnomePaned; GtkWidget *GnomeInfoLogoImage; GtkCellRenderer *IconCell; } gnome_theme_struct; typedef struct main_theme_struct { + char *theme_name; GtkWidget *MainBox; - GtkWidget *AppsIconView; GtkWidget *SocketBox; GtkWidget *HideBox; - GtkWidget *Socket; int (*list_update_func)(struct main_theme_struct*); - char *(*get_command_func)(struct main_theme_struct*); - void (*set_sections_func)(struct main_theme_struct*); + GtkWidget *AppsIconView; + GtkWidget *Socket; GtkListStore *AppsList; } main_theme_struct; @@ -156,62 +147,80 @@ typedef struct { GtkWidget *TitleLabel; GtkWidget *ThemeBox; GtkWidget *SocketBox; + GtkWidget *BackButton; GtkWidget *SettingsButton; GtkWidget *BannerImage; GtkWidget *BannerArrow; GtkWidget *BannerButton; GtkWidget *BannerRevealer; + GtkWidget *LoadSocket; + GtkWidget *LoadSocketBox; + GtkWidget *SaveSocket; + GtkWidget *SaveSocketBox; + GtkWidget *OptionsSocket; + GtkWidget *OptionsSocketBox; + + GtkWidget *MainMenuItemSettings; + GtkWidget *MainMenuItemAbout; + GtkWidget *MainMenuItemDocumentation; + theme_struct *current_theme; } main_window; +typedef struct { + template_config_fields; + int apps_icon_size; + dictionary *sections; + int labelDensity; + int lock_settings; + int double_click; + dictionary *SettingsSections; + int banner_hidden; + + main_window *widgets; + + GHashTable *themes; +} config; + +extern config main_config; + typedef struct { char *name; int categories_size; config_str categories; } app_section; -void on_plug_added(GtkSocket* self, main_window *builder); -void on_plug_removed(GtkSocket* self, main_window *widgets); -void on_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *applist); -void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, main_window *applist); -void on_item_selection_changed(GtkIconView *IV, main_window *widgets); -void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder); -void on_backToSettingsButton_clicked(GtkWidget *button,main_window *sctb); -void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder); -void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder); -int on_settings_accept(GtkWidget *button, dictionary **widgetsDs); -void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, main_window *widgets); -int on_settingsOpen(GtkWidget *button, main_window *widgets); -int on_settings_icon_size_changed(GtkWidget* self, main_window *widgets); -int on_settings_cancel(GtkWidget *button, main_window *widgets); -int reload_list(IVGraphicals *section); -int hide_if_unfound(dictionary *widgetsDc); -GtkWidget *create_socket(main_window *builder); -int setup_config(); -void update_double_clicks(dictionary *widgetsD); -void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned); -int yon_set_sections(IconSection *section); -void yon_set_default_sections(dictionary *section); -dictionary *yon_section_new(dictionary *section, char *section_name, char *categories); -void yon_switch_theme(dictionary **dict, dictionary *newone); -void yon_segment_show(main_window *widgets, SectionSettingSegment *sgm); -SectionSettingSegment *yon_create_section_setting(char *name, char *categories); -void yon_segments_show(main_window *widgets); -void yon_segments_hide(main_window *widgets); -dictionary *yon_create_icon_section_list(dictionary *sections); -int yon_show_icon_views(dictionary *IVS,main_window *widgets); -void yon_icon_size_convert(int mode); -int launch(thread_output *thread); -float yon_time_average(dictionary *times); -void yon_time_reg_for_average(dictionary *listofregs, int size, time_t tm); -int yon_get_icon_size(int size); +typedef struct { + GtkWidget *Window; + GtkWidget *SizeSlider; + GtkWidget *SizeLabel; + GtkWidget *SizeIcon; + GtkWidget *ThemeCombo; + GtkWidget *DoubleClickSwitch; + GtkWidget *SectionsConfigurationButton; + GtkWidget *CancelButton; + GtkWidget *AcceptButton; + + int icon_size; +} settings_window; + +void on_settings_accept(GtkWidget *, settings_window *window); void yon_theme_init(); theme_struct *yon_theme_update(main_window *widgets); gnome_theme_struct *yon_gnome_theme_new(); main_theme_struct *yon_main_theme_new(); app_section *yon_app_section_new(); gnome_theme_struct *yon_gnome_theme_new(); +char *yon_get_save_socket(); +char *yon_get_load_socket(); +GtkSocket *yon_sockets_init(GtkBox *socketBox); +void on_plug_disconnected(GtkSocket *self, main_window *widgets); +int yon_char_parsed_compare(const void *a, const void *b); + +void yon_interface_update(main_window *widgets); + +void on_settings_open(GtkWidget *, main_window *widgets); #endif \ No newline at end of file diff --git a/ubl-settings-manager-settings.glade b/ubl-settings-manager-settings.glade index 7bf5d44..fb1c050 100644 --- a/ubl-settings-manager-settings.glade +++ b/ubl-settings-manager-settings.glade @@ -2,44 +2,63 @@ - + + 24 + 64 + 24 + 8 + 8 + + + True False - 440 - 250 - ru.ublinux.ubl-settings-manager + com.ublinux.libublsettingsui-gtk3.cancel-uncolored-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.accept-symbolic + + + False + True + com.ublinux.ubl-settings-manager True False + 5 + 5 + 5 + 5 vertical + 5 True False - 5 - 5 - 5 - 5 - 5 - 2 0.019999999552965164 in True False - 12 + 5 + 5 + 5 + 5 True False + 10 True False vertical - + True False 5 @@ -52,15 +71,12 @@ - + True True - 10 - 10 - 10 - 10 adjustment1 - 5 + 64 + 0 0 False @@ -78,11 +94,13 @@ - + 64 64 True False + center + center 32 com.ublinux.ubl-settings-manager @@ -109,7 +127,7 @@ - True + False True 0 @@ -118,34 +136,27 @@ True False - 5 - 5 - 5 - 5 - 2 - 5 0.019999999552965164 in True False + 5 + 5 + 5 + 5 True False vertical - + combo True False center - 10 - 10 - 10 - 10 - 5 True 0 @@ -172,7 +183,7 @@ - True + False True 1 @@ -181,15 +192,12 @@ True False - 3 - 3 + 5 True False center - 12 - 12 Double click selection 0.019999999552965164 @@ -200,11 +208,9 @@ - + True True - 10 - 10 False @@ -221,17 +227,11 @@ - + Sections management True True True - 5 - 5 - 5 - 5 - 5 - 5 False @@ -239,87 +239,14 @@ 3 - - - True - False - vertical - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 3 - 30 - True - - - Close - 200 - True - True - True - 2 - image8 - - - False - True - 0 - - - - - Apply - 200 - True - True - True - 2 - image9 - - - False - True - 1 - - - - - True - True - 0 - - - - - False - True - 1 - - - - - False - True - 5 - - - + True False - + True False UBLinux Settings Manager @@ -337,17 +264,32 @@ 5 + + + Close + True + True + True + image8 + + + 1 + + + + + Apply + True + True + True + image9 + + + end + 2 + + - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic - diff --git a/ubl-settings-manager-theme-gnome-section.glade b/ubl-settings-manager-theme-gnome-section.glade index 8e73fdb..600e2c4 100644 --- a/ubl-settings-manager-theme-gnome-section.glade +++ b/ubl-settings-manager-theme-gnome-section.glade @@ -1,7 +1,8 @@ - + + True True @@ -9,7 +10,11 @@ True False + 5 False + diff --git a/ubl-settings-manager-theme-gnome.glade b/ubl-settings-manager-theme-gnome.glade index b855a17..249c798 100644 --- a/ubl-settings-manager-theme-gnome.glade +++ b/ubl-settings-manager-theme-gnome.glade @@ -34,13 +34,40 @@ True False - + True False vertical 5 - + + True + True + edit-find-symbolic + False + False + + + False + True + 0 + + + + + True + False + vertical + 5 + + + + + + True + True + 1 + @@ -67,10 +94,6 @@ True False 3 - 3 - 3 - 3 - 3 0 in @@ -130,7 +153,7 @@ - False + True True 1 diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 9225025..3ed6809 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -108,45 +108,6 @@ - - True - False - False - 4 - - - True - False - Settings - True - - - - - - True - False - About... - True - - - - - - True - False - Documentation - True - - - - True False @@ -203,6 +164,7 @@ True False + 5 True @@ -287,7 +249,9 @@ True False + 5 vertical + 5 True @@ -308,10 +272,7 @@ Icon True False - 5 5 - 5 - 5 @@ -370,7 +331,7 @@ - + True False False @@ -382,20 +343,10 @@ False 5 - + True - True - False - True - left - False - - - - + False + com.ublinux.libublsettingsui-gtk3.pan-left False @@ -428,9 +379,8 @@ True False True - menu1 + MainMenu none - settingsPopover @@ -441,7 +391,7 @@ - + True False center @@ -456,7 +406,7 @@ - + True False center @@ -467,7 +417,7 @@ end - 4 + 5 @@ -477,193 +427,4 @@ - - True - False - menu - - - True - False - - - - - True - False - - - - - True - False - True - - - - - - 1 - 5 - 2 - 1 - 1 - - - 1 - 1 - 10 - - - - True - False - ubconfig-gui - 6 - - - True - False - - - True - False - Element 1 - - - - - True - False - Element 2 - - - True - False - - - True - False - Element 3 - - - - - - - - - Element 4 - True - False - image3 - False - - - - - - - - - - - Стандартная тема - - - GNOME тема - - - - - True - False - - - True - False - - - - - - - - - False - - - True - False - 0 - none - - - True - False - 5 - 5 - 5 - 5 - - - True - False - 4 - 4 - 4 - 4 - vertical - - - True - True - True - Settings - - - False - True - 3 - - - - - True - True - True - Documentation - - - False - True - 4 - - - - - True - True - True - About system - - - False - True - 5 - - - - - - - - - - - - - -- 2.35.1