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 | 243 | GtkWindow * toplevel = GTK_WINDOW(gtk_widget_get_toplevel(widget)); |
| 244 | 244 | const gchar * user_title = g_object_get_data(G_OBJECT(action),"title"); |
| 245 | 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 | 251 | if(!text) |
| 248 | 252 | return 0; |
| ... | ... | @@ -272,6 +276,8 @@ |
| 272 | 276 | ptr = get_string_from_config("save",gtk_action_get_name(action),""); |
| 273 | 277 | if(*ptr) |
| 274 | 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 | 281 | g_free(ptr); |
| 276 | 282 | |
| 277 | 283 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
| ... | ... | @@ -403,8 +409,12 @@ |
| 403 | 409 | add_option_menus(dialog, action, &encattr); |
| 404 | 410 | |
| 405 | 411 | ptr = get_string_from_config("load",gtk_action_get_name(action),""); |
| 412 | + | |
| 406 | 413 | if(*ptr) |
| 407 | 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 | 418 | g_free(ptr); |
| 409 | 419 | |
| 410 | 420 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | ... | ... |