Commit ac7c336ba8bca2947703ff3924098f60e1470bb8
1 parent
38ddbf3c
Exists in
master
and in
5 other branches
Ajustando default no diretório de documentos ao ler/gravar arquivos texto
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
src/pw3270/dialog.c
@@ -243,6 +243,10 @@ | @@ -243,6 +243,10 @@ | ||
243 | GtkWindow * toplevel = GTK_WINDOW(gtk_widget_get_toplevel(widget)); | 243 | GtkWindow * toplevel = GTK_WINDOW(gtk_widget_get_toplevel(widget)); |
244 | const gchar * user_title = g_object_get_data(G_OBJECT(action),"title"); | 244 | const gchar * user_title = g_object_get_data(G_OBJECT(action),"title"); |
245 | const gchar * filename = g_object_get_data(G_OBJECT(action),"filename"); | 245 | const gchar * filename = g_object_get_data(G_OBJECT(action),"filename"); |
246 | + const gchar * extension = g_object_get_data(G_OBJECT(action),"extension"); | ||
247 | + | ||
248 | + if(!extension) | ||
249 | + extension = "txt"; | ||
246 | 250 | ||
247 | if(!text) | 251 | if(!text) |
248 | return 0; | 252 | return 0; |
@@ -272,6 +276,8 @@ | @@ -272,6 +276,8 @@ | ||
272 | ptr = get_string_from_config("save",gtk_action_get_name(action),""); | 276 | ptr = get_string_from_config("save",gtk_action_get_name(action),""); |
273 | if(*ptr) | 277 | if(*ptr) |
274 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),ptr); | 278 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),ptr); |
279 | + else | ||
280 | + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS)); | ||
275 | g_free(ptr); | 281 | g_free(ptr); |
276 | 282 | ||
277 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | 283 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
@@ -403,8 +409,12 @@ | @@ -403,8 +409,12 @@ | ||
403 | add_option_menus(dialog, action, &encattr); | 409 | add_option_menus(dialog, action, &encattr); |
404 | 410 | ||
405 | ptr = get_string_from_config("load",gtk_action_get_name(action),""); | 411 | ptr = get_string_from_config("load",gtk_action_get_name(action),""); |
412 | + | ||
406 | if(*ptr) | 413 | if(*ptr) |
407 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),ptr); | 414 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),ptr); |
415 | + else | ||
416 | + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS)); | ||
417 | + | ||
408 | g_free(ptr); | 418 | g_free(ptr); |
409 | 419 | ||
410 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | 420 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |