|
|
|
|
@ -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;i<removalsize;i++)
|
|
|
|
|
g_key_file_remove_key(gfile, "sections",sectionremoval[i] ,NULL);
|
|
|
|
|
removalsize=0;
|
|
|
|
|
sectionremoval=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);
|
|
|
|
|
@ -427,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 {
|
|
|
|
|
@ -552,36 +557,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;i<removalsize;i++){
|
|
|
|
|
g_key_file_remove_key(gfile,"sections",sectionremoval[i],NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
main_config.sections->next=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 +737,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;
|
|
|
|
|
@ -948,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);
|
|
|
|
|
@ -1358,8 +1373,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);
|
|
|
|
|
@ -1375,11 +1390,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");
|
|
|
|
|
@ -1559,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)
|
|
|
|
|
@ -1578,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
|
|
|
|
|
|
|
|
|
|
@ -1632,7 +1649,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);
|
|
|
|
|
}
|
|
|
|
|
@ -1660,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<argc;i++){
|
|
|
|
|
socket_find=getopt_long(argc,argv,"",long_options,&option_index);
|
|
|
|
|
if (socket_find=='l') main_config.lock_settings=1;
|
|
|
|
|
}
|
|
|
|
|
local=setlocale(LC_ALL, "");
|
|
|
|
|
textdomain (LocaleName);
|
|
|
|
|
actionWidgets *widget=NULL;
|
|
|
|
|
|