|
|
|
|
@ -42,27 +42,27 @@ void yon_interface_save(main_window *widgets){
|
|
|
|
|
void on_config_global_local_save(GtkWidget *, main_window *widgets){
|
|
|
|
|
yon_interface_save(widgets);
|
|
|
|
|
main_config.save_config=YON_CONFIG_BOTH;
|
|
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
|
|
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_command("global"),NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(GtkWidget *, main_window *widgets){
|
|
|
|
|
yon_interface_save(widgets);
|
|
|
|
|
main_config.save_config=YON_CONFIG_LOCAL;
|
|
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,config_get_local_command,NULL);
|
|
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,config_get_command("system"),NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_global_save(GtkWidget *, main_window *widgets){
|
|
|
|
|
yon_interface_save(widgets);
|
|
|
|
|
main_config.save_config=YON_CONFIG_GLOBAL;
|
|
|
|
|
yon_save_proceed("global",YON_CONFIG_GLOBAL,config_get_global_command,NULL);
|
|
|
|
|
yon_save_proceed("global",YON_CONFIG_GLOBAL,config_get_command("global"),NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_custom_save(GtkWidget *, main_window *widgets){
|
|
|
|
|
yon_interface_save(widgets);
|
|
|
|
|
main_config.save_config=YON_CONFIG_LOCAL;
|
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,yon_config_get_custom_command("system"),NULL);
|
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,config_get_command("system"),NULL);
|
|
|
|
|
if (window){};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -91,36 +91,30 @@ void on_config_custom_load(GtkWidget *,main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
yon_config_clean();
|
|
|
|
|
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);
|
|
|
|
|
if (type==YON_CONFIG_GLOBAL){
|
|
|
|
|
yon_config_load_config(type,yon_debug_output("%s\n",config_get_global_command),NULL);
|
|
|
|
|
} else if (type==YON_CONFIG_LOCAL){
|
|
|
|
|
yon_config_load_config(type,config_get_local_command,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;
|
|
|
|
|
}
|
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
}
|
|
|
|
|
char *command = yon_config_get_custom_command(path);
|
|
|
|
|
yon_config_load_config(type,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;
|
|
|
|
|
}
|
|
|
|
|
}
|