Commit 28a85c7739b251558dba2db2e7a573c99f1359eb
1 parent
ac85d880
Exists in
master
and in
5 other branches
Ajustes para empacotamento windows.
Showing
3 changed files
with
28 additions
and
4 deletions
Show diff stats
src/plugins/hllapi/pluginmain.c
src/pw3270/v3270ft/select.c
... | ... | @@ -106,6 +106,8 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu |
106 | 106 | fl.ofn.hwndOwner = GDK_WINDOW_HWND(win); |
107 | 107 | fl.ofn.lpstrFile = fl.szName; |
108 | 108 | |
109 | + fl.ofn.lpstrTitle = title; | |
110 | + | |
109 | 111 | // Set lpstrFile[0] to '\0' so that GetOpenFileName does not |
110 | 112 | // use the contents of szFile to initialize itself. |
111 | 113 | fl.ofn.lpstrFile[0] = '\0'; |
... | ... | @@ -117,7 +119,8 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu |
117 | 119 | fl.ofn.lpstrInitialDir = NULL; |
118 | 120 | |
119 | 121 | // Guarda o valor atual |
120 | - strncpy(fl.szName,filename,fl.ofn.nMaxFile); | |
122 | + if(filename) | |
123 | + strncpy(fl.szName,filename,fl.ofn.nMaxFile); | |
121 | 124 | |
122 | 125 | fl.action = action; |
123 | 126 | ... | ... |
src/pw3270/v3270ft/v3270ft.c
... | ... | @@ -276,14 +276,26 @@ static gboolean spin_format(GtkSpinButton *spin, gpointer data) { |
276 | 276 | return TRUE; |
277 | 277 | } |
278 | 278 | |
279 | -void icon_press(GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkEvent *event, v3270ft *dialog) { | |
279 | +#ifdef WIN32 | |
280 | +static void select_local_file(GtkButton *button, v3270ft *dialog) { | |
281 | +#else | |
282 | +static void icon_press(GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkEvent *event, v3270ft *dialog) { | |
283 | +#endif // WIN32 | |
280 | 284 | |
281 | 285 | gchar *filename = v3270ft_select_file(dialog, _("Select local file"), _("Select"), GTK_FILE_CHOOSER_ACTION_OPEN, gtk_entry_get_text(dialog->local)); |
282 | 286 | |
283 | 287 | if(filename) { |
284 | 288 | |
289 | + const gchar *remote = gtk_entry_get_text(dialog->remote); | |
290 | + | |
285 | 291 | gtk_entry_set_text(dialog->local,filename); |
286 | 292 | |
293 | + if(!*remote) { | |
294 | + gchar * text = g_path_get_basename(filename); | |
295 | + gtk_entry_set_text(dialog->remote,text); | |
296 | + g_free(text); | |
297 | + } | |
298 | + | |
287 | 299 | g_free(filename); |
288 | 300 | } |
289 | 301 | |
... | ... | @@ -452,22 +464,30 @@ static void v3270ft_init(v3270ft *dialog) { |
452 | 464 | } |
453 | 465 | } |
454 | 466 | |
455 | - // File selection box | |
467 | + // Local file entry | |
456 | 468 | dialog->local = GTK_ENTRY(gtk_entry_new()); |
457 | 469 | entry[1] = GTK_WIDGET(dialog->local); |
458 | 470 | |
459 | 471 | gtk_widget_set_hexpand(GTK_WIDGET(dialog->local),TRUE); |
472 | + | |
473 | +#ifdef WIN32 | |
474 | + widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON); | |
475 | + g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_local_file),dialog); | |
476 | + gtk_grid_attach(grid,widget,2,1,1,1); | |
477 | +#else | |
460 | 478 | gtk_entry_set_icon_from_icon_name(dialog->local,GTK_ENTRY_ICON_SECONDARY,"document-open"); |
461 | 479 | gtk_entry_set_icon_activatable(dialog->local,GTK_ENTRY_ICON_SECONDARY,TRUE); |
462 | 480 | gtk_entry_set_icon_tooltip_text(dialog->local,GTK_ENTRY_ICON_SECONDARY,_("Select file")); |
463 | - | |
464 | 481 | g_signal_connect(G_OBJECT(dialog->local),"icon-press",G_CALLBACK(icon_press),dialog); |
482 | +#endif // WIN32 | |
483 | + | |
465 | 484 | g_signal_connect(G_OBJECT(dialog->local),"changed",G_CALLBACK(local_file_changed),dialog); |
466 | 485 | |
467 | 486 | gtk_entry_set_width_chars(dialog->local,60); |
468 | 487 | gtk_entry_set_max_length(dialog->local,PATH_MAX); |
469 | 488 | gtk_grid_attach(grid,GTK_WIDGET(dialog->local),1,1,1,1); |
470 | 489 | |
490 | + // Remote file entry | |
471 | 491 | dialog->remote = GTK_ENTRY(gtk_entry_new()); |
472 | 492 | entry[2] = GTK_WIDGET(dialog->remote); |
473 | 493 | ... | ... |