#include "ubl-settings-fstecadvised.h"

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))
        yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
    switch (type){
        case YON_CONFIG_GLOBAL:
            yon_config_load_config(type,config_get_command("global"),NULL);
        yon_ubl_status_box_render(yon_char_get_localised_from_lib(GLOBAL_LOAD_SUCCESS_LABEL),BACKGROUND_IMAGE_SUCCESS_TYPE);
            break;
        case YON_CONFIG_LOCAL:
            yon_config_load_config(type,config_get_command("system"),NULL);
        yon_ubl_status_box_render(yon_char_get_localised_from_lib(LOCAL_LOAD_SUCCESS_LABEL),BACKGROUND_IMAGE_SUCCESS_TYPE);
            break;
        case YON_CONFIG_CUSTOM:
            char *path = NULL;
            path=yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_OPEN);
            if (!yon_char_is_empty(path)){
                yon_config_clean();
                yon_config_load_config(type,config_get_command(path),NULL);
                yon_ubl_status_box_render(yon_char_get_localised_from_lib(LOCAL_LOAD_SUCCESS_LABEL),BACKGROUND_IMAGE_SUCCESS_TYPE);
            }
            break;
        default:
            break;
    }
}