Commit 32c52dceb42f69d2e1cd946b7bf82d8f9b5ea855

Authored by Perry Werneck
1 parent be833d0a
Exists in master and in 1 other branch develop

Working on the new FT component.

src/include/v3270/filetransfer.h
... ... @@ -94,6 +94,10 @@
94 94  
95 95 LIB3270_EXPORT GtkWidget * v3270_ft_settings_new();
96 96 LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity);
  97 +
  98 + LIB3270_EXPORT void v3270_ft_settings_reset(GtkWidget *widget);
  99 + LIB3270_EXPORT void v3270_ft_settings_update(GtkWidget *widget);
  100 +
97 101 LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options);
98 102  
99 103 // FT Activity widget
... ...
src/v3270ft/dialog.c
... ... @@ -38,6 +38,7 @@
38 38 GtkDialog parent;
39 39  
40 40 GtkWidget * settings;
  41 + GtkWidget * queue;
41 42  
42 43 struct {
43 44 GtkWidget * valid;
... ... @@ -109,6 +110,22 @@ static void validity_changed(GtkWidget G_GNUC_UNUSED(*settings), gboolean valid,
109 110 gtk_widget_set_sensitive(widget->button.valid,valid);
110 111 }
111 112  
  113 +static void reset_clicked(GtkButton G_GNUC_UNUSED(*button), V3270FTDialog *widget)
  114 +{
  115 + v3270_ft_settings_reset(widget->settings);
  116 +}
  117 +
  118 +static void update_clicked(GtkButton G_GNUC_UNUSED(*button), V3270FTDialog *widget)
  119 +{
  120 + v3270_ft_settings_update(widget->settings);
  121 + gtk_tree_view_columns_autosize(GTK_TREE_VIEW(widget->queue));
  122 + //gtk_widget_queue_draw(widget->queue);
  123 +}
  124 +
  125 +static void insert_clicked(GtkButton G_GNUC_UNUSED(*button), V3270FTDialog *widget)
  126 +{
  127 +}
  128 +
112 129 static void V3270FTDialog_init(V3270FTDialog *widget)
113 130 {
114 131 widget->settings = v3270_ft_settings_new();
... ... @@ -136,8 +153,13 @@ static void V3270FTDialog_init(V3270FTDialog *widget)
136 153 g_object_set(G_OBJECT(widget->button.valid),"margin-top",6,NULL);
137 154  
138 155 widget->button.reset = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Reset"),FALSE,FALSE,0);
  156 + g_signal_connect(widget->button.reset,"clicked",reset_clicked,widget);
  157 +
139 158 widget->button.update = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Update"),FALSE,FALSE,0);
  159 + g_signal_connect(widget->button.update,"clicked",update_clicked,widget);
  160 +
140 161 widget->button.insert = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Insert"),FALSE,FALSE,0);
  162 + g_signal_connect(widget->button.insert,"clicked",insert_clicked,widget);
141 163  
142 164 gtk_widget_set_sensitive(widget->button.update,FALSE);
143 165 gtk_widget_set_sensitive(widget->button.reset,FALSE);
... ... @@ -149,14 +171,14 @@ static void V3270FTDialog_init(V3270FTDialog *widget)
149 171  
150 172 // Create file list view
151 173 {
152   - GtkWidget * files = v3270_activity_list_new();
153   - gtk_widget_set_tooltip_markup(files,_("Files to transfer"));
154   - g_signal_connect(G_OBJECT(files),"row-activated",G_CALLBACK(activity_selected),widget);
  174 + widget->queue = v3270_activity_list_new();
  175 + gtk_widget_set_tooltip_markup(widget->queue,_("Files to transfer"));
  176 + g_signal_connect(G_OBJECT(widget->queue),"row-activated",G_CALLBACK(activity_selected),widget);
155 177  
156 178 // Put the view inside a scrolled window.
157 179 GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL);
158 180 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
159   - gtk_container_add(GTK_CONTAINER(scrolled),files);
  181 + gtk_container_add(GTK_CONTAINER(scrolled),widget->queue);
160 182  
161 183 gtk_widget_set_vexpand(scrolled,TRUE);
162 184 gtk_widget_set_hexpand(scrolled,TRUE);
... ... @@ -172,7 +194,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget)
172 194 v3270_ft_activity_set_remote_filename(activity,"remote---");
173 195 v3270_ft_activity_set_options(activity,LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP|LIB3270_FT_OPTION_APPEND|LIB3270_FT_RECORD_FORMAT_VARIABLE);
174 196  
175   - v3270_activity_list_append(files,activity);
  197 + v3270_activity_list_append(widget->queue,activity);
176 198 #endif // DEBUG
177 199  
178 200 }
... ...
src/v3270ft/settings.c
... ... @@ -71,6 +71,8 @@
71 71 VALIDITY_TYPE invalid;
72 72 } transfer;
73 73  
  74 + GObject * activity;
  75 +
74 76 GtkComboBox * type;
75 77 GtkWidget * recordFormatBox;
76 78 GtkWidget * spaceAllocationBox;
... ... @@ -523,21 +525,59 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP
523 525  
524 526 LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity)
525 527 {
  528 + GTK_V3270_FT_SETTINGS(widget)->activity = activity;
  529 + v3270_ft_settings_reset(widget);
  530 + }
  531 +
  532 + LIB3270_EXPORT void v3270_ft_settings_reset(GtkWidget *widget)
  533 + {
526 534 int ix;
527 535 V3270FTSettings * settings = GTK_V3270_FT_SETTINGS(widget);
528 536  
529   - gtk_entry_set_text(settings->file.local,v3270_ft_activity_get_local_filename(activity));
530   - gtk_entry_set_text(settings->file.remote,v3270_ft_activity_get_remote_filename(activity));
  537 + if(settings->activity)
  538 + {
  539 + gtk_entry_set_text(settings->file.local,v3270_ft_activity_get_local_filename(settings->activity));
  540 + gtk_entry_set_text(settings->file.remote,v3270_ft_activity_get_remote_filename(settings->activity));
531 541  
532   - v3270_ft_settings_set_options(widget,v3270_ft_activity_get_options(activity));
  542 + v3270_ft_settings_set_options(widget,v3270_ft_activity_get_options(settings->activity));
533 543  
534   - for(ix = 0; ix < LIB3270_FT_VALUE_COUNT; ix++)
535   - {
536   - gtk_spin_button_set_value(GTK_SPIN_BUTTON(settings->spins[ix]), v3270_ft_activity_get_value(activity,(LIB3270_FT_VALUE) ix));
  544 + for(ix = 0; ix < LIB3270_FT_VALUE_COUNT; ix++)
  545 + {
  546 + gtk_spin_button_set_value(GTK_SPIN_BUTTON(settings->spins[ix]), v3270_ft_activity_get_value(settings->activity,(LIB3270_FT_VALUE) ix));
  547 + }
537 548 }
538 549  
539 550 }
540 551  
  552 + LIB3270_EXPORT void v3270_ft_settings_update(GtkWidget *widget)
  553 + {
  554 + int ix;
  555 + V3270FTSettings * settings = GTK_V3270_FT_SETTINGS(widget);
  556 +
  557 + debug("%s: widget=%p activity=%p",__FUNCTION__,settings,settings->activity);
  558 +
  559 + if(settings->activity)
  560 + {
  561 + v3270_ft_activity_set_local_filename(settings->activity,gtk_entry_get_text(settings->file.local));
  562 + v3270_ft_activity_set_remote_filename(settings->activity,gtk_entry_get_text(settings->file.remote));
  563 +
  564 + LIB3270_FT_OPTION options = 0;
  565 +
  566 + for(ix=0;ix<NUM_OPTIONS_WIDGETS;ix++) {
  567 + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(settings->options[ix])))
  568 + options |= ft_option[ix].opt;
  569 + }
  570 +
  571 + v3270_ft_activity_set_options(settings->activity,options);
  572 +
  573 + for(ix = 0; ix < LIB3270_FT_VALUE_COUNT; ix++)
  574 + {
  575 + v3270_ft_activity_set_value(settings->activity,(LIB3270_FT_VALUE) ix, (guint) gtk_spin_button_get_value(GTK_SPIN_BUTTON(settings->spins[ix])));
  576 + }
  577 +
  578 + }
  579 + }
  580 +
541 581 LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options)
542 582 {
543 583 int ix;
... ...