Commit 8df67fe250f224d439b992aa5580c2ed2d631aef

Authored by perry.werneck@gmail.com
1 parent b4bd5d50

Melhorando diálogo de transferência de arquivos

src/pw3270/ft/ftdialog.c
... ... @@ -67,6 +67,8 @@
67 67 GtkWidget * units; /**< Units frame box */
68 68 GtkWidget * ready; /**< Send/Save button */
69 69 GtkToggleButton * button[BUTTON_COUNT]; /**< Buttons */
  70 + GtkToggleButton * recfm[4]; /**< Record format buttons */
  71 + GtkToggleButton * btnUnits[4]; /**< Unit buttons */
70 72 GtkSpinButton * value[VALUE_COUNT];
71 73 gboolean local; /**< TRUE if local filename is ok */
72 74 gboolean remote; /**< TRUE if remote filename is ok */
... ... @@ -229,7 +231,7 @@ static GtkWidget * ftvalue_new(v3270FTD *dialog, GtkGrid *grid, int r, const str
229 231  
230 232 }
231 233  
232   -static GtkWidget * ftradio_new(v3270FTD *dialog, const gchar *title, const gchar *tooltip, const struct rdoptions *opt)
  234 +static GtkWidget * ftradio_new(v3270FTD *dialog, GtkToggleButton **button, const gchar *title, const gchar *tooltip, const struct rdoptions *opt)
233 235 {
234 236 GtkContainer * frame = GTK_CONTAINER(gtk_frame_new(title));
235 237 GtkBox * box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2));
... ... @@ -238,16 +240,16 @@ static GtkWidget * ftradio_new(v3270FTD *dialog, const gchar *title, const gchar
238 240  
239 241 for(f=0;opt[f].label;f++)
240 242 {
241   - GtkWidget * button = gtk_radio_button_new_with_label(lst,gettext(opt[f].label));
242   - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),(dialog->options & opt[f].flag) != 0);
  243 + button[f] = GTK_TOGGLE_BUTTON(gtk_radio_button_new_with_label(lst,gettext(opt[f].label)));
  244 + gtk_toggle_button_set_active(button[f],(dialog->options & opt[f].flag) != 0);
243 245 if(opt[f].tooltip)
244   - gtk_widget_set_tooltip_text(button,gettext(opt[f].tooltip));
  246 + gtk_widget_set_tooltip_text(GTK_WIDGET(button[f]),gettext(opt[f].tooltip));
245 247  
246   - g_object_set_data(G_OBJECT(button),"cfg",(gpointer) &opt[f]);
247   - g_signal_connect(G_OBJECT(button),"toggled",G_CALLBACK(toggle_option),dialog);
  248 + g_object_set_data(G_OBJECT(button[f]),"cfg",(gpointer) &opt[f]);
  249 + g_signal_connect(G_OBJECT(button[f]),"toggled",G_CALLBACK(toggle_option),dialog);
248 250  
249   - gtk_box_pack_start(box,button,FALSE,TRUE,2);
250   - lst = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
  251 + gtk_box_pack_start(box,GTK_WIDGET(button[f]),FALSE,TRUE,2);
  252 + lst = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button[f]));
251 253 }
252 254  
253 255 gtk_widget_set_tooltip_text(GTK_WIDGET(frame),tooltip);
... ... @@ -526,7 +528,7 @@ GtkWidget * v3270_ft_dialog_new(GtkWidget *parent, LIB3270_FT_OPTION options)
526 528 };
527 529  
528 530 gtk_grid_attach( grid,
529   - ftradio_new(dialog,_("Record format"),_("Controls the record format of files created on the host."),recfm),
  531 + ftradio_new(dialog,dialog->recfm,_("Record format"),_("Controls the record format of files created on the host."),recfm),
530 532 0,0,2,1
531 533 );
532 534  
... ... @@ -561,7 +563,7 @@ GtkWidget * v3270_ft_dialog_new(GtkWidget *parent, LIB3270_FT_OPTION options)
561 563 }
562 564 };
563 565  
564   - dialog->units = ftradio_new(dialog,_("Space allocation units"),_("Specifies the units for the TSO host primary and secondary space options."),units);
  566 + dialog->units = ftradio_new(dialog,dialog->btnUnits,_("Space allocation units"),_("Specifies the units for the TSO host primary and secondary space options."),units);
565 567  
566 568 gtk_grid_attach( grid,
567 569 dialog->units,
... ... @@ -685,6 +687,7 @@ void v3270_ft_dialog_set_tso(GtkWidget *widget,gboolean flag)
685 687 GTK_WIDGET(dialog->value[VALUE_PRIMSPACE]),
686 688 GTK_WIDGET(dialog->value[VALUE_SECSPACE]),
687 689 GTK_WIDGET(dialog->units),
  690 + GTK_WIDGET(dialog->recfm[3]),
688 691 };
689 692  
690 693 int f;
... ...
src/pw3270/ft/testprogram.c
... ... @@ -38,11 +38,21 @@ int main (int argc, char *argv[])
38 38  
39 39 gtk_init (&argc, &argv);
40 40  
  41 + /*
41 42 {
42 43 GtkWidget *win = v3270_ft_dialog_new(NULL,LIB3270_FT_OPTION_RECEIVE);
43 44 v3270_ft_dialog_set_options(win,LIB3270_FT_OPTION_REMAP);
44 45 gtk_dialog_run(GTK_DIALOG(win));
45 46 }
  47 + */
  48 +
  49 + {
  50 + GtkWidget *win = v3270_ft_dialog_new(NULL,LIB3270_FT_OPTION_SEND);
  51 + v3270_ft_dialog_set_tso(win,FALSE);
  52 + gtk_dialog_run(GTK_DIALOG(win));
  53 + }
  54 +
  55 +
46 56 // gtk_dialog_run(GTK_DIALOG(v3270_ft_dialog_new(NULL,LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_REMAP)));
47 57  
48 58  
... ...