Fixed loading function

pull/148/head
parent 33dc651182
commit 554f78cfa3
No known key found for this signature in database
GPG Key ID: FF1D842BF4DDE92B

@ -234,36 +234,40 @@ void yon_interface_update(){
void yon_load_proceed(YON_CONFIG_TYPE type){ void yon_load_proceed(YON_CONFIG_TYPE type){
if (type!=YON_CONFIG_CUSTOM){ if (type!=YON_CONFIG_CUSTOM){
yon_config_clean(); 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); yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
switch (type){ }
case YON_CONFIG_GLOBAL: if (type==YON_CONFIG_GLOBAL){
yon_config_load_config(type,config_get_command("global"),NULL); 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); } else if (type==YON_CONFIG_LOCAL){
break;
case YON_CONFIG_LOCAL:
yon_config_load_config(type,config_get_command("system"),NULL); 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); } else if (type==YON_CONFIG_CUSTOM){
break; char *path="";
case YON_CONFIG_CUSTOM: textdomain(template_ui_LocaleName);
char *path = NULL; GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
path=yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_OPEN); textdomain(LocaleName);
yon_char_remove_brackets(path); gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubl-settings-services");
if (!yon_char_is_empty(path)){ gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL);
if ((access(path,0)==F_OK&&access(path,4)!=F_OK)){ GtkFileFilter *filter = gtk_file_filter_new();
if (yon_status_box_is_set()){ gtk_file_filter_add_pattern(filter,"*.ini");
yon_ubl_status_box_render(ACCESS_DENIED_LABEL(path),BACKGROUND_IMAGE_FAIL_TYPE); gtk_file_filter_set_name(filter, "*.ini");
return; 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;
} }
yon_config_clean(); yon_config_clean();
yon_config_load_config(type,config_get_command(path),NULL); if (!yon_char_is_empty(config_get_default_command))
yon_ubl_status_box_render(yon_char_get_localised_from_lib(LOCAL_LOAD_SUCCESS_LABEL),BACKGROUND_IMAGE_SUCCESS_TYPE); yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
char *command = config_get_command(path);
yon_config_load_config(type,command,NULL);
gtk_widget_destroy(dialog);
} else {
gtk_widget_destroy(dialog);
} }
break;
default:
break;
} }
} }

@ -146,7 +146,7 @@ typedef struct{
typedef char* string; typedef char* string;
__attribute__((unused)) static \ __attribute__((unused)) static \
string version_application; string version_application = "2.22";
#define _(String) gettext(String) #define _(String) gettext(String)

Loading…
Cancel
Save