Commit 32c52dceb42f69d2e1cd946b7bf82d8f9b5ea855
1 parent
be833d0a
Exists in
master
and in
1 other branch
Working on the new FT component.
Showing
3 changed files
with
77 additions
and
11 deletions
Show diff stats
src/include/v3270/filetransfer.h
| @@ -94,6 +94,10 @@ | @@ -94,6 +94,10 @@ | ||
| 94 | 94 | ||
| 95 | LIB3270_EXPORT GtkWidget * v3270_ft_settings_new(); | 95 | LIB3270_EXPORT GtkWidget * v3270_ft_settings_new(); |
| 96 | LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity); | 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 | LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options); | 101 | LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options); |
| 98 | 102 | ||
| 99 | // FT Activity widget | 103 | // FT Activity widget |
src/v3270ft/dialog.c
| @@ -38,6 +38,7 @@ | @@ -38,6 +38,7 @@ | ||
| 38 | GtkDialog parent; | 38 | GtkDialog parent; |
| 39 | 39 | ||
| 40 | GtkWidget * settings; | 40 | GtkWidget * settings; |
| 41 | + GtkWidget * queue; | ||
| 41 | 42 | ||
| 42 | struct { | 43 | struct { |
| 43 | GtkWidget * valid; | 44 | GtkWidget * valid; |
| @@ -109,6 +110,22 @@ static void validity_changed(GtkWidget G_GNUC_UNUSED(*settings), gboolean valid, | @@ -109,6 +110,22 @@ static void validity_changed(GtkWidget G_GNUC_UNUSED(*settings), gboolean valid, | ||
| 109 | gtk_widget_set_sensitive(widget->button.valid,valid); | 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 | static void V3270FTDialog_init(V3270FTDialog *widget) | 129 | static void V3270FTDialog_init(V3270FTDialog *widget) |
| 113 | { | 130 | { |
| 114 | widget->settings = v3270_ft_settings_new(); | 131 | widget->settings = v3270_ft_settings_new(); |
| @@ -136,8 +153,13 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | @@ -136,8 +153,13 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | ||
| 136 | g_object_set(G_OBJECT(widget->button.valid),"margin-top",6,NULL); | 153 | g_object_set(G_OBJECT(widget->button.valid),"margin-top",6,NULL); |
| 137 | 154 | ||
| 138 | widget->button.reset = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Reset"),FALSE,FALSE,0); | 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 | widget->button.update = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Update"),FALSE,FALSE,0); | 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 | widget->button.insert = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Insert"),FALSE,FALSE,0); | 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 | gtk_widget_set_sensitive(widget->button.update,FALSE); | 164 | gtk_widget_set_sensitive(widget->button.update,FALSE); |
| 143 | gtk_widget_set_sensitive(widget->button.reset,FALSE); | 165 | gtk_widget_set_sensitive(widget->button.reset,FALSE); |
| @@ -149,14 +171,14 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | @@ -149,14 +171,14 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | ||
| 149 | 171 | ||
| 150 | // Create file list view | 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 | // Put the view inside a scrolled window. | 178 | // Put the view inside a scrolled window. |
| 157 | GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL); | 179 | GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL); |
| 158 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | 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 | gtk_widget_set_vexpand(scrolled,TRUE); | 183 | gtk_widget_set_vexpand(scrolled,TRUE); |
| 162 | gtk_widget_set_hexpand(scrolled,TRUE); | 184 | gtk_widget_set_hexpand(scrolled,TRUE); |
| @@ -172,7 +194,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | @@ -172,7 +194,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | ||
| 172 | v3270_ft_activity_set_remote_filename(activity,"remote---"); | 194 | v3270_ft_activity_set_remote_filename(activity,"remote---"); |
| 173 | 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); | 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 | #endif // DEBUG | 198 | #endif // DEBUG |
| 177 | 199 | ||
| 178 | } | 200 | } |
src/v3270ft/settings.c
| @@ -71,6 +71,8 @@ | @@ -71,6 +71,8 @@ | ||
| 71 | VALIDITY_TYPE invalid; | 71 | VALIDITY_TYPE invalid; |
| 72 | } transfer; | 72 | } transfer; |
| 73 | 73 | ||
| 74 | + GObject * activity; | ||
| 75 | + | ||
| 74 | GtkComboBox * type; | 76 | GtkComboBox * type; |
| 75 | GtkWidget * recordFormatBox; | 77 | GtkWidget * recordFormatBox; |
| 76 | GtkWidget * spaceAllocationBox; | 78 | GtkWidget * spaceAllocationBox; |
| @@ -523,21 +525,59 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP | @@ -523,21 +525,59 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP | ||
| 523 | 525 | ||
| 524 | LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity) | 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 | int ix; | 534 | int ix; |
| 527 | V3270FTSettings * settings = GTK_V3270_FT_SETTINGS(widget); | 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 | LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options) | 581 | LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options) |
| 542 | { | 582 | { |
| 543 | int ix; | 583 | int ix; |