|
|
|
|
@ -10,8 +10,16 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window){
|
|
|
|
|
|
|
|
|
|
if (access(path,F_OK)){
|
|
|
|
|
int homedir_create = 0;
|
|
|
|
|
if (!strstr(path,"/")){
|
|
|
|
|
homedir_create = 1;
|
|
|
|
|
int file_create = 0;
|
|
|
|
|
int pos = yon_char_find_last((char*)path,'/');
|
|
|
|
|
if (pos>=-1){
|
|
|
|
|
char *path_copy = yon_char_new(path);
|
|
|
|
|
char *dir_path = yon_char_divide(path_copy,pos);
|
|
|
|
|
if (access(dir_path,F_OK)){
|
|
|
|
|
homedir_create = 1;
|
|
|
|
|
}
|
|
|
|
|
free(path_copy);
|
|
|
|
|
free(dir_path);
|
|
|
|
|
}
|
|
|
|
|
dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
|
|
|
|
|
data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL;
|
|
|
|
|
@ -20,6 +28,8 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window){
|
|
|
|
|
char *full_path = NULL;
|
|
|
|
|
if (homedir_create){
|
|
|
|
|
full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL);
|
|
|
|
|
} else if (file_create){
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
full_path = yon_char_new(path);
|
|
|
|
|
}
|
|
|
|
|
@ -33,12 +43,8 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_path_choose(GtkWidget *,configuration_window *window){
|
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SAVE);
|
|
|
|
|
filechooser_window *dialog = yon_config_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SAVE);
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window),CONFIGURATION_MODE_TITLE_LABEL,icon_path,"filechooser_window");
|
|
|
|
|
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->MainFileChooser),filter);
|
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_APPLY){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PathEntry),dialog->last_success_selection);
|
|
|
|
|
free(dialog);
|
|
|
|
|
|