From d8ef0034da3bb45a25ca597607695c843641b23c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Mar 2023 10:13:50 +0600 Subject: [PATCH 1/3] Fixed crash occured after editing sections; Fixed bug which occured edited sections not to save to configuration; Fixed bug which occured editing sections to apply only to current theme --- source/ubl-settings-manager.c | 57 +++++++++++++++++++++-------------- ubl-settings-manager.css | 3 +- ubl-settings-manager.glade | 25 +++++++-------- 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index e9bc67f..c737b20 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -257,6 +257,10 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ g_key_file_set_string(gfile,"window","LabelDensity",fromint); g_key_file_set_string(gfile,"window","User",login); + for (int i=0;iICSys->first;dict!=NULL;dict=dict->next){ IVGraphicals *IV=(IVGraphicals*)dict->data; g_key_file_set_string(gfile,"sections",IV->sectionName,IV->categories); @@ -552,36 +556,45 @@ void on_sections_close(GtkWidget *button, actionWidgets *widgets){ gtk_widget_hide(widgets->SectionSettingsWindow); } -void on_sections_save(GtkWidget *button, actionWidgets *widgets){ +void on_sections_save(GtkWidget *button, dictionary *widgetsD){ + actionWidgets *widgets=(actionWidgets*)widgetsD->data; GKeyFile *gfile=g_key_file_new(); - g_key_file_load_from_file(gfile,GlobalConfigPath,G_KEY_FILE_NONE,NULL); main_config.sections=yon_dictionary_create_empty(); for (dictionary *dict=widgets->SettingsSections;dict!=NULL;dict=dict->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dict->data; char *nm=(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)); char *ct=(char*)gtk_label_get_text(GTK_LABEL(segment->CategoriesLabel)); main_config.sections=yon_section_new(main_config.sections,nm,ct); - g_key_file_set_string(gfile,"sections",nm,ct); - for( int i=0;inext=NULL; - g_key_file_save_to_file(gfile,GlobalConfigPath,NULL); - for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){ - IVGraphicals *IV=cur->data; - gtk_container_remove(GTK_CONTAINER(widgets->icvpack),IV->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); + int curtheme=main_config.WindowTheme; + for (dictionary *widgetsd=widgetsD->first;widgetsd!=NULL;widgetsd=widgetsd->next){ + if (strcmp(widgetsd->key,"Gnome")==0){ + main_config.WindowTheme=1; + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + } + else{ + main_config.WindowTheme=0; + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + } + widgets=(actionWidgets*)widgetsd->data; + for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){ + IVGraphicals *IV=cur->data; + gtk_container_remove(GTK_CONTAINER(widgets->icvpack),IV->Box); + } + widgets->ICSys=yon_create_icon_section_list(main_config.sections); + for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){ + load_apps_with_clear((IVGraphicals*)cur->data,widgets->applist,widgets->appssize); + } + yon_show_icon_views(widgets->ICSys,widgets); + dictionary *yond=yon_dictionary_create_empty(); + yond->data=widgets; + hide_if_unfound(yond); } - yon_show_icon_views(widgets->ICSys,widgets); - dictionary *yond=yon_dictionary_create_empty(); - yond->data=widgets; - hide_if_unfound(yond); - + main_config.WindowTheme=curtheme; } void on_section_delete(GtkWidget *button, actionWidgets *widgets){ @@ -723,7 +736,7 @@ int launch(thread_output *thread){ } int launch_app_with_arguments(char *name, char *args){ - char *path=yon_char_get_augumented("/bin/",name); + 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; @@ -1632,7 +1645,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them 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), 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); } diff --git a/ubl-settings-manager.css b/ubl-settings-manager.css index 79a5aa8..67166dc 100644 --- a/ubl-settings-manager.css +++ b/ubl-settings-manager.css @@ -20,8 +20,7 @@ background-color: #404040; } .roundborder * { - border-style:solid; - border-width:1px; + border-width:0px; border-radius:5px; } .noborder { diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 63a249e..612a89d 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -456,7 +456,7 @@ 64 True False - ubconfig-gui + ru.ublinux.ubl-settings-manager False @@ -627,7 +627,7 @@ True False 32 - ubl-settings-manager + ru.ublinux.ubl-settings-manager 5 @@ -653,14 +653,16 @@ True + True False vertical True + True False - + True False vertical @@ -798,7 +800,7 @@ True False 32 - ubl-settings-manager + ru.ublinux.ubl-settings-manager 5 @@ -831,7 +833,6 @@ @@ -881,7 +882,6 @@ @@ -892,6 +892,7 @@ @@ -1201,7 +1202,7 @@ True False 32 - ubl-settings-manager + ru.ublinux.ubl-settings-manager 5 @@ -1454,7 +1455,7 @@ True False 32 - ubl-settings-manager + ru.ublinux.ubl-settings-manager 5 @@ -1538,6 +1539,7 @@ @@ -1579,7 +1581,6 @@ natural horizontal liststoreTemplate - 135 0 2 5 @@ -1600,7 +1601,7 @@ 0 word - 18 + 150 3 @@ -1884,7 +1885,7 @@ True False 32 - ubl-settings-manager + ru.ublinux.ubl-settings-manager 5 @@ -1970,7 +1971,7 @@ Project Home Page UBGroup UBGroup - ubl-settings-manager + ru.ublinux.ubl-settings-manager gpl-2-0 From f2a64c185650d6cc0bae27968dcfe61466e8b152 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Mar 2023 11:38:45 +0600 Subject: [PATCH 2/3] Changed button pictures for sections management window --- source/ubl-settings-manager.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index c737b20..94c7fd1 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -431,6 +431,7 @@ void on_sections_cancel(GtkWidget *button, actionWidgets *widgets){ 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 { @@ -1371,8 +1372,8 @@ SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ 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("gtk-goto-top",GTK_ICON_SIZE_BUTTON); - segment->DragDownButton=gtk_button_new_from_icon_name("gtk-goto-bottom",GTK_ICON_SIZE_BUTTON); + 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); @@ -1388,11 +1389,11 @@ SectionSettingSegment *yon_create_section_setting(char *name, char *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("dialog-ok",GTK_ICON_SIZE_BUTTON); - segment->EditButtonCancel=gtk_button_new_from_icon_name("dialog-no",GTK_ICON_SIZE_BUTTON); - segment->ButtonEdit=gtk_button_new_from_icon_name("gtk-edit",GTK_ICON_SIZE_BUTTON); + 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",GTK_ICON_SIZE_BUTTON); + 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"); From d8fc95e1c97fd30f43345231bc905c42953fa53c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Mar 2023 11:56:10 +0600 Subject: [PATCH 3/3] added launch argument --lock-settings, which prevents settings to open --- source/ubl-settings-manager.c | 16 ++++++++++++++-- source/ubl-settings-manager.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index 94c7fd1..86541e8 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -962,6 +962,7 @@ int setup_config(){ FILE *file; GError *err=NULL; main_config.sections=yon_dictionary_create_empty(); + main_config.lock_settings=0; GKeyFile *configfile = g_key_file_new(); char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); @@ -1573,7 +1574,9 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them 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,"MenuItemAboutSystem"))); curWidgets->SettingsSections=NULL; - + 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"); curWidgets->socket=GTK_WIDGET(create_socket(curWidgets)); if (curWidgets->ButtonBackToMain!=NULL) @@ -1592,7 +1595,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them if (curWidgets->ButtonBackToMain!=NULL) g_signal_connect(G_OBJECT(curWidgets->ButtonBackToMain), "clicked", G_CALLBACK(on_backToSettingsButton_clicked), curWidgets); curWidgets->LabelTitle=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"LabelTitle")); - gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager")); + gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager")); // Standard for all themes @@ -1674,6 +1677,15 @@ int main(int argc, char *argv[]){ printf("Ошибка загрузки конфига!\n"); return -1; } + static struct option long_options[] = { + {"lock-settings", 0, 0, 'l'}, + }; + int socket_find; + int option_index=0; + for (int i=0;i #include +#include #define GladePath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager.glade" @@ -79,6 +80,7 @@ typedef struct { char *lastUser; int changed; int fullscreen; + int lock_settings; } config; typedef struct {