Custom config loading minor rework

pull/129/head
Ivan Yartsev 6 months ago
parent 219a2782b3
commit b0553794a4

@ -102,53 +102,29 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
if(!yon_char_is_empty(config_get_default_command)){
yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
}
if (type==YON_CONFIG_GLOBAL){
switch (type){
case YON_CONFIG_GLOBAL:
yon_debug_output("%s\n",yon_char_unite(config_get_command("global"),NULL));
yon_config_load_config(type,config_get_command("global"),NULL);
textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
textdomain(LocaleName);
update_loaded_logrotate();
return 1;
}
if (type==YON_CONFIG_LOCAL){
break;
case YON_CONFIG_LOCAL:
yon_config_load_config(type,config_get_command("system"),NULL);
yon_config_load_config(YON_CONFIG_GLOBAL,config_get_global_only_parameters,NULL);
// int size;
textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
textdomain(LocaleName);
update_loaded_logrotate();
return 1;
}
else if (type==YON_CONFIG_CUSTOM){
char *path=NULL;
textdomain(template_ui_LocaleName);
char *open_string = OPEN_LABEL;
textdomain(LocaleName);
GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,open_string,GTK_RESPONSE_ACCEPT,NULL);
yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,CHOOSE_CUSTOM_CONFIG_LABEL,icon_path,"config-open-window");
GtkFileFilter *filter = gtk_file_filter_new();
gtk_file_filter_set_name(filter,FILTER_NAME_CONFIG_LABEL);
gtk_file_filter_add_pattern(filter,"*.ini");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter);
gtk_widget_show(dialog);
int response = gtk_dialog_run(GTK_DIALOG(dialog));
if (response == GTK_RESPONSE_ACCEPT){
char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
if (!yon_char_is_empty(file)){
path=file;
}
break;
case YON_CONFIG_CUSTOM:
char *path = NULL;
path=yon_custom_config_init();
if (!yon_char_is_empty(path)){
yon_config_clean();
yon_config_load_config(type,config_get_command(path),NULL);
textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
textdomain(LocaleName);
gtk_widget_destroy(dialog);
} else {
gtk_widget_destroy(dialog);
return 0;
yon_ubl_status_box_render(yon_char_get_localised_from_lib(LOCAL_LOAD_SUCCESS_LABEL),BACKGROUND_IMAGE_SUCCESS_TYPE);
}
break;
default:
}
update_loaded_logrotate();
return 1;

Loading…
Cancel
Save