Fixed loading from specific file

pull/155/head
parent 730eabd375
commit 93707ea46a

@ -11,7 +11,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
yon_config_load_config(type,config_get_command("global"),NULL); yon_config_load_config(type,config_get_command("global"),NULL);
} }
if (type==YON_CONFIG_LOCAL){ if (type==YON_CONFIG_LOCAL){
yon_config_load_config(type,config_get_command("global"),NULL); yon_config_load_config(type,config_get_command("system"),NULL);
yon_config_load_config(YON_CONFIG_GLOBAL,config_get_global_only_parameters,NULL); yon_config_load_config(YON_CONFIG_GLOBAL,config_get_global_only_parameters,NULL);
yon_config_set_status(DEFAULTPASSWD_parameter,-2); yon_config_set_status(DEFAULTPASSWD_parameter,-2);
yon_config_set_status(DEFAULTROOTPASSWD_parameter,-2); yon_config_set_status(DEFAULTROOTPASSWD_parameter,-2);
@ -57,13 +57,18 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
GtkFileFilter *filter = gtk_file_filter_new(); GtkFileFilter *filter = gtk_file_filter_new();
gtk_file_filter_add_pattern(filter,"*.ini"); gtk_file_filter_add_pattern(filter,"*.ini");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter);
gtk_widget_show(dialog);
int response = gtk_dialog_run(GTK_DIALOG(dialog)); int response = gtk_dialog_run(GTK_DIALOG(dialog));
if (response == GTK_RESPONSE_ACCEPT){ if (response == GTK_RESPONSE_ACCEPT){
char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
if (!yon_char_is_empty(file)){ if (!yon_char_is_empty(file)){
path=file; path=file;
} }
} else return 0; gtk_widget_destroy(dialog);
} else {
gtk_widget_destroy(dialog);
return 0;
}
yon_config_load_config(type,config_get_command(path),NULL); yon_config_load_config(type,config_get_command(path),NULL);
} }
@ -198,11 +203,11 @@ void on_config_global_load(GtkWidget *self, main_window *widgets){
} }
void on_config_custom_load(GtkWidget *self,main_window *widgets){ void on_config_custom_load(GtkWidget *self,main_window *widgets){
yon_load_proceed(YON_CONFIG_GLOBAL); yon_load_proceed(YON_CONFIG_CUSTOM);
textdomain(template_ui_LocaleName); textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
textdomain(LocaleName); textdomain(LocaleName);
main_config.load_mode=0; main_config.load_mode=3;
yon_interface_update(widgets); yon_interface_update(widgets);
} }
@ -334,7 +339,7 @@ void yon_hide_passwords(template_saving_window *window){
free(yon_char_divide(new_value,1)); free(yon_char_divide(new_value,1));
newv=new_value; newv=new_value;
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') { } else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
if (main_config.load_mode){ if (main_config.load_mode==1){
newv=new_value; newv=new_value;
} else { } else {
newv="*******"; newv="*******";
@ -343,7 +348,7 @@ void yon_hide_passwords(template_saving_window *window){
newv="*******"; newv="*******";
} }
if (!yon_char_is_empty(old_value)){ if (!yon_char_is_empty(old_value)){
if (main_config.load_mode){ if (main_config.load_mode==1){
old = yon_char_new("<s>*******</s>"); old = yon_char_new("<s>*******</s>");
} else { } else {
@ -360,7 +365,7 @@ void yon_hide_passwords(template_saving_window *window){
free(yon_char_divide(new_value,1)); free(yon_char_divide(new_value,1));
newv=new_value; newv=new_value;
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') { } else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
if (main_config.load_mode){ if (main_config.load_mode==1){
newv=new_value; newv=new_value;
} else { } else {
newv="*******"; newv="*******";
@ -369,7 +374,7 @@ void yon_hide_passwords(template_saving_window *window){
newv="*******"; newv="*******";
} }
if (!yon_char_is_empty(old_value)){ if (!yon_char_is_empty(old_value)){
if (main_config.load_mode){ if (main_config.load_mode==1){
old = yon_char_new("<s>*******</s>"); old = yon_char_new("<s>*******</s>");
} else { } else {
old = yon_char_unite("<s>",old_value,"</s>",NULL); old = yon_char_unite("<s>",old_value,"</s>",NULL);

Loading…
Cancel
Save