|
|
|
|
@ -8,22 +8,25 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
if (type!=YON_CONFIG_CUSTOM){
|
|
|
|
|
yon_config_clean();
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(config_get_default_command))
|
|
|
|
|
if (!yon_char_is_empty(config_get_default_command)){
|
|
|
|
|
yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
|
|
|
|
|
switch (type){
|
|
|
|
|
case YON_CONFIG_LOCAL:
|
|
|
|
|
}
|
|
|
|
|
if (main_config.config_load_path){
|
|
|
|
|
if (main_config.startup_config){
|
|
|
|
|
yon_config_restore(NULL);
|
|
|
|
|
}
|
|
|
|
|
yon_config_custom_clean(main_config.startup_config);
|
|
|
|
|
}
|
|
|
|
|
main_config.startup_config = NULL;
|
|
|
|
|
yon_config_custom_load_config(&main_config.startup_config,config_get_command("system"),NULL);
|
|
|
|
|
yon_config_custom_load_config(&main_config.startup_config,config_get_command(main_config.config_load_path),NULL);
|
|
|
|
|
}
|
|
|
|
|
switch (type){
|
|
|
|
|
case YON_CONFIG_LOCAL:
|
|
|
|
|
main_config.config_load_path = yon_char_new("system");
|
|
|
|
|
main_config.config_save_path = main_config.config_load_path;
|
|
|
|
|
yon_config_load_config(type,config_get_command("system"),NULL);
|
|
|
|
|
break;
|
|
|
|
|
case YON_CONFIG_CUSTOM:
|
|
|
|
|
if (yon_char_is_empty(main_config.config_load_path)){
|
|
|
|
|
if (yon_char_is_empty(main_config.force_ini)){
|
|
|
|
|
char *path = NULL;
|
|
|
|
|
path=yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_OPEN);
|
|
|
|
|
if (!yon_char_is_empty(path)){
|
|
|
|
|
@ -34,7 +37,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_clean();
|
|
|
|
|
yon_config_load_config(type,config_get_command(main_config.config_load_path),NULL);
|
|
|
|
|
yon_config_load_config(type,config_get_command(main_config.force_ini),NULL);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@ -47,11 +50,6 @@ void on_config_local_load(GtkWidget *,main_window *widgets){
|
|
|
|
|
on_config_custom_load_last(NULL,widgets);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(main_config.config_load_path)) free(main_config.config_load_path);
|
|
|
|
|
main_config.config_load_path = yon_char_new("system");
|
|
|
|
|
// yon_config_custom_clean(main_config.startup_config);
|
|
|
|
|
// main_config.startup_config = NULL;
|
|
|
|
|
// yon_config_custom_load_config(&main_config.startup_config,config_get_command("system"),NULL);
|
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
|
main_config.load_mode=YON_CONFIG_LOCAL;
|
|
|
|
|
yon_main_window_update_locale(widgets);
|
|
|
|
|
@ -60,18 +58,10 @@ void on_config_local_load(GtkWidget *,main_window *widgets){
|
|
|
|
|
|
|
|
|
|
void on_config_custom_load(GtkWidget *,main_window *){
|
|
|
|
|
char *temp_custom_path = NULL;
|
|
|
|
|
if (!yon_char_is_empty(main_config.config_load_path)){
|
|
|
|
|
temp_custom_path = main_config.config_load_path;
|
|
|
|
|
main_config.config_load_path = NULL;
|
|
|
|
|
main_config.config_save_path = NULL;
|
|
|
|
|
}
|
|
|
|
|
yon_load_proceed(YON_CONFIG_CUSTOM);
|
|
|
|
|
if (!yon_char_is_empty(main_config.config_load_path)){
|
|
|
|
|
main_config.load_mode=YON_CONFIG_CUSTOM;
|
|
|
|
|
free(temp_custom_path);
|
|
|
|
|
} else {
|
|
|
|
|
main_config.config_load_path = temp_custom_path;
|
|
|
|
|
main_config.config_save_path = main_config.config_load_path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -351,14 +341,16 @@ int yon_config_save(main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_config_restore(main_window *){
|
|
|
|
|
yon_launch(yon_debug_output("%s\n","ubconfig --source system remove [autoinstall]"));
|
|
|
|
|
if (yon_char_is_empty(main_config.config_load_path)) return;
|
|
|
|
|
char *remove_command = yon_char_unite("ubconfig --source ",main_config.config_load_path," remove [autoinstall]",NULL);
|
|
|
|
|
yon_launch(yon_debug_output("%s\n",remove_command));
|
|
|
|
|
yon_config_custom_apply(&main_config.startup_config);
|
|
|
|
|
yon_config_set_status_full(1);
|
|
|
|
|
int size = 0;
|
|
|
|
|
config_str parameters = yon_config_get_save_parameters(&size);
|
|
|
|
|
if (size){
|
|
|
|
|
char *command_params = yon_char_parsed_to_string(parameters,size, " ");
|
|
|
|
|
char *command = yon_char_unite(ubconfig_set_command("system"),command_params,NULL);
|
|
|
|
|
char *command = yon_char_unite(ubconfig_set_command(main_config.config_load_path),command_params,NULL);
|
|
|
|
|
yon_debug_output("%s\n",command);
|
|
|
|
|
yon_launch(command);
|
|
|
|
|
yon_char_parsed_free(parameters,size);
|
|
|
|
|
|