Commit b93f900fc6dcf65e2ab5d91a8f23a9a923584596
1 parent
7b635347
Exists in
master
and in
1 other branch
Adjusting gettext use.
Showing
6 changed files
with
545 additions
and
569 deletions
Show diff stats
.gitignore
src/dialogs/popups.c
| @@ -34,8 +34,7 @@ | @@ -34,8 +34,7 @@ | ||
| 34 | 34 | ||
| 35 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 35 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 36 | 36 | ||
| 37 | - void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text) | ||
| 38 | - { | 37 | + void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text) { |
| 39 | GtkWidget * dialog; | 38 | GtkWidget * dialog; |
| 40 | GtkWidget * toplevel = NULL; | 39 | GtkWidget * toplevel = NULL; |
| 41 | GtkMessageType msgtype = GTK_MESSAGE_WARNING; | 40 | GtkMessageType msgtype = GTK_MESSAGE_WARNING; |
| @@ -47,8 +46,7 @@ | @@ -47,8 +46,7 @@ | ||
| 47 | if(!GTK_IS_WINDOW(toplevel)) | 46 | if(!GTK_IS_WINDOW(toplevel)) |
| 48 | toplevel = NULL; | 47 | toplevel = NULL; |
| 49 | 48 | ||
| 50 | - if(type == LIB3270_NOTIFY_CRITICAL) | ||
| 51 | - { | 49 | + if(type == LIB3270_NOTIFY_CRITICAL) { |
| 52 | msgtype = GTK_MESSAGE_ERROR; | 50 | msgtype = GTK_MESSAGE_ERROR; |
| 53 | buttons = GTK_BUTTONS_CLOSE; | 51 | buttons = GTK_BUTTONS_CLOSE; |
| 54 | } | 52 | } |
| @@ -56,18 +54,13 @@ | @@ -56,18 +54,13 @@ | ||
| 56 | if(!title) | 54 | if(!title) |
| 57 | title = _( "Error" ); | 55 | title = _( "Error" ); |
| 58 | 56 | ||
| 59 | - if(message) | ||
| 60 | - { | 57 | + if(message) { |
| 61 | dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",message); | 58 | dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",message); |
| 62 | if(text && *text) | 59 | if(text && *text) |
| 63 | gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); | 60 | gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); |
| 64 | - } | ||
| 65 | - else if(text && *text) | ||
| 66 | - { | 61 | + } else if(text && *text) { |
| 67 | dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); | 62 | dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); |
| 68 | - } | ||
| 69 | - else | ||
| 70 | - { | 63 | + } else { |
| 71 | dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",title); | 64 | dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",title); |
| 72 | } | 65 | } |
| 73 | 66 | ||
| @@ -78,8 +71,7 @@ | @@ -78,8 +71,7 @@ | ||
| 78 | 71 | ||
| 79 | } | 72 | } |
| 80 | 73 | ||
| 81 | - void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body) | ||
| 82 | - { | 74 | + void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body) { |
| 83 | GtkWidget * dialog = | 75 | GtkWidget * dialog = |
| 84 | gtk_message_dialog_new_with_markup( | 76 | gtk_message_dialog_new_with_markup( |
| 85 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), | 77 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
| @@ -101,8 +93,7 @@ | @@ -101,8 +93,7 @@ | ||
| 101 | 93 | ||
| 102 | } | 94 | } |
| 103 | 95 | ||
| 104 | - void v3270_popup_gerror(GtkWidget *widget, GError *error, const gchar *title, const gchar *fmt, ...) | ||
| 105 | - { | 96 | + void v3270_popup_gerror(GtkWidget *widget, GError *error, const gchar *title, const gchar *fmt, ...) { |
| 106 | 97 | ||
| 107 | // Format message. | 98 | // Format message. |
| 108 | va_list arg_ptr; | 99 | va_list arg_ptr; |
| @@ -133,12 +124,11 @@ | @@ -133,12 +124,11 @@ | ||
| 133 | 124 | ||
| 134 | } | 125 | } |
| 135 | 126 | ||
| 136 | - GtkResponseType v3270_popup_toggleable_dialog(GtkWidget *widget, V3270_TOGGLEABLE_DIALOG id, const gchar *title, const gchar *summary, const gchar *body, const gchar *first_button_text, ...) | ||
| 137 | - { | 127 | + GtkResponseType v3270_popup_toggleable_dialog(GtkWidget *widget, V3270_TOGGLEABLE_DIALOG id, const gchar *title, const gchar *summary, const gchar *body, const gchar *first_button_text, ...) { |
| 128 | + | ||
| 138 | GtkResponseType response = GTK_V3270(widget)->responses[id]; | 129 | GtkResponseType response = GTK_V3270(widget)->responses[id]; |
| 139 | 130 | ||
| 140 | - if(response == GTK_RESPONSE_NONE) | ||
| 141 | - { | 131 | + if(response == GTK_RESPONSE_NONE) { |
| 142 | GtkWidget * dialog = | 132 | GtkWidget * dialog = |
| 143 | gtk_message_dialog_new( | 133 | gtk_message_dialog_new( |
| 144 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), | 134 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
| @@ -174,8 +164,7 @@ | @@ -174,8 +164,7 @@ | ||
| 174 | 0 | 164 | 0 |
| 175 | ); | 165 | ); |
| 176 | 166 | ||
| 177 | - if(first_button_text) | ||
| 178 | - { | 167 | + if(first_button_text) { |
| 179 | // From https://github.com/GNOME/gtk/blob/master/gtk/gtkdialog.c | 168 | // From https://github.com/GNOME/gtk/blob/master/gtk/gtkdialog.c |
| 180 | va_list args; | 169 | va_list args; |
| 181 | const gchar* text; | 170 | const gchar* text; |
| @@ -184,8 +173,7 @@ | @@ -184,8 +173,7 @@ | ||
| 184 | va_start(args, first_button_text); | 173 | va_start(args, first_button_text); |
| 185 | 174 | ||
| 186 | text = first_button_text; | 175 | text = first_button_text; |
| 187 | - while(text) | ||
| 188 | - { | 176 | + while(text) { |
| 189 | response_id = va_arg(args, gint); | 177 | response_id = va_arg(args, gint); |
| 190 | 178 | ||
| 191 | gtk_dialog_add_button(GTK_DIALOG(dialog), text, response_id); | 179 | gtk_dialog_add_button(GTK_DIALOG(dialog), text, response_id); |
| @@ -202,8 +190,8 @@ | @@ -202,8 +190,8 @@ | ||
| 202 | gtk_widget_show_all(dialog); | 190 | gtk_widget_show_all(dialog); |
| 203 | response = gtk_dialog_run(GTK_DIALOG(dialog)); | 191 | response = gtk_dialog_run(GTK_DIALOG(dialog)); |
| 204 | 192 | ||
| 205 | - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dont_ask))) | ||
| 206 | - { | 193 | + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dont_ask))) { |
| 194 | + | ||
| 207 | GTK_V3270(widget)->responses[id] = response; | 195 | GTK_V3270(widget)->responses[id] = response; |
| 208 | g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->responses[id]); | 196 | g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->responses[id]); |
| 209 | v3270_emit_save_settings(widget); | 197 | v3270_emit_save_settings(widget); |
src/filetransfer/activity.c
| @@ -37,376 +37,376 @@ | @@ -37,376 +37,376 @@ | ||
| 37 | * | 37 | * |
| 38 | */ | 38 | */ |
| 39 | 39 | ||
| 40 | - #include <internals.h> | ||
| 41 | - #include <stdlib.h> | ||
| 42 | - #include "private.h" | ||
| 43 | - #include <v3270/filetransfer.h> | 40 | +#include <internals.h> |
| 41 | +#include <stdlib.h> | ||
| 42 | +#include "private.h" | ||
| 43 | +#include <v3270/filetransfer.h> | ||
| 44 | 44 | ||
| 45 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ | 45 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
| 46 | 46 | ||
| 47 | - struct _V3270FTActivityClass | ||
| 48 | - { | ||
| 49 | - GObjectClass parent_class; | 47 | +struct _V3270FTActivityClass |
| 48 | +{ | ||
| 49 | + GObjectClass parent_class; | ||
| 50 | 50 | ||
| 51 | - }; | 51 | +}; |
| 52 | 52 | ||
| 53 | - struct _V3270FTActivity | ||
| 54 | - { | ||
| 55 | - GObject parent; | 53 | +struct _V3270FTActivity |
| 54 | +{ | ||
| 55 | + GObject parent; | ||
| 56 | 56 | ||
| 57 | - /// @brief Transfer options. | ||
| 58 | - LIB3270_FT_OPTION options; | 57 | + /// @brief Transfer options. |
| 58 | + LIB3270_FT_OPTION options; | ||
| 59 | 59 | ||
| 60 | - /// @brief Values. | ||
| 61 | - guint values[LIB3270_FT_VALUE_COUNT]; | 60 | + /// @brief Values. |
| 61 | + guint values[LIB3270_FT_VALUE_COUNT]; | ||
| 62 | 62 | ||
| 63 | - /// @brief File names | ||
| 64 | - struct { | ||
| 65 | - gchar * local; | ||
| 66 | - gchar * remote; | ||
| 67 | - } file; | 63 | + /// @brief File names |
| 64 | + struct { | ||
| 65 | + gchar * local; | ||
| 66 | + gchar * remote; | ||
| 67 | + } file; | ||
| 68 | 68 | ||
| 69 | - }; | 69 | +}; |
| 70 | 70 | ||
| 71 | - enum | ||
| 72 | - { | ||
| 73 | - PROP_0, | ||
| 74 | - PROP_LOCAL, | ||
| 75 | - PROP_REMOTE | ||
| 76 | - }; | 71 | +enum |
| 72 | +{ | ||
| 73 | + PROP_0, | ||
| 74 | + PROP_LOCAL, | ||
| 75 | + PROP_REMOTE | ||
| 76 | +}; | ||
| 77 | 77 | ||
| 78 | - G_DEFINE_TYPE(V3270FTActivity, V3270FTActivity, G_TYPE_INITIALLY_UNOWNED); | 78 | +G_DEFINE_TYPE(V3270FTActivity, V3270FTActivity, G_TYPE_INITIALLY_UNOWNED); |
| 79 | 79 | ||
| 80 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 80 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 81 | 81 | ||
| 82 | - static void dispose(GObject *object) | ||
| 83 | - { | ||
| 84 | - debug("activity::%s(%p)",__FUNCTION__,object); | ||
| 85 | - | ||
| 86 | - V3270FTActivity * activity = G_V3270_FT_ACTIVITY(object); | ||
| 87 | - | ||
| 88 | - g_free(activity->file.local); | ||
| 89 | - g_free(activity->file.remote); | ||
| 90 | - | ||
| 91 | - G_OBJECT_CLASS(V3270FTActivity_parent_class)->dispose(object); | ||
| 92 | - | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) | ||
| 96 | - { | ||
| 97 | - switch(prop_id) | ||
| 98 | - { | ||
| 99 | - case PROP_LOCAL: | ||
| 100 | - v3270_ft_activity_set_local_filename(object,g_value_get_string(value)); | ||
| 101 | - break; | ||
| 102 | - | ||
| 103 | - case PROP_REMOTE: | ||
| 104 | - v3270_ft_activity_set_remote_filename(object,g_value_get_string(value)); | ||
| 105 | - break; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) | ||
| 111 | - { | ||
| 112 | - switch(prop_id) | ||
| 113 | - { | ||
| 114 | - case PROP_LOCAL: | ||
| 115 | - g_value_set_string(value,v3270_ft_activity_get_local_filename(object)); | ||
| 116 | - break; | ||
| 117 | - | ||
| 118 | - case PROP_REMOTE: | ||
| 119 | - g_value_set_string(value,v3270_ft_activity_get_remote_filename(object)); | ||
| 120 | - break; | ||
| 121 | - } | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - static void V3270FTActivity_class_init(V3270FTActivityClass *klass) | ||
| 125 | - { | ||
| 126 | - G_OBJECT_CLASS(klass)->dispose = dispose; | ||
| 127 | - | ||
| 128 | - G_OBJECT_CLASS(klass)->set_property = set_property; | ||
| 129 | - G_OBJECT_CLASS(klass)->get_property = get_property; | ||
| 130 | - | ||
| 131 | - g_object_class_install_property( | ||
| 132 | - G_OBJECT_CLASS(klass), | ||
| 133 | - PROP_LOCAL, | ||
| 134 | - g_param_spec_string ("local", "Local", | ||
| 135 | - _( "Full path of local file" ), | ||
| 136 | - FALSE, G_PARAM_READWRITE)); | ||
| 137 | - | ||
| 138 | - g_object_class_install_property( | ||
| 139 | - G_OBJECT_CLASS(klass), | ||
| 140 | - PROP_LOCAL, | ||
| 141 | - g_param_spec_string ("remote", "remote", | ||
| 142 | - _( "Full path of remote file" ), | ||
| 143 | - FALSE, G_PARAM_READWRITE)); | ||
| 144 | - | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - static void V3270FTActivity_init(V3270FTActivity *widget) | ||
| 148 | - { | ||
| 149 | - widget->values[LIB3270_FT_VALUE_LRECL] = 0; | ||
| 150 | - widget->values[LIB3270_FT_VALUE_BLKSIZE] = 0; | ||
| 151 | - widget->values[LIB3270_FT_VALUE_PRIMSPACE] = 0; | ||
| 152 | - widget->values[LIB3270_FT_VALUE_SECSPACE] = 0; | ||
| 153 | - widget->values[LIB3270_FT_VALUE_DFT] = 4096; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - /** | ||
| 157 | - * v3270_ft_activity_new: | ||
| 158 | - * | ||
| 159 | - * Creates an empty file transfer activity. | ||
| 160 | - * | ||
| 161 | - * Returns: a new #V3270FTActivity. | ||
| 162 | - */ | ||
| 163 | - LIB3270_EXPORT GObject * v3270_ft_activity_new() | ||
| 164 | - { | ||
| 165 | - return g_object_new(G_TYPE_V3270_FT_ACTIVITY, NULL); | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - LIB3270_EXPORT GObject * v3270_ft_activity_new_from_filename(const gchar *filename) | ||
| 169 | - { | ||
| 170 | - GObject *activity = g_object_new(G_TYPE_V3270_FT_ACTIVITY, NULL); | ||
| 171 | - | ||
| 172 | - // Set local filename | ||
| 173 | - v3270_ft_activity_set_local_filename(activity,filename); | 82 | +static void dispose(GObject *object) |
| 83 | +{ | ||
| 84 | + debug("activity::%s(%p)",__FUNCTION__,object); | ||
| 85 | + | ||
| 86 | + V3270FTActivity * activity = G_V3270_FT_ACTIVITY(object); | ||
| 87 | + | ||
| 88 | + g_free(activity->file.local); | ||
| 89 | + g_free(activity->file.remote); | ||
| 90 | + | ||
| 91 | + G_OBJECT_CLASS(V3270FTActivity_parent_class)->dispose(object); | ||
| 92 | + | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) | ||
| 96 | +{ | ||
| 97 | + switch(prop_id) | ||
| 98 | + { | ||
| 99 | + case PROP_LOCAL: | ||
| 100 | + v3270_ft_activity_set_local_filename(object,g_value_get_string(value)); | ||
| 101 | + break; | ||
| 102 | + | ||
| 103 | + case PROP_REMOTE: | ||
| 104 | + v3270_ft_activity_set_remote_filename(object,g_value_get_string(value)); | ||
| 105 | + break; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) | ||
| 111 | +{ | ||
| 112 | + switch(prop_id) | ||
| 113 | + { | ||
| 114 | + case PROP_LOCAL: | ||
| 115 | + g_value_set_string(value,v3270_ft_activity_get_local_filename(object)); | ||
| 116 | + break; | ||
| 117 | + | ||
| 118 | + case PROP_REMOTE: | ||
| 119 | + g_value_set_string(value,v3270_ft_activity_get_remote_filename(object)); | ||
| 120 | + break; | ||
| 121 | + } | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +static void V3270FTActivity_class_init(V3270FTActivityClass *klass) | ||
| 125 | +{ | ||
| 126 | + G_OBJECT_CLASS(klass)->dispose = dispose; | ||
| 127 | + | ||
| 128 | + G_OBJECT_CLASS(klass)->set_property = set_property; | ||
| 129 | + G_OBJECT_CLASS(klass)->get_property = get_property; | ||
| 130 | + | ||
| 131 | + g_object_class_install_property( | ||
| 132 | + G_OBJECT_CLASS(klass), | ||
| 133 | + PROP_LOCAL, | ||
| 134 | + g_param_spec_string ("local", "Local", | ||
| 135 | + _( "Full path of local file" ), | ||
| 136 | + FALSE, G_PARAM_READWRITE)); | ||
| 137 | + | ||
| 138 | + g_object_class_install_property( | ||
| 139 | + G_OBJECT_CLASS(klass), | ||
| 140 | + PROP_LOCAL, | ||
| 141 | + g_param_spec_string ("remote", "remote", | ||
| 142 | + _( "Full path of remote file" ), | ||
| 143 | + FALSE, G_PARAM_READWRITE)); | ||
| 144 | + | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +static void V3270FTActivity_init(V3270FTActivity *widget) | ||
| 148 | +{ | ||
| 149 | + widget->values[LIB3270_FT_VALUE_LRECL] = 0; | ||
| 150 | + widget->values[LIB3270_FT_VALUE_BLKSIZE] = 0; | ||
| 151 | + widget->values[LIB3270_FT_VALUE_PRIMSPACE] = 0; | ||
| 152 | + widget->values[LIB3270_FT_VALUE_SECSPACE] = 0; | ||
| 153 | + widget->values[LIB3270_FT_VALUE_DFT] = 4096; | ||
| 154 | +} | ||
| 174 | 155 | ||
| 175 | - // Set options | ||
| 176 | - LIB3270_FT_OPTION options = LIB3270_FT_OPTION_SEND; | ||
| 177 | - size_t ix; | ||
| 178 | - | ||
| 179 | - for(ix = 0; v3270_text_file_extensions[ix]; ix++) | ||
| 180 | - { | ||
| 181 | - if(g_str_has_suffix(filename,v3270_text_file_extensions[ix])) | ||
| 182 | - { | ||
| 183 | - options |= (LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP); | ||
| 184 | - break; | ||
| 185 | - } | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - v3270_ft_activity_set_options(activity,options); | ||
| 189 | - | ||
| 190 | - // Set remote filename | ||
| 191 | - g_autofree gchar * basename = g_path_get_basename(filename); | ||
| 192 | - v3270_ft_activity_set_remote_filename(activity,basename); | 156 | +/** |
| 157 | +* v3270_ft_activity_new: | ||
| 158 | +* | ||
| 159 | +* Creates an empty file transfer activity. | ||
| 160 | +* | ||
| 161 | +* Returns: a new #V3270FTActivity. | ||
| 162 | +*/ | ||
| 163 | +LIB3270_EXPORT GObject * v3270_ft_activity_new() | ||
| 164 | +{ | ||
| 165 | + return g_object_new(G_TYPE_V3270_FT_ACTIVITY, NULL); | ||
| 166 | +} | ||
| 167 | + | ||
| 168 | +LIB3270_EXPORT GObject * v3270_ft_activity_new_from_filename(const gchar *filename) | ||
| 169 | +{ | ||
| 170 | + GObject *activity = g_object_new(G_TYPE_V3270_FT_ACTIVITY, NULL); | ||
| 171 | + | ||
| 172 | + // Set local filename | ||
| 173 | + v3270_ft_activity_set_local_filename(activity,filename); | ||
| 174 | + | ||
| 175 | + // Set options | ||
| 176 | + LIB3270_FT_OPTION options = LIB3270_FT_OPTION_SEND; | ||
| 177 | + size_t ix; | ||
| 178 | + | ||
| 179 | + for(ix = 0; v3270_text_file_extensions[ix]; ix++) | ||
| 180 | + { | ||
| 181 | + if(g_str_has_suffix(filename,v3270_text_file_extensions[ix])) | ||
| 182 | + { | ||
| 183 | + options |= (LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP); | ||
| 184 | + break; | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + v3270_ft_activity_set_options(activity,options); | ||
| 189 | + | ||
| 190 | + // Set remote filename | ||
| 191 | + g_autofree gchar * basename = g_path_get_basename(filename); | ||
| 192 | + v3270_ft_activity_set_remote_filename(activity,basename); | ||
| 193 | + | ||
| 194 | + return activity; | ||
| 195 | +} | ||
| 193 | 196 | ||
| 194 | - return activity; | ||
| 195 | - } | ||
| 196 | 197 | ||
| 198 | +/** | ||
| 199 | +* v3270_ft_activity_get_local_filename: | ||
| 200 | +* @object: a #V3270FTActivity | ||
| 201 | +* | ||
| 202 | +* Get the full path of the local file. | ||
| 203 | +* | ||
| 204 | +* Returns: the local file path. | ||
| 205 | +*/ | ||
| 206 | +LIB3270_EXPORT const gchar * v3270_ft_activity_get_local_filename(const GObject *object) | ||
| 207 | +{ | ||
| 208 | + const gchar *ptr = G_V3270_FT_ACTIVITY(object)->file.local; | ||
| 209 | + return (ptr ? ptr : ""); | ||
| 210 | +} | ||
| 197 | 211 | ||
| 198 | - /** | ||
| 199 | - * v3270_ft_activity_get_local_filename: | ||
| 200 | - * @object: a #V3270FTActivity | ||
| 201 | - * | ||
| 202 | - * Get the full path of the local file. | ||
| 203 | - * | ||
| 204 | - * Returns: the local file path. | ||
| 205 | - */ | ||
| 206 | - LIB3270_EXPORT const gchar * v3270_ft_activity_get_local_filename(const GObject *object) | ||
| 207 | - { | ||
| 208 | - const gchar *ptr = G_V3270_FT_ACTIVITY(object)->file.local; | ||
| 209 | - return (ptr ? ptr : ""); | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - /** | ||
| 213 | - * v3270_ft_activity_get_remote_filename: | ||
| 214 | - * @object: a #V3270FTActivity | ||
| 215 | - * | ||
| 216 | - * Get the host file name. | ||
| 217 | - * | ||
| 218 | - * Returns: the host file name. | ||
| 219 | - */ | ||
| 220 | - LIB3270_EXPORT const gchar * v3270_ft_activity_get_remote_filename(const GObject *object) | ||
| 221 | - { | ||
| 222 | - const gchar *ptr = G_V3270_FT_ACTIVITY(object)->file.remote; | ||
| 223 | - return(ptr ? ptr : ""); | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - LIB3270_EXPORT void v3270_ft_activity_set_local_filename(GObject *object, const gchar *filename) | ||
| 227 | - { | ||
| 228 | - gchar **ptr = & G_V3270_FT_ACTIVITY(object)->file.local; | ||
| 229 | - | ||
| 230 | - g_free(*ptr); | ||
| 231 | - *ptr = g_strdup(filename); | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - LIB3270_EXPORT void v3270_ft_activity_set_remote_filename(GObject *object, const gchar *filename) | ||
| 235 | - { | ||
| 236 | - gchar **ptr = & G_V3270_FT_ACTIVITY(object)->file.remote; | ||
| 237 | - | ||
| 238 | - g_free(*ptr); | ||
| 239 | - *ptr = g_strdup(filename); | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - LIB3270_EXPORT void v3270_ft_activity_set_options(GObject * object, LIB3270_FT_OPTION options) | ||
| 243 | - { | ||
| 244 | - G_V3270_FT_ACTIVITY(object)->options = options; | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | - LIB3270_EXPORT LIB3270_FT_OPTION v3270_ft_activity_get_options(const GObject *object) | ||
| 248 | - { | ||
| 249 | - return G_V3270_FT_ACTIVITY(object)->options; | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - guint v3270_ft_activity_get_value(const GObject * object, LIB3270_FT_VALUE id) | ||
| 253 | - { | ||
| 254 | - return G_V3270_FT_ACTIVITY(object)->values[id]; | ||
| 255 | - } | ||
| 256 | - | ||
| 257 | - void v3270_ft_activity_set_value(GObject * object, LIB3270_FT_VALUE id, guint value) | ||
| 258 | - { | ||
| 259 | - G_V3270_FT_ACTIVITY(object)->values[id] = value; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - static void element_start(GMarkupParseContext G_GNUC_UNUSED(*context), const gchar *element_name, const gchar **names,const gchar **values, V3270FTActivity *activity, GError **error) | ||
| 263 | - { | ||
| 264 | - size_t ix; | ||
| 265 | - | ||
| 266 | - debug("%s(%s)",__FUNCTION__, element_name); | ||
| 267 | - if(!g_ascii_strcasecmp(element_name,"file")) | ||
| 268 | - { | ||
| 269 | - const gchar *type; | ||
| 270 | - const gchar *path; | ||
| 271 | - | ||
| 272 | - if(!g_markup_collect_attributes( | ||
| 273 | - element_name,names,values,error, | ||
| 274 | - G_MARKUP_COLLECT_STRING, "type", &type, | ||
| 275 | - G_MARKUP_COLLECT_STRING, "path", &path, | ||
| 276 | - G_MARKUP_COLLECT_INVALID | ||
| 277 | - )) { | ||
| 278 | - | ||
| 279 | - return; | ||
| 280 | - | ||
| 281 | - } | ||
| 282 | - | ||
| 283 | - if(g_ascii_strcasecmp(type,"local") == 0) | ||
| 284 | - v3270_ft_activity_set_local_filename(G_OBJECT(activity),path); | ||
| 285 | - else if(g_ascii_strcasecmp(type,"remote") == 0) | ||
| 286 | - v3270_ft_activity_set_remote_filename(G_OBJECT(activity),path); | ||
| 287 | - | ||
| 288 | - } | ||
| 289 | - else if(!g_ascii_strcasecmp(element_name,"option")) | ||
| 290 | - { | ||
| 291 | - const gchar *name; | ||
| 292 | - const gchar *value; | ||
| 293 | - | ||
| 294 | - if(!g_markup_collect_attributes( | ||
| 295 | - element_name,names,values,error, | ||
| 296 | - G_MARKUP_COLLECT_STRING, "name", &name, | ||
| 297 | - G_MARKUP_COLLECT_STRING, "value", &value, | ||
| 298 | - G_MARKUP_COLLECT_INVALID | ||
| 299 | - )) { | ||
| 300 | - | ||
| 301 | - return; | ||
| 302 | - | ||
| 303 | - } | ||
| 304 | - | ||
| 305 | - debug("%s.%s(%s,%s)",__FUNCTION__, element_name, name, value); | ||
| 306 | - | ||
| 307 | - for(ix = 0; v3270_activity_list_options[ix].name; ix++) | ||
| 308 | - { | ||
| 309 | - if(! (g_ascii_strcasecmp(name,v3270_activity_list_options[ix].name) || g_ascii_strcasecmp(value,v3270_activity_list_options[ix].value)) ) | ||
| 310 | - { | ||
| 311 | - activity->options |= v3270_activity_list_options[ix].option; | ||
| 312 | - debug("Setting option %s.%s(%08lx) =%08lx", v3270_activity_list_options[ix].name, v3270_activity_list_options[ix].value, (unsigned int) v3270_activity_list_options[ix].option,(unsigned int) activity->options) | ||
| 313 | - break; | ||
| 314 | - } | ||
| 315 | - } | ||
| 316 | - | ||
| 317 | - } | ||
| 318 | - else if(!g_ascii_strcasecmp(element_name,"parameter")) | ||
| 319 | - { | ||
| 320 | - const gchar *name; | ||
| 321 | - const gchar *value; | ||
| 322 | - | ||
| 323 | - if(!g_markup_collect_attributes( | ||
| 324 | - element_name,names,values,error, | ||
| 325 | - G_MARKUP_COLLECT_STRING, "name", &name, | ||
| 326 | - G_MARKUP_COLLECT_STRING, "value", &value, | ||
| 327 | - G_MARKUP_COLLECT_INVALID | ||
| 328 | - )) { | ||
| 329 | - | ||
| 330 | - return; | ||
| 331 | - | ||
| 332 | - } | ||
| 333 | - | ||
| 334 | - debug("%s.%s(%s)",__FUNCTION__, element_name, name, value); | ||
| 335 | - | ||
| 336 | - for(ix=0;ix<LIB3270_FT_VALUE_COUNT;ix++) | ||
| 337 | - { | ||
| 338 | - if(!g_ascii_strcasecmp(ft_value[ix].name,name)) | ||
| 339 | - { | ||
| 340 | - activity->values[ix] = atoi(value); | ||
| 341 | - break; | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | - | ||
| 345 | - } | ||
| 346 | - | ||
| 347 | - } | ||
| 348 | - | ||
| 349 | - void v3270_ft_activity_set_from_context(GObject * activity, GMarkupParseContext * context) | ||
| 350 | - { | ||
| 351 | - static const GMarkupParser parser = { | ||
| 352 | - (void (*)(GMarkupParseContext *, const gchar *, const gchar **, const gchar **, gpointer, GError **)) element_start, | ||
| 353 | - (void (*)(GMarkupParseContext *, const gchar *, gpointer, GError **)) NULL, | ||
| 354 | - (void (*)(GMarkupParseContext *, const gchar *, gsize, gpointer, GError **)) NULL, | ||
| 355 | - (void (*)(GMarkupParseContext *, const gchar *, gsize, gpointer, GError **)) NULL, | ||
| 356 | - (void (*)(GMarkupParseContext *, GError *, gpointer)) NULL | ||
| 357 | - }; | ||
| 358 | - | ||
| 359 | - G_V3270_FT_ACTIVITY(activity)->options = 0; | ||
| 360 | - | ||
| 361 | - g_markup_parse_context_push(context,&parser,activity); | ||
| 362 | - | ||
| 363 | - } | ||
| 364 | - | ||
| 365 | - LIB3270_EXPORT H3270FT * v3270_ft_activity_begin_transfer(GObject * object, H3270 *hSession, const char **message) | ||
| 366 | - { | ||
| 367 | - V3270FTActivity * activity = G_V3270_FT_ACTIVITY(object); | ||
| 368 | - | ||
| 369 | - return lib3270_ft_new( | ||
| 370 | - hSession, | ||
| 371 | - activity->options, | ||
| 372 | - activity->file.local, | ||
| 373 | - activity->file.remote, | ||
| 374 | - activity->values[LIB3270_FT_VALUE_LRECL], | ||
| 375 | - activity->values[LIB3270_FT_VALUE_BLKSIZE], | ||
| 376 | - activity->values[LIB3270_FT_VALUE_PRIMSPACE], | ||
| 377 | - activity->values[LIB3270_FT_VALUE_SECSPACE], | ||
| 378 | - activity->values[LIB3270_FT_VALUE_DFT], | ||
| 379 | - message | ||
| 380 | - ); | ||
| 381 | - | ||
| 382 | - } | ||
| 383 | - | ||
| 384 | - LIB3270_EXPORT void v3270_ft_activity_xml_encode(GObject *object, GString *str) | ||
| 385 | - { | ||
| 386 | - g_return_if_fail(G_IS_V3270_FT_ACTIVITY(object)); | ||
| 387 | - | ||
| 388 | - size_t ix; | ||
| 389 | - V3270FTActivity * activity = G_V3270_FT_ACTIVITY(object); | ||
| 390 | - | ||
| 391 | - g_string_append_printf( | ||
| 392 | - str, | ||
| 393 | - "\t<entry>\n\t\t<file type=\'local\' path=\'%s\' />\n\t\t<file type=\'remote\' path=\'%s\' />\n", | ||
| 394 | - activity->file.local, | ||
| 395 | - activity->file.remote | ||
| 396 | - ); | ||
| 397 | - | ||
| 398 | - for(ix = 0; v3270_activity_list_options[ix].name; ix++) | ||
| 399 | - { | ||
| 400 | - if((activity->options & v3270_activity_list_options[ix].option) == v3270_activity_list_options[ix].option) | ||
| 401 | - g_string_append_printf(str,"\t\t<option name=\'%s\' value=\'%s\' />\n",v3270_activity_list_options[ix].name,v3270_activity_list_options[ix].value); | ||
| 402 | - } | ||
| 403 | - | ||
| 404 | - for(ix=0;ix<LIB3270_FT_VALUE_COUNT;ix++) | ||
| 405 | - { | ||
| 406 | - g_string_append_printf(str,"\t\t<parameter name=\"%s\" value=\"%u\"/>\n",ft_value[ix].name,activity->values[ix]); | ||
| 407 | - } | ||
| 408 | - | ||
| 409 | - g_string_append(str,"\t</entry>\n"); | ||
| 410 | - | ||
| 411 | - } | 212 | +/** |
| 213 | +* v3270_ft_activity_get_remote_filename: | ||
| 214 | +* @object: a #V3270FTActivity | ||
| 215 | +* | ||
| 216 | +* Get the host file name. | ||
| 217 | +* | ||
| 218 | +* Returns: the host file name. | ||
| 219 | +*/ | ||
| 220 | +LIB3270_EXPORT const gchar * v3270_ft_activity_get_remote_filename(const GObject *object) | ||
| 221 | +{ | ||
| 222 | + const gchar *ptr = G_V3270_FT_ACTIVITY(object)->file.remote; | ||
| 223 | + return(ptr ? ptr : ""); | ||
| 224 | +} | ||
| 225 | + | ||
| 226 | +LIB3270_EXPORT void v3270_ft_activity_set_local_filename(GObject *object, const gchar *filename) | ||
| 227 | +{ | ||
| 228 | + gchar **ptr = & G_V3270_FT_ACTIVITY(object)->file.local; | ||
| 229 | + | ||
| 230 | + g_free(*ptr); | ||
| 231 | + *ptr = g_strdup(filename); | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +LIB3270_EXPORT void v3270_ft_activity_set_remote_filename(GObject *object, const gchar *filename) | ||
| 235 | +{ | ||
| 236 | + gchar **ptr = & G_V3270_FT_ACTIVITY(object)->file.remote; | ||
| 237 | + | ||
| 238 | + g_free(*ptr); | ||
| 239 | + *ptr = g_strdup(filename); | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | +LIB3270_EXPORT void v3270_ft_activity_set_options(GObject * object, LIB3270_FT_OPTION options) | ||
| 243 | +{ | ||
| 244 | + G_V3270_FT_ACTIVITY(object)->options = options; | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +LIB3270_EXPORT LIB3270_FT_OPTION v3270_ft_activity_get_options(const GObject *object) | ||
| 248 | +{ | ||
| 249 | + return G_V3270_FT_ACTIVITY(object)->options; | ||
| 250 | +} | ||
| 251 | + | ||
| 252 | +guint v3270_ft_activity_get_value(const GObject * object, LIB3270_FT_VALUE id) | ||
| 253 | +{ | ||
| 254 | + return G_V3270_FT_ACTIVITY(object)->values[id]; | ||
| 255 | +} | ||
| 256 | + | ||
| 257 | +void v3270_ft_activity_set_value(GObject * object, LIB3270_FT_VALUE id, guint value) | ||
| 258 | +{ | ||
| 259 | + G_V3270_FT_ACTIVITY(object)->values[id] = value; | ||
| 260 | +} | ||
| 261 | + | ||
| 262 | +static void element_start(GMarkupParseContext G_GNUC_UNUSED(*context), const gchar *element_name, const gchar **names,const gchar **values, V3270FTActivity *activity, GError **error) | ||
| 263 | +{ | ||
| 264 | + size_t ix; | ||
| 265 | + | ||
| 266 | + debug("%s(%s)",__FUNCTION__, element_name); | ||
| 267 | + if(!g_ascii_strcasecmp(element_name,"file")) | ||
| 268 | + { | ||
| 269 | + const gchar *type; | ||
| 270 | + const gchar *path; | ||
| 271 | + | ||
| 272 | + if(!g_markup_collect_attributes( | ||
| 273 | + element_name,names,values,error, | ||
| 274 | + G_MARKUP_COLLECT_STRING, "type", &type, | ||
| 275 | + G_MARKUP_COLLECT_STRING, "path", &path, | ||
| 276 | + G_MARKUP_COLLECT_INVALID | ||
| 277 | + )) { | ||
| 278 | + | ||
| 279 | + return; | ||
| 280 | + | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + if(g_ascii_strcasecmp(type,"local") == 0) | ||
| 284 | + v3270_ft_activity_set_local_filename(G_OBJECT(activity),path); | ||
| 285 | + else if(g_ascii_strcasecmp(type,"remote") == 0) | ||
| 286 | + v3270_ft_activity_set_remote_filename(G_OBJECT(activity),path); | ||
| 287 | + | ||
| 288 | + } | ||
| 289 | + else if(!g_ascii_strcasecmp(element_name,"option")) | ||
| 290 | + { | ||
| 291 | + const gchar *name; | ||
| 292 | + const gchar *value; | ||
| 293 | + | ||
| 294 | + if(!g_markup_collect_attributes( | ||
| 295 | + element_name,names,values,error, | ||
| 296 | + G_MARKUP_COLLECT_STRING, "name", &name, | ||
| 297 | + G_MARKUP_COLLECT_STRING, "value", &value, | ||
| 298 | + G_MARKUP_COLLECT_INVALID | ||
| 299 | + )) { | ||
| 300 | + | ||
| 301 | + return; | ||
| 302 | + | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + debug("%s.%s(%s,%s)",__FUNCTION__, element_name, name, value); | ||
| 306 | + | ||
| 307 | + for(ix = 0; v3270_activity_list_options[ix].name; ix++) | ||
| 308 | + { | ||
| 309 | + if(! (g_ascii_strcasecmp(name,v3270_activity_list_options[ix].name) || g_ascii_strcasecmp(value,v3270_activity_list_options[ix].value)) ) | ||
| 310 | + { | ||
| 311 | + activity->options |= v3270_activity_list_options[ix].option; | ||
| 312 | + debug("Setting option %s.%s(%08lx) =%08lx", v3270_activity_list_options[ix].name, v3270_activity_list_options[ix].value, (unsigned int) v3270_activity_list_options[ix].option,(unsigned int) activity->options) | ||
| 313 | + break; | ||
| 314 | + } | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + } | ||
| 318 | + else if(!g_ascii_strcasecmp(element_name,"parameter")) | ||
| 319 | + { | ||
| 320 | + const gchar *name; | ||
| 321 | + const gchar *value; | ||
| 322 | + | ||
| 323 | + if(!g_markup_collect_attributes( | ||
| 324 | + element_name,names,values,error, | ||
| 325 | + G_MARKUP_COLLECT_STRING, "name", &name, | ||
| 326 | + G_MARKUP_COLLECT_STRING, "value", &value, | ||
| 327 | + G_MARKUP_COLLECT_INVALID | ||
| 328 | + )) { | ||
| 329 | + | ||
| 330 | + return; | ||
| 331 | + | ||
| 332 | + } | ||
| 333 | + | ||
| 334 | + debug("%s.%s(%s)",__FUNCTION__, element_name, name, value); | ||
| 335 | + | ||
| 336 | + for(ix=0; ix<LIB3270_FT_VALUE_COUNT; ix++) | ||
| 337 | + { | ||
| 338 | + if(!g_ascii_strcasecmp(ft_value[ix].name,name)) | ||
| 339 | + { | ||
| 340 | + activity->values[ix] = atoi(value); | ||
| 341 | + break; | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | +} | ||
| 348 | + | ||
| 349 | +void v3270_ft_activity_set_from_context(GObject * activity, GMarkupParseContext * context) | ||
| 350 | +{ | ||
| 351 | + static const GMarkupParser parser = { | ||
| 352 | + (void (*)(GMarkupParseContext *, const gchar *, const gchar **, const gchar **, gpointer, GError **)) element_start, | ||
| 353 | + (void (*)(GMarkupParseContext *, const gchar *, gpointer, GError **)) NULL, | ||
| 354 | + (void (*)(GMarkupParseContext *, const gchar *, gsize, gpointer, GError **)) NULL, | ||
| 355 | + (void (*)(GMarkupParseContext *, const gchar *, gsize, gpointer, GError **)) NULL, | ||
| 356 | + (void (*)(GMarkupParseContext *, GError *, gpointer)) NULL | ||
| 357 | + }; | ||
| 358 | + | ||
| 359 | + G_V3270_FT_ACTIVITY(activity)->options = 0; | ||
| 360 | + | ||
| 361 | + g_markup_parse_context_push(context,&parser,activity); | ||
| 362 | + | ||
| 363 | +} | ||
| 364 | + | ||
| 365 | +LIB3270_EXPORT H3270FT * v3270_ft_activity_begin_transfer(GObject * object, H3270 *hSession, const char **message) | ||
| 366 | +{ | ||
| 367 | + V3270FTActivity * activity = G_V3270_FT_ACTIVITY(object); | ||
| 368 | + | ||
| 369 | + return lib3270_ft_new( | ||
| 370 | + hSession, | ||
| 371 | + activity->options, | ||
| 372 | + activity->file.local, | ||
| 373 | + activity->file.remote, | ||
| 374 | + activity->values[LIB3270_FT_VALUE_LRECL], | ||
| 375 | + activity->values[LIB3270_FT_VALUE_BLKSIZE], | ||
| 376 | + activity->values[LIB3270_FT_VALUE_PRIMSPACE], | ||
| 377 | + activity->values[LIB3270_FT_VALUE_SECSPACE], | ||
| 378 | + activity->values[LIB3270_FT_VALUE_DFT], | ||
| 379 | + message | ||
| 380 | + ); | ||
| 381 | + | ||
| 382 | +} | ||
| 383 | + | ||
| 384 | +LIB3270_EXPORT void v3270_ft_activity_xml_encode(GObject *object, GString *str) | ||
| 385 | +{ | ||
| 386 | + g_return_if_fail(G_IS_V3270_FT_ACTIVITY(object)); | ||
| 387 | + | ||
| 388 | + size_t ix; | ||
| 389 | + V3270FTActivity * activity = G_V3270_FT_ACTIVITY(object); | ||
| 390 | + | ||
| 391 | + g_string_append_printf( | ||
| 392 | + str, | ||
| 393 | + "\t<entry>\n\t\t<file type=\'local\' path=\'%s\' />\n\t\t<file type=\'remote\' path=\'%s\' />\n", | ||
| 394 | + activity->file.local, | ||
| 395 | + activity->file.remote | ||
| 396 | + ); | ||
| 397 | + | ||
| 398 | + for(ix = 0; v3270_activity_list_options[ix].name; ix++) | ||
| 399 | + { | ||
| 400 | + if((activity->options & v3270_activity_list_options[ix].option) == v3270_activity_list_options[ix].option) | ||
| 401 | + g_string_append_printf(str,"\t\t<option name=\'%s\' value=\'%s\' />\n",v3270_activity_list_options[ix].name,v3270_activity_list_options[ix].value); | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + for(ix=0; ix<LIB3270_FT_VALUE_COUNT; ix++) | ||
| 405 | + { | ||
| 406 | + g_string_append_printf(str,"\t\t<parameter name=\"%s\" value=\"%u\"/>\n",ft_value[ix].name,activity->values[ix]); | ||
| 407 | + } | ||
| 408 | + | ||
| 409 | + g_string_append(str,"\t</entry>\n"); | ||
| 410 | + | ||
| 411 | +} | ||
| 412 | 412 |
src/filetransfer/tables.c
| @@ -28,207 +28,206 @@ | @@ -28,207 +28,206 @@ | ||
| 28 | * | 28 | * |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | - #include <limits.h> | ||
| 32 | - #include "private.h" | 31 | +#include <limits.h> |
| 32 | +#include "private.h" | ||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 35 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 36 | 36 | ||
| 37 | const struct v3270ft_option ft_option[NUM_OPTIONS_WIDGETS] = { | 37 | const struct v3270ft_option ft_option[NUM_OPTIONS_WIDGETS] = { |
| 38 | 38 | ||
| 39 | - // Transfer options | ||
| 40 | - { | ||
| 41 | - LIB3270_FT_OPTION_ASCII, | ||
| 42 | - "ascii", | ||
| 43 | - N_("_Text file"), | ||
| 44 | - N_( "Check this if the file consists of character data only.") | ||
| 45 | - }, | ||
| 46 | - { | ||
| 47 | - LIB3270_FT_OPTION_CRLF, | ||
| 48 | - "crlf", | ||
| 49 | - N_("_ASCII text"), | 39 | + // Transfer options |
| 40 | + { | ||
| 41 | + LIB3270_FT_OPTION_ASCII, | ||
| 42 | + "ascii", | ||
| 43 | + N_("_Text file"), | ||
| 44 | + N_( "Check this if the file consists of character data only.") | ||
| 45 | + }, | ||
| 46 | + { | ||
| 47 | + LIB3270_FT_OPTION_CRLF, | ||
| 48 | + "crlf", | ||
| 49 | + N_("_ASCII text"), | ||
| 50 | #ifdef _WIN32 | 50 | #ifdef _WIN32 |
| 51 | - N_( "Following the convention for ASCII text files, CR/LF pairs are used to terminate records in the PC file, and a CTRL-Z (x'1A') marks the end of file.") | 51 | + N_( "Following the convention for ASCII text files, CR/LF pairs are used to terminate records in the PC file, and a CTRL-Z (x'1A') marks the end of file.") |
| 52 | #else | 52 | #else |
| 53 | - N_( "Following the convention for ASCII text files, LF is used to terminate records in the PC file.") | 53 | + N_( "Following the convention for ASCII text files, LF is used to terminate records in the PC file.") |
| 54 | #endif // _WIN32 | 54 | #endif // _WIN32 |
| 55 | 55 | ||
| 56 | - }, | ||
| 57 | - { | ||
| 58 | - LIB3270_FT_OPTION_APPEND, | ||
| 59 | - "append", | ||
| 60 | - N_("A_ppend to file"), | ||
| 61 | - N_( "Appends the source file to the destination file.") | ||
| 62 | - }, | ||
| 63 | - { | ||
| 64 | - LIB3270_FT_OPTION_REMAP, | ||
| 65 | - "remap", | ||
| 66 | - N_("Re_map ASCII Characters."), | ||
| 67 | - N_("Remap the text to ensure maximum compatibility between the workstation's character set and encoding and the host's EBCDIC code page.") | ||
| 68 | - }, | ||
| 69 | - | ||
| 70 | - // Record format | ||
| 71 | - { | ||
| 72 | - LIB3270_FT_RECORD_FORMAT_DEFAULT, | ||
| 73 | - "recfm.default", | ||
| 74 | - N_("Default"), | ||
| 75 | - N_("Use host default record format.") | ||
| 76 | - }, | ||
| 77 | - { | ||
| 78 | - LIB3270_FT_RECORD_FORMAT_FIXED, | ||
| 79 | - "recfm.fixed", | ||
| 80 | - N_("Fixed"), | ||
| 81 | - N_("Creates a file with fixed-length records.") | ||
| 82 | - }, | ||
| 83 | - { | ||
| 84 | - LIB3270_FT_RECORD_FORMAT_VARIABLE, | ||
| 85 | - "recfm.variable", | ||
| 86 | - N_("Variable"), | ||
| 87 | - N_("Creates a file with variable-length records.") | ||
| 88 | - }, | ||
| 89 | - { | ||
| 90 | - LIB3270_FT_RECORD_FORMAT_UNDEFINED, | ||
| 91 | - "recfm.undefined", | ||
| 92 | - N_("Undefined"), | ||
| 93 | - N_("Creates a file with undefined-length records (TSO hosts only).") | ||
| 94 | - }, | ||
| 95 | - | ||
| 96 | - // Space allocation units | ||
| 97 | - { | ||
| 98 | - LIB3270_FT_ALLOCATION_UNITS_DEFAULT, | ||
| 99 | - "units.default", | ||
| 100 | - N_("Default"), | ||
| 101 | - NULL | ||
| 102 | - }, | ||
| 103 | - { | ||
| 104 | - LIB3270_FT_ALLOCATION_UNITS_TRACKS, | ||
| 105 | - "units.tracks", | ||
| 106 | - N_("Tracks"), | ||
| 107 | - NULL | ||
| 108 | - }, | ||
| 109 | - { | ||
| 110 | - LIB3270_FT_ALLOCATION_UNITS_CYLINDERS, | ||
| 111 | - "units.cylinders", | ||
| 112 | - N_("Cylinders"), | ||
| 113 | - NULL | ||
| 114 | - }, | ||
| 115 | - { | ||
| 116 | - LIB3270_FT_ALLOCATION_UNITS_AVBLOCK, | ||
| 117 | - "units.avblock", | ||
| 118 | - N_("Avblock"), | ||
| 119 | - NULL | ||
| 120 | - }, | 56 | + }, |
| 57 | + { | ||
| 58 | + LIB3270_FT_OPTION_APPEND, | ||
| 59 | + "append", | ||
| 60 | + N_("A_ppend to file"), | ||
| 61 | + N_( "Appends the source file to the destination file.") | ||
| 62 | + }, | ||
| 63 | + { | ||
| 64 | + LIB3270_FT_OPTION_REMAP, | ||
| 65 | + "remap", | ||
| 66 | + N_("Re_map ASCII Characters."), | ||
| 67 | + N_("Remap the text to ensure maximum compatibility between the workstation's character set and encoding and the host's EBCDIC code page.") | ||
| 68 | + }, | ||
| 69 | + | ||
| 70 | + // Record format | ||
| 71 | + { | ||
| 72 | + LIB3270_FT_RECORD_FORMAT_DEFAULT, | ||
| 73 | + "recfm.default", | ||
| 74 | + N_("Default"), | ||
| 75 | + N_("Use host default record format.") | ||
| 76 | + }, | ||
| 77 | + { | ||
| 78 | + LIB3270_FT_RECORD_FORMAT_FIXED, | ||
| 79 | + "recfm.fixed", | ||
| 80 | + N_("Fixed"), | ||
| 81 | + N_("Creates a file with fixed-length records.") | ||
| 82 | + }, | ||
| 83 | + { | ||
| 84 | + LIB3270_FT_RECORD_FORMAT_VARIABLE, | ||
| 85 | + "recfm.variable", | ||
| 86 | + N_("Variable"), | ||
| 87 | + N_("Creates a file with variable-length records.") | ||
| 88 | + }, | ||
| 89 | + { | ||
| 90 | + LIB3270_FT_RECORD_FORMAT_UNDEFINED, | ||
| 91 | + "recfm.undefined", | ||
| 92 | + N_("Undefined"), | ||
| 93 | + N_("Creates a file with undefined-length records (TSO hosts only).") | ||
| 94 | + }, | ||
| 95 | + | ||
| 96 | + // Space allocation units | ||
| 97 | + { | ||
| 98 | + LIB3270_FT_ALLOCATION_UNITS_DEFAULT, | ||
| 99 | + "units.default", | ||
| 100 | + N_("Default"), | ||
| 101 | + NULL | ||
| 102 | + }, | ||
| 103 | + { | ||
| 104 | + LIB3270_FT_ALLOCATION_UNITS_TRACKS, | ||
| 105 | + "units.tracks", | ||
| 106 | + N_("Tracks"), | ||
| 107 | + NULL | ||
| 108 | + }, | ||
| 109 | + { | ||
| 110 | + LIB3270_FT_ALLOCATION_UNITS_CYLINDERS, | ||
| 111 | + "units.cylinders", | ||
| 112 | + N_("Cylinders"), | ||
| 113 | + NULL | ||
| 114 | + }, | ||
| 115 | + { | ||
| 116 | + LIB3270_FT_ALLOCATION_UNITS_AVBLOCK, | ||
| 117 | + "units.avblock", | ||
| 118 | + N_("Avblock"), | ||
| 119 | + NULL | ||
| 120 | + }, | ||
| 121 | 121 | ||
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | const struct v3270ft_type ft_type[] = { | 124 | const struct v3270ft_type ft_type[] = { |
| 125 | 125 | ||
| 126 | - { | ||
| 127 | - LIB3270_FT_OPTION_SEND, | ||
| 128 | - "send", | ||
| 129 | - "binary", | ||
| 130 | - N_("Send file") | ||
| 131 | - }, | ||
| 132 | - { | ||
| 133 | - LIB3270_FT_OPTION_RECEIVE, | ||
| 134 | - "receive", | ||
| 135 | - "binary", | ||
| 136 | - N_("Receive file") | ||
| 137 | - }, | ||
| 138 | - { | ||
| 139 | - LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP, | ||
| 140 | - "send", | ||
| 141 | - "text", | ||
| 142 | - N_("Send text file") | ||
| 143 | - }, | ||
| 144 | - { | ||
| 145 | - LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP, | ||
| 146 | - "receive", | ||
| 147 | - "text", | ||
| 148 | - N_("Receive text file") | ||
| 149 | - } | 126 | + { |
| 127 | + LIB3270_FT_OPTION_SEND, | ||
| 128 | + "send", | ||
| 129 | + "binary", | ||
| 130 | + N_("Send file") | ||
| 131 | + }, | ||
| 132 | + { | ||
| 133 | + LIB3270_FT_OPTION_RECEIVE, | ||
| 134 | + "receive", | ||
| 135 | + "binary", | ||
| 136 | + N_("Receive file") | ||
| 137 | + }, | ||
| 138 | + { | ||
| 139 | + LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP, | ||
| 140 | + "send", | ||
| 141 | + "text", | ||
| 142 | + N_("Send text file") | ||
| 143 | + }, | ||
| 144 | + { | ||
| 145 | + LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP, | ||
| 146 | + "receive", | ||
| 147 | + "text", | ||
| 148 | + N_("Receive text file") | ||
| 149 | + } | ||
| 150 | }; | 150 | }; |
| 151 | 151 | ||
| 152 | const struct v3270ft_value ft_value[] = { | 152 | const struct v3270ft_value ft_value[] = { |
| 153 | - { | ||
| 154 | - // LIB3270_FT_VALUE_LRECL | ||
| 155 | - "lrecl", | ||
| 156 | - 0, 32760, | ||
| 157 | - N_( "Record Length" ), | ||
| 158 | - N_( "Specifies the logical record length (n) for a data set consisting of fixed length records or the maximum logical record length for a data set consisting of variable length records." ) | ||
| 159 | - }, | ||
| 160 | - | ||
| 161 | - | ||
| 162 | - { | ||
| 163 | - // LIB3270_FT_VALUE_BLKSIZE | ||
| 164 | - "blksize", | ||
| 165 | - 0,32760, | ||
| 166 | - N_( "Block size" ), | ||
| 167 | - N_( "Specifies the block size (n) for a new data set. For data sets containing fixed " \ | ||
| 168 | - "length records, the block size must be a multiple of the record length. " \ | ||
| 169 | - "For data sets containing variable length records, the block size must be " \ | ||
| 170 | - "greater than or equal to the record length plus four bytes. The block size " \ | ||
| 171 | - "must not exceed the track length of the device on which the data set resides." ) | ||
| 172 | - }, | ||
| 173 | - | ||
| 174 | - { | ||
| 175 | - // LIB3270_FT_VALUE_PRIMSPACE | ||
| 176 | - "primary", | ||
| 177 | - 0,99999, | ||
| 178 | - N_( "Primary space" ), | ||
| 179 | - N_( "Primary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) | ||
| 180 | - }, | ||
| 181 | - | ||
| 182 | - { | ||
| 183 | - // LIB3270_FT_VALUE_SECSPACE | ||
| 184 | - "secondary", | ||
| 185 | - 0,99999, | ||
| 186 | - N_( "Secondary space" ), | ||
| 187 | - N_( "Secondary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) | ||
| 188 | - }, | ||
| 189 | - | ||
| 190 | - { | ||
| 191 | - // LIB3270_FT_VALUE_DFT | ||
| 192 | - "dft", | ||
| 193 | - 0,99999, | ||
| 194 | - N_( "DFT B_uffer size" ), | ||
| 195 | - N_("Specifies the default buffer size for DFT IND$FILE file transfers.") | ||
| 196 | - }, | 153 | + { |
| 154 | + // LIB3270_FT_VALUE_LRECL | ||
| 155 | + "lrecl", | ||
| 156 | + 0, 32760, | ||
| 157 | + N_( "Record Length" ), | ||
| 158 | + N_( "Specifies the logical record length (n) for a data set consisting of fixed length records or the maximum logical record length for a data set consisting of variable length records." ) | ||
| 159 | + }, | ||
| 160 | + | ||
| 161 | + | ||
| 162 | + { | ||
| 163 | + // LIB3270_FT_VALUE_BLKSIZE | ||
| 164 | + "blksize", | ||
| 165 | + 0,32760, | ||
| 166 | + N_( "Block size" ), | ||
| 167 | + N_( "Specifies the block size (n) for a new data set. For data sets containing fixed " \ | ||
| 168 | + "length records, the block size must be a multiple of the record length. " \ | ||
| 169 | + "For data sets containing variable length records, the block size must be " \ | ||
| 170 | + "greater than or equal to the record length plus four bytes. The block size " \ | ||
| 171 | + "must not exceed the track length of the device on which the data set resides." ) | ||
| 172 | + }, | ||
| 173 | + | ||
| 174 | + { | ||
| 175 | + // LIB3270_FT_VALUE_PRIMSPACE | ||
| 176 | + "primary", | ||
| 177 | + 0,99999, | ||
| 178 | + N_( "Primary space" ), | ||
| 179 | + N_( "Primary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) | ||
| 180 | + }, | ||
| 181 | + | ||
| 182 | + { | ||
| 183 | + // LIB3270_FT_VALUE_SECSPACE | ||
| 184 | + "secondary", | ||
| 185 | + 0,99999, | ||
| 186 | + N_( "Secondary space" ), | ||
| 187 | + N_( "Secondary allocation for a file created on a TSO host.\nThe units are given by the space allocation units option." ) | ||
| 188 | + }, | ||
| 189 | + | ||
| 190 | + { | ||
| 191 | + // LIB3270_FT_VALUE_DFT | ||
| 192 | + "dft", | ||
| 193 | + 0,99999, | ||
| 194 | + N_( "DFT B_uffer size" ), | ||
| 195 | + N_("Specifies the default buffer size for DFT IND$FILE file transfers.") | ||
| 196 | + }, | ||
| 197 | 197 | ||
| 198 | }; | 198 | }; |
| 199 | 199 | ||
| 200 | const struct v3270_activity_list_option v3270_activity_list_options[] = | 200 | const struct v3270_activity_list_option v3270_activity_list_options[] = |
| 201 | { | 201 | { |
| 202 | - { LIB3270_FT_OPTION_RECEIVE, "type", "receive" }, | ||
| 203 | - { LIB3270_FT_OPTION_ASCII, "format", "ascii" }, | ||
| 204 | - { LIB3270_FT_OPTION_CRLF, "format", "crlf" }, | ||
| 205 | - { LIB3270_FT_OPTION_APPEND, "format", "append" }, | ||
| 206 | - { LIB3270_FT_OPTION_REMAP, "format", "remap" }, | ||
| 207 | - { LIB3270_FT_OPTION_UNIX, "file-format", "unix" }, | ||
| 208 | - { LIB3270_FT_RECORD_FORMAT_FIXED, "record-format", "fixed" }, | ||
| 209 | - { LIB3270_FT_RECORD_FORMAT_VARIABLE, "record-format", "variable" }, | ||
| 210 | - { LIB3270_FT_RECORD_FORMAT_UNDEFINED, "record-format", "undefined" }, | ||
| 211 | - { LIB3270_FT_ALLOCATION_UNITS_TRACKS, "units", "tracks" }, | ||
| 212 | - { LIB3270_FT_ALLOCATION_UNITS_CYLINDERS, "units", "cylinders" }, | ||
| 213 | - { LIB3270_FT_ALLOCATION_UNITS_AVBLOCK, "units", "avblock" }, | ||
| 214 | - { 0, NULL, NULL } | 202 | + { LIB3270_FT_OPTION_RECEIVE, "type", "receive" }, |
| 203 | + { LIB3270_FT_OPTION_ASCII, "format", "ascii" }, | ||
| 204 | + { LIB3270_FT_OPTION_CRLF, "format", "crlf" }, | ||
| 205 | + { LIB3270_FT_OPTION_APPEND, "format", "append" }, | ||
| 206 | + { LIB3270_FT_OPTION_REMAP, "format", "remap" }, | ||
| 207 | + { LIB3270_FT_OPTION_UNIX, "file-format", "unix" }, | ||
| 208 | + { LIB3270_FT_RECORD_FORMAT_FIXED, "record-format", "fixed" }, | ||
| 209 | + { LIB3270_FT_RECORD_FORMAT_VARIABLE, "record-format", "variable" }, | ||
| 210 | + { LIB3270_FT_RECORD_FORMAT_UNDEFINED, "record-format", "undefined" }, | ||
| 211 | + { LIB3270_FT_ALLOCATION_UNITS_TRACKS, "units", "tracks" }, | ||
| 212 | + { LIB3270_FT_ALLOCATION_UNITS_CYLINDERS, "units", "cylinders" }, | ||
| 213 | + { LIB3270_FT_ALLOCATION_UNITS_AVBLOCK, "units", "avblock" }, | ||
| 214 | + { 0, NULL, NULL } | ||
| 215 | }; | 215 | }; |
| 216 | 216 | ||
| 217 | const struct v3270_ft_worker_field v3270_ft_worker_fields[PROGRESS_FIELD_COUNT] = | 217 | const struct v3270_ft_worker_field v3270_ft_worker_fields[PROGRESS_FIELD_COUNT] = |
| 218 | { | 218 | { |
| 219 | - { N_("Local:"), N_("Path and name of the local file") }, | ||
| 220 | - { N_("Remote:"), N_("The name of the file in the host") }, | ||
| 221 | - { N_("Total:"), N_("Total bytes to transfer") }, | ||
| 222 | - { N_("Current:"), N_("Current transfer position") }, | ||
| 223 | - { N_("Speed:"), N_("Transfer speed") }, | ||
| 224 | - { N_("ETA:"), N_("Estimated transfer arrival") } | 219 | + { N_("Local:"), N_("Path and name of the local file") }, |
| 220 | + { N_("Remote:"), N_("The name of the file in the host") }, | ||
| 221 | + { N_("Total:"), N_("Total bytes to transfer") }, | ||
| 222 | + { N_("Current:"), N_("Current transfer position") }, | ||
| 223 | + { N_("Speed:"), N_("Transfer speed") }, | ||
| 224 | + { N_("ETA:"), N_("Estimated transfer arrival") } | ||
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | -const gchar * v3270_text_file_extensions[] = | ||
| 228 | -{ | ||
| 229 | - ".txt", | ||
| 230 | - ".c", | ||
| 231 | - ".h", | ||
| 232 | - NULL | 227 | +const gchar * v3270_text_file_extensions[] = { |
| 228 | + ".txt", | ||
| 229 | + ".c", | ||
| 230 | + ".h", | ||
| 231 | + NULL | ||
| 233 | }; | 232 | }; |
| 234 | 233 |
src/filetransfer/worker.c
| @@ -367,12 +367,11 @@ | @@ -367,12 +367,11 @@ | ||
| 367 | 367 | ||
| 368 | gtk_entry_set_text(cfg->worker->field[PROGRESS_FIELD_ETA],""); | 368 | gtk_entry_set_text(cfg->worker->field[PROGRESS_FIELD_ETA],""); |
| 369 | 369 | ||
| 370 | - | ||
| 371 | const LIB3270_FT_MESSAGE * ftMessage = lib3270_translate_ft_message(cfg->msg); | 370 | const LIB3270_FT_MESSAGE * ftMessage = lib3270_translate_ft_message(cfg->msg); |
| 372 | 371 | ||
| 373 | if(ftMessage) | 372 | if(ftMessage) |
| 374 | { | 373 | { |
| 375 | - description = ftMessage->description; | 374 | + description = dgettext(lib3270_get_translation_domain(),ftMessage->description); |
| 376 | if(ftMessage->failed) | 375 | if(ftMessage->failed) |
| 377 | cfg->signal = V3270_WORKER_TRANSFER_FAILED_SIGNAL; | 376 | cfg->signal = V3270_WORKER_TRANSFER_FAILED_SIGNAL; |
| 378 | 377 | ||
| @@ -589,14 +588,14 @@ static gboolean do_timer(V3270FTWorker *worker) { | @@ -589,14 +588,14 @@ static gboolean do_timer(V3270FTWorker *worker) { | ||
| 589 | if(!ft) | 588 | if(!ft) |
| 590 | { | 589 | { |
| 591 | if(!message) | 590 | if(!message) |
| 592 | - message = N_("Can't start file transfer session"); | 591 | + message = _("Can't start file transfer session"); |
| 593 | 592 | ||
| 594 | - gtk_progress_bar_set_text(worker->pbar,g_dgettext(PACKAGE_NAME,message)); | 593 | + gtk_progress_bar_set_text(worker->pbar,message); |
| 595 | 594 | ||
| 596 | pulse_stop(worker); | 595 | pulse_stop(worker); |
| 597 | 596 | ||
| 598 | // Emit "transfer failed" | 597 | // Emit "transfer failed" |
| 599 | - g_signal_emit(GTK_WIDGET(widget),v3270_worker_signals[V3270_WORKER_TRANSFER_FAILED_SIGNAL], 0, g_dgettext(PACKAGE_NAME,message), NULL); | 598 | + g_signal_emit(GTK_WIDGET(widget),v3270_worker_signals[V3270_WORKER_TRANSFER_FAILED_SIGNAL], 0, message, NULL); |
| 600 | 599 | ||
| 601 | // Emit "no transfer" | 600 | // Emit "no transfer" |
| 602 | ft_state_changed(worker->hSession, LIB3270_FT_STATE_NONE, _("No transfer in progress"), widget); | 601 | ft_state_changed(worker->hSession, LIB3270_FT_STATE_NONE, _("No transfer in progress"), widget); |
src/terminal/callbacks.c
| @@ -45,17 +45,6 @@ | @@ -45,17 +45,6 @@ | ||
| 45 | #include <lib3270/log.h> | 45 | #include <lib3270/log.h> |
| 46 | #include <errno.h> | 46 | #include <errno.h> |
| 47 | 47 | ||
| 48 | -/** | ||
| 49 | - * SECTION: v3270 | ||
| 50 | - * @title: Virtual 3270 widget | ||
| 51 | - * @short_description: The virtual 3270 terminal widget. | ||
| 52 | - * | ||
| 53 | - * Manages lib3270 callbacks. | ||
| 54 | - * | ||
| 55 | - */ | ||
| 56 | - | ||
| 57 | -/*--[ Widget definition ]----------------------------------------------------------------------------*/ | ||
| 58 | - | ||
| 59 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 48 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 60 | 49 | ||
| 61 | static void set_timer(H3270 *session, unsigned char on) | 50 | static void set_timer(H3270 *session, unsigned char on) |