Commit 28a85c7739b251558dba2db2e7a573c99f1359eb

Authored by Perry Werneck
1 parent ac85d880

Ajustes para empacotamento windows.

src/plugins/hllapi/pluginmain.c
@@ -199,6 +199,7 @@ @@ -199,6 +199,7 @@
199 source->secspace, 199 source->secspace,
200 source->dft ); 200 source->dft );
201 */ 201 */
  202 + return EINVAL;
202 } 203 }
203 204
204 static void process_input(pipe_source *source, DWORD cbRead) 205 static void process_input(pipe_source *source, DWORD cbRead)
src/pw3270/v3270ft/select.c
@@ -106,6 +106,8 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu @@ -106,6 +106,8 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu
106 fl.ofn.hwndOwner = GDK_WINDOW_HWND(win); 106 fl.ofn.hwndOwner = GDK_WINDOW_HWND(win);
107 fl.ofn.lpstrFile = fl.szName; 107 fl.ofn.lpstrFile = fl.szName;
108 108
  109 + fl.ofn.lpstrTitle = title;
  110 +
109 // Set lpstrFile[0] to '\0' so that GetOpenFileName does not 111 // Set lpstrFile[0] to '\0' so that GetOpenFileName does not
110 // use the contents of szFile to initialize itself. 112 // use the contents of szFile to initialize itself.
111 fl.ofn.lpstrFile[0] = '\0'; 113 fl.ofn.lpstrFile[0] = '\0';
@@ -117,7 +119,8 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu @@ -117,7 +119,8 @@ gchar * v3270ft_select_file(v3270ft *dialog, const gchar *title, const gchar *bu
117 fl.ofn.lpstrInitialDir = NULL; 119 fl.ofn.lpstrInitialDir = NULL;
118 120
119 // Guarda o valor atual 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 fl.action = action; 125 fl.action = action;
123 126
src/pw3270/v3270ft/v3270ft.c
@@ -276,14 +276,26 @@ static gboolean spin_format(GtkSpinButton *spin, gpointer data) { @@ -276,14 +276,26 @@ static gboolean spin_format(GtkSpinButton *spin, gpointer data) {
276 return TRUE; 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 gchar *filename = v3270ft_select_file(dialog, _("Select local file"), _("Select"), GTK_FILE_CHOOSER_ACTION_OPEN, gtk_entry_get_text(dialog->local)); 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 if(filename) { 287 if(filename) {
284 288
  289 + const gchar *remote = gtk_entry_get_text(dialog->remote);
  290 +
285 gtk_entry_set_text(dialog->local,filename); 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 g_free(filename); 299 g_free(filename);
288 } 300 }
289 301
@@ -452,22 +464,30 @@ static void v3270ft_init(v3270ft *dialog) { @@ -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 dialog->local = GTK_ENTRY(gtk_entry_new()); 468 dialog->local = GTK_ENTRY(gtk_entry_new());
457 entry[1] = GTK_WIDGET(dialog->local); 469 entry[1] = GTK_WIDGET(dialog->local);
458 470
459 gtk_widget_set_hexpand(GTK_WIDGET(dialog->local),TRUE); 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 gtk_entry_set_icon_from_icon_name(dialog->local,GTK_ENTRY_ICON_SECONDARY,"document-open"); 478 gtk_entry_set_icon_from_icon_name(dialog->local,GTK_ENTRY_ICON_SECONDARY,"document-open");
461 gtk_entry_set_icon_activatable(dialog->local,GTK_ENTRY_ICON_SECONDARY,TRUE); 479 gtk_entry_set_icon_activatable(dialog->local,GTK_ENTRY_ICON_SECONDARY,TRUE);
462 gtk_entry_set_icon_tooltip_text(dialog->local,GTK_ENTRY_ICON_SECONDARY,_("Select file")); 480 gtk_entry_set_icon_tooltip_text(dialog->local,GTK_ENTRY_ICON_SECONDARY,_("Select file"));
463 -  
464 g_signal_connect(G_OBJECT(dialog->local),"icon-press",G_CALLBACK(icon_press),dialog); 481 g_signal_connect(G_OBJECT(dialog->local),"icon-press",G_CALLBACK(icon_press),dialog);
  482 +#endif // WIN32
  483 +
465 g_signal_connect(G_OBJECT(dialog->local),"changed",G_CALLBACK(local_file_changed),dialog); 484 g_signal_connect(G_OBJECT(dialog->local),"changed",G_CALLBACK(local_file_changed),dialog);
466 485
467 gtk_entry_set_width_chars(dialog->local,60); 486 gtk_entry_set_width_chars(dialog->local,60);
468 gtk_entry_set_max_length(dialog->local,PATH_MAX); 487 gtk_entry_set_max_length(dialog->local,PATH_MAX);
469 gtk_grid_attach(grid,GTK_WIDGET(dialog->local),1,1,1,1); 488 gtk_grid_attach(grid,GTK_WIDGET(dialog->local),1,1,1,1);
470 489
  490 + // Remote file entry
471 dialog->remote = GTK_ENTRY(gtk_entry_new()); 491 dialog->remote = GTK_ENTRY(gtk_entry_new());
472 entry[2] = GTK_WIDGET(dialog->remote); 492 entry[2] = GTK_WIDGET(dialog->remote);
473 493