From 6f3309d56cf23a0181fbd9d5ad7fb89989f3b0ac Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 27 Feb 2019 17:17:20 -0300 Subject: [PATCH] Updating transfer settings dialog. --- src/dialogs/settingsdialog.c | 2 ++ src/dialogs/tools.c | 6 +++++- src/filetransfer/settings.c | 24 ++++++++++++++++++++++++ src/filetransfer/tables.c | 16 ++++++++-------- src/include/internals.h | 3 +-- src/include/v3270/filetransfer.h | 2 ++ src/testprogram/testprogram.c | 8 ++++---- 7 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/dialogs/settingsdialog.c b/src/dialogs/settingsdialog.c index b7c5f32..8985434 100644 --- a/src/dialogs/settingsdialog.c +++ b/src/dialogs/settingsdialog.c @@ -495,4 +495,6 @@ LIB3270_EXPORT void v3270_ft_settings_dialog_set_session(GtkWidget *widget, H327 gtk_widget_set_sensitive(dialog->button.begin,lib3270_is_connected(hSession) ? TRUE : FALSE); + v3270_ft_settings_set_tso(dialog->settings,lib3270_is_tso(hSession)); + } diff --git a/src/dialogs/tools.c b/src/dialogs/tools.c index ad79ab5..4007de2 100644 --- a/src/dialogs/tools.c +++ b/src/dialogs/tools.c @@ -62,11 +62,15 @@ return GTK_WIDGET(frame); } - GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding) + GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, const gchar *tooltip, GtkAlign align, gboolean expand, gboolean fill, guint padding) { GtkWidget * frame = v3270_dialog_create_frame(child,title); gtk_widget_set_halign(GTK_WIDGET(frame),align); gtk_box_pack_start(GTK_BOX(box),frame,expand,fill,padding); + + if(tooltip) + gtk_widget_set_tooltip_markup(frame,tooltip); + return child; } diff --git a/src/filetransfer/settings.c b/src/filetransfer/settings.c index d467ced..72bc0fd 100644 --- a/src/filetransfer/settings.c +++ b/src/filetransfer/settings.c @@ -76,6 +76,7 @@ GtkComboBox * type; GtkWidget * recordFormatBox; GtkWidget * spaceAllocationBox; + GtkWidget * units; GtkWidget * options[NUM_OPTIONS_WIDGETS]; GtkWidget * spins[LIB3270_FT_VALUE_COUNT]; @@ -430,6 +431,7 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP options, gtk_box_new(GTK_ORIENTATION_VERTICAL,6), _("Transfer options"), + NULL, GTK_ALIGN_START, FALSE, FALSE, @@ -456,6 +458,7 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP options, gtk_box_new(GTK_ORIENTATION_VERTICAL,6), _("Record format"), + _("Specifies the record format of the data set."), GTK_ALIGN_CENTER, FALSE, FALSE, @@ -481,6 +484,7 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP options, gtk_box_new(GTK_ORIENTATION_VERTICAL,6), _("Space allocation units"), + _("Specifies the units for the TSO host primary and secondary space options."), GTK_ALIGN_END, FALSE, FALSE, @@ -640,3 +644,23 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP } + + LIB3270_EXPORT void v3270_ft_settings_set_tso(GtkWidget *widget, gboolean tso) + { + V3270FTSettings * settings = GTK_V3270_FT_SETTINGS(widget); + debug("Host is %s",(tso ? "TSO" : "not TSO")); + + GtkWidget *widgets[] = + { + GTK_WIDGET(settings->spins[LIB3270_FT_VALUE_PRIMSPACE]), + GTK_WIDGET(settings->spins[LIB3270_FT_VALUE_SECSPACE]), + GTK_WIDGET(settings->options[7]), + GTK_WIDGET(settings->spaceAllocationBox) + }; + + size_t ix; + + for(ix = 0; ix < G_N_ELEMENTS(widgets); ix++) + gtk_widget_set_sensitive(widgets[ix],tso); + + } diff --git a/src/filetransfer/tables.c b/src/filetransfer/tables.c index c502d79..b7b6242 100644 --- a/src/filetransfer/tables.c +++ b/src/filetransfer/tables.c @@ -161,14 +161,6 @@ const struct v3270ft_value ft_value[] = { { // LIB3270_FT_VALUE_BLKSIZE - "primary", - 0,99999, - N_( "Primary space:" ), - N_( "Primary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) - }, - - { - // LIB3270_FT_VALUE_PRIMSPACE "blksize", 0,32760, N_( "Block size:" ), @@ -180,6 +172,14 @@ const struct v3270ft_value ft_value[] = { }, { + // LIB3270_FT_VALUE_PRIMSPACE + "primary", + 0,99999, + N_( "Primary space:" ), + N_( "Primary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) + }, + + { // LIB3270_FT_VALUE_SECSPACE "secondary", 0,99999, diff --git a/src/include/internals.h b/src/include/internals.h index 4c98da9..ff77f03 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -49,8 +49,7 @@ G_GNUC_INTERNAL GtkWidget * v3270_box_pack_start(GtkWidget *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding); G_GNUC_INTERNAL GtkWidget * v3270_box_pack_end(GtkWidget *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding); - G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding); - G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding); + G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, const gchar *tooltip, GtkAlign align, gboolean expand, gboolean fill, guint padding); G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_grid(GtkAlign align); G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title); diff --git a/src/include/v3270/filetransfer.h b/src/include/v3270/filetransfer.h index 4361de7..1fab56a 100644 --- a/src/include/v3270/filetransfer.h +++ b/src/include/v3270/filetransfer.h @@ -92,6 +92,8 @@ LIB3270_EXPORT GtkWidget * v3270_ft_settings_new(); + LIB3270_EXPORT void v3270_ft_settings_set_tso(GtkWidget *widget, gboolean tso); + LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity); LIB3270_EXPORT GObject * v3270_ft_settings_get_activity(GtkWidget *widget); diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 4fdfb72..8a5564a 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -156,6 +156,7 @@ static void ft_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),trace,TRUE,TRUE,2); */ + /* // // Test transfer dialog. // @@ -170,6 +171,7 @@ static void ft_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) 0, 4096 ); + */ /* // @@ -182,13 +184,11 @@ static void ft_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) v3270_ft_activity_set_options(activity,LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_REMAP); */ - /* // // Test settings dialog // GtkWidget * dialog = v3270_ft_settings_dialog_new(terminal); - v3270_ft_settings_dialog_append_activity(dialog,activity,NULL); - */ + // v3270_ft_settings_dialog_append_activity(dialog,activity,NULL); /* // @@ -200,11 +200,11 @@ static void ft_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) v3270_ft_worker_set_session(worker,v3270_get_session(terminal)); v3270_ft_worker_set_activity(worker,activity); v3270_ft_worker_start(worker); + */ gtk_widget_show_all(dialog); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); - */ } -- libgit2 0.21.2