|
|
|
@ -231,40 +231,44 @@ void yon_interface_update(){
|
|
|
|
yon_monitor_view_update();
|
|
|
|
yon_monitor_view_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))
|
|
|
|
|
|
|
|
yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type==YON_CONFIG_GLOBAL){
|
|
|
|
|
|
|
|
yon_config_load_config(type,config_get_command("global"),NULL);
|
|
|
|
|
|
|
|
} else if (type==YON_CONFIG_LOCAL){
|
|
|
|
|
|
|
|
yon_config_load_config(type,config_get_command("system"),NULL);
|
|
|
|
|
|
|
|
} else if (type==YON_CONFIG_CUSTOM){
|
|
|
|
|
|
|
|
char *path="";
|
|
|
|
|
|
|
|
textdomain(template_ui_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_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubl-settings-services");
|
|
|
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL);
|
|
|
|
|
|
|
|
GtkFileFilter *filter = gtk_file_filter_new();
|
|
|
|
|
|
|
|
gtk_file_filter_add_pattern(filter,"*.ini");
|
|
|
|
|
|
|
|
gtk_file_filter_set_name(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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_config_clean();
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(config_get_default_command))
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
|
|
|
yon_char_remove_brackets(path);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(path)){
|
|
|
|
|
|
|
|
if ((access(path,0)==F_OK&&access(path,4)!=F_OK)){
|
|
|
|
|
|
|
|
if (yon_status_box_is_set()){
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(ACCESS_DENIED_LABEL(path),BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_local_load(GtkWidget *self,main_window *){
|
|
|
|
void on_config_local_load(GtkWidget *self,main_window *){
|
|
|
|
|