Commit 4ac39648fcd945476099efbc8a5edab6f9e55e52
1 parent
0fdbd46f
Exists in
master
and in
5 other branches
Simplificando configuração do host para facilitar a transferência de arquivos "BB"
Showing
4 changed files
with
95 additions
and
40 deletions
Show diff stats
src/include/lib3270.h
@@ -241,13 +241,14 @@ | @@ -241,13 +241,14 @@ | ||
241 | */ | 241 | */ |
242 | typedef enum lib3270_option | 242 | typedef enum lib3270_option |
243 | { | 243 | { |
244 | - LIB3270_OPTION_COLOR8 = 0x0001, /**< If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors. */ | ||
245 | - LIB3270_OPTION_AS400 = 0x0002, /**< Host is AS400? */ | 244 | + LIB3270_OPTION_COLOR8 = 0x0001, /**< If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors. */ |
245 | + LIB3270_OPTION_KYBD_AS400 = 0x0002, /**< Prefix every PF with PA1 */ | ||
246 | + LIB3270_OPTION_TSO = 0x0004, /**< Host is TSO? */ | ||
246 | 247 | ||
247 | } LIB3270_OPTION; | 248 | } LIB3270_OPTION; |
248 | 249 | ||
249 | #define LIB3270_OPTION_DEFAULT 0 | 250 | #define LIB3270_OPTION_DEFAULT 0 |
250 | - #define LIB3270_OPTION_COUNT 2 | 251 | + #define LIB3270_OPTION_COUNT 3 |
251 | 252 | ||
252 | typedef struct _lib3270_option_entry | 253 | typedef struct _lib3270_option_entry |
253 | { | 254 | { |
src/lib3270/kybd.c
@@ -566,14 +566,14 @@ LIB3270_FKEY_ACTION( pfkey ) | @@ -566,14 +566,14 @@ LIB3270_FKEY_ACTION( pfkey ) | ||
566 | 566 | ||
567 | if (hSession->kybdlock) | 567 | if (hSession->kybdlock) |
568 | { | 568 | { |
569 | - if(hSession->options & LIB3270_OPTION_AS400) | 569 | + if(hSession->options & LIB3270_OPTION_KYBD_AS400) |
570 | enq_key(hSession,pa_xlate[0]); | 570 | enq_key(hSession,pa_xlate[0]); |
571 | 571 | ||
572 | enq_key(hSession,pf_xlate[key-1]); | 572 | enq_key(hSession,pf_xlate[key-1]); |
573 | } | 573 | } |
574 | else | 574 | else |
575 | { | 575 | { |
576 | - if(hSession->options & LIB3270_OPTION_AS400) | 576 | + if(hSession->options & LIB3270_OPTION_KYBD_AS400) |
577 | key_AID(hSession,pa_xlate[0]); | 577 | key_AID(hSession,pa_xlate[0]); |
578 | 578 | ||
579 | key_AID(hSession,pf_xlate[key-1]); | 579 | key_AID(hSession,pf_xlate[key-1]); |
src/lib3270/options.c
@@ -46,9 +46,16 @@ | @@ -46,9 +46,16 @@ | ||
46 | }, | 46 | }, |
47 | 47 | ||
48 | { | 48 | { |
49 | - LIB3270_OPTION_AS400, | 49 | + LIB3270_OPTION_KYBD_AS400, |
50 | "as400", | 50 | "as400", |
51 | - N_( "Host is AS_400" ), | 51 | + N_( "Host is AS/400" ), |
52 | + NULL | ||
53 | + }, | ||
54 | + | ||
55 | + { | ||
56 | + LIB3270_OPTION_TSO, | ||
57 | + "tso", | ||
58 | + N_( "Host is TSO" ), | ||
52 | NULL | 59 | NULL |
53 | }, | 60 | }, |
54 | 61 |
src/pw3270/dialog.c
@@ -34,6 +34,36 @@ | @@ -34,6 +34,36 @@ | ||
34 | 34 | ||
35 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 35 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
36 | 36 | ||
37 | + static const struct _host_type | ||
38 | + { | ||
39 | + const gchar * name; | ||
40 | + const gchar * description; | ||
41 | + LIB3270_OPTION option; | ||
42 | + } host_type[] = | ||
43 | + { | ||
44 | + { "S390", N_( "IBM S/390" ), LIB3270_OPTION_TSO }, | ||
45 | + { "AS400", N_( "IBM AS/400" ), LIB3270_OPTION_KYBD_AS400 }, | ||
46 | + { "TSO", N_( "Other (TSO)" ), LIB3270_OPTION_TSO }, | ||
47 | + { "VM/CMS", N_( "Other (VM/CMS)" ), 0 } | ||
48 | + }; | ||
49 | + | ||
50 | + static const struct _charset | ||
51 | + { | ||
52 | + const gchar *name; | ||
53 | + const gchar *description; | ||
54 | + } charset[] = | ||
55 | + { | ||
56 | + // http://en.wikipedia.org/wiki/Character_encoding | ||
57 | + { "UTF-8", N_( "UTF-8" ) }, | ||
58 | + { "ISO-8859-1", N_( "Western Europe (ISO 8859-1)" ) }, | ||
59 | + { "CP1252", N_( "Windows Western languages (CP1252)" ) }, | ||
60 | + | ||
61 | + { NULL, NULL } | ||
62 | + }; | ||
63 | + | ||
64 | + | ||
65 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
66 | + | ||
37 | void load_3270_options_from_config(GtkWidget *widget) | 67 | void load_3270_options_from_config(GtkWidget *widget) |
38 | { | 68 | { |
39 | int f; | 69 | int f; |
@@ -97,22 +127,8 @@ | @@ -97,22 +127,8 @@ | ||
97 | else | 127 | else |
98 | { | 128 | { |
99 | // Add charset options | 129 | // Add charset options |
100 | - static const struct _list | ||
101 | - { | ||
102 | - const gchar *charset; | ||
103 | - const gchar *text; | ||
104 | - } list[] = | ||
105 | - { | ||
106 | - // http://en.wikipedia.org/wiki/Character_encoding | ||
107 | - { "UTF-8", N_( "UTF-8" ) }, | ||
108 | - { "ISO-8859-1", N_( "Western Europe (ISO 8859-1)" ) }, | ||
109 | - { "CP1252", N_( "Windows Western languages (CP1252)" ) }, | ||
110 | - | ||
111 | - { NULL, NULL } | ||
112 | - }; | ||
113 | - | ||
114 | GtkWidget * label = gtk_label_new_with_mnemonic (_("C_haracter Coding:")); | 130 | GtkWidget * label = gtk_label_new_with_mnemonic (_("C_haracter Coding:")); |
115 | - const gchar * charset = NULL; | 131 | + const gchar * scharset = NULL; |
116 | #if GTK_CHECK_VERSION(3,0,0) | 132 | #if GTK_CHECK_VERSION(3,0,0) |
117 | GtkWidget * menu = gtk_combo_box_text_new(); | 133 | GtkWidget * menu = gtk_combo_box_text_new(); |
118 | #else | 134 | #else |
@@ -125,14 +141,14 @@ | @@ -125,14 +141,14 @@ | ||
125 | int f; | 141 | int f; |
126 | int p = 0; | 142 | int p = 0; |
127 | 143 | ||
128 | - g_get_charset(&charset); | ||
129 | - *encoding = g_strdup(charset); | 144 | + g_get_charset(&scharset); |
145 | + *encoding = g_strdup(scharset); | ||
130 | 146 | ||
131 | - text = g_strdup_printf(_("Current (%s)"),charset); | 147 | + text = g_strdup_printf(_("Current (%s)"),scharset); |
132 | 148 | ||
133 | #if GTK_CHECK_VERSION(3,0,0) | 149 | #if GTK_CHECK_VERSION(3,0,0) |
134 | 150 | ||
135 | - gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(menu),p,charset,text); | 151 | + gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(menu),p,scharset,text); |
136 | 152 | ||
137 | #else | 153 | #else |
138 | 154 | ||
@@ -140,7 +156,7 @@ | @@ -140,7 +156,7 @@ | ||
140 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(menu), renderer, "text", 0, NULL); | 156 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(menu), renderer, "text", 0, NULL); |
141 | 157 | ||
142 | gtk_list_store_append((GtkListStore *) model,&iter); | 158 | gtk_list_store_append((GtkListStore *) model,&iter); |
143 | - gtk_list_store_set((GtkListStore *) model, &iter, 0, text, 1, charset, -1); | 159 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, text, 1, scharset, -1); |
144 | 160 | ||
145 | #endif // GTK(3,0,0) | 161 | #endif // GTK(3,0,0) |
146 | 162 | ||
@@ -148,15 +164,15 @@ | @@ -148,15 +164,15 @@ | ||
148 | 164 | ||
149 | gtk_combo_box_set_active(GTK_COMBO_BOX(menu),p++); | 165 | gtk_combo_box_set_active(GTK_COMBO_BOX(menu),p++); |
150 | 166 | ||
151 | - for(f=0;list[f].charset;f++) | 167 | + for(f=0;charset[f].name;f++) |
152 | { | 168 | { |
153 | - if(strcasecmp(charset,list[f].charset)) | 169 | + if(strcasecmp(scharset,charset[f].name)) |
154 | { | 170 | { |
155 | #if GTK_CHECK_VERSION(3,0,0) | 171 | #if GTK_CHECK_VERSION(3,0,0) |
156 | - gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(menu),p++,list[f].charset,gettext(list[f].text)); | 172 | + gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(menu),p++,charset[f].name,gettext(charset[f].description)); |
157 | #else | 173 | #else |
158 | gtk_list_store_append((GtkListStore *) model,&iter); | 174 | gtk_list_store_append((GtkListStore *) model,&iter); |
159 | - gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(list[f].text), 1, list[f].charset, -1); | 175 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(charset[f].description), 1, charset[f].name, -1); |
160 | #endif // GTK(3,0,0) | 176 | #endif // GTK(3,0,0) |
161 | } | 177 | } |
162 | } | 178 | } |
@@ -304,9 +320,10 @@ | @@ -304,9 +320,10 @@ | ||
304 | 320 | ||
305 | void hostname_action(GtkAction *action, GtkWidget *widget) | 321 | void hostname_action(GtkAction *action, GtkWidget *widget) |
306 | { | 322 | { |
307 | - const LIB3270_OPTION_ENTRY *options = lib3270_get_option_list(); | 323 | +// const LIB3270_OPTION_ENTRY *options = lib3270_get_option_list(); |
308 | 324 | ||
309 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); | 325 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); |
326 | + const gchar * systype = g_object_get_data(G_OBJECT(action),"type"); | ||
310 | gchar * cfghost = get_string_from_config("host","uri",""); | 327 | gchar * cfghost = get_string_from_config("host","uri",""); |
311 | gchar * hostname; | 328 | gchar * hostname; |
312 | gchar * ptr; | 329 | gchar * ptr; |
@@ -316,7 +333,7 @@ | @@ -316,7 +333,7 @@ | ||
316 | GtkEntry * host = GTK_ENTRY(gtk_entry_new()); | 333 | GtkEntry * host = GTK_ENTRY(gtk_entry_new()); |
317 | GtkEntry * port = GTK_ENTRY(gtk_entry_new()); | 334 | GtkEntry * port = GTK_ENTRY(gtk_entry_new()); |
318 | GtkToggleButton * sslcheck = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic( _( "_Secure connection" ) )); | 335 | GtkToggleButton * sslcheck = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic( _( "_Secure connection" ) )); |
319 | - GtkToggleButton * optcheck[LIB3270_OPTION_COUNT]; | 336 | +// GtkToggleButton * optcheck[LIB3270_OPTION_COUNT]; |
320 | GtkWidget * dialog = gtk_dialog_new_with_buttons( gettext(title ? title : N_( "Select hostname" )), | 337 | GtkWidget * dialog = gtk_dialog_new_with_buttons( gettext(title ? title : N_( "Select hostname" )), |
321 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), | 338 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
322 | GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, | 339 | GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, |
@@ -344,12 +361,38 @@ | @@ -344,12 +361,38 @@ | ||
344 | gtk_table_attach(table,GTK_WIDGET(sslcheck), 1,2,1,2,GTK_EXPAND|GTK_FILL,0,0,0); | 361 | gtk_table_attach(table,GTK_WIDGET(sslcheck), 1,2,1,2,GTK_EXPAND|GTK_FILL,0,0,0); |
345 | 362 | ||
346 | { | 363 | { |
364 | + GtkWidget * expander = gtk_expander_new_with_mnemonic(_( "_Host options")); | ||
365 | + GtkBox * container = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL,0)); | ||
366 | + | ||
367 | + // Host options | ||
368 | + if(!systype) | ||
369 | + { | ||
370 | + // No system type defined, ask user | ||
371 | + GtkTable * frame = GTK_TABLE(gtk_table_new(2,2,FALSE)); | ||
372 | + GtkWidget * widget = gtk_combo_box_text_new(); | ||
373 | + gchar * str = get_string_from_config("host","systype",host_type[0].name); | ||
374 | + int f; | ||
375 | + | ||
376 | + label = gtk_label_new_with_mnemonic( _("System _Type:") ); | ||
377 | + gtk_table_attach(frame,label,0,1,0,1,0,0,5,0); | ||
378 | + | ||
379 | + for(f=0;f<G_N_ELEMENTS(host_type);f++) | ||
380 | + { | ||
381 | + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widget),host_type[f].name,gettext(host_type[f].description)); | ||
382 | + if(!g_strcasecmp(host_type[f].name,str)) | ||
383 | + gtk_combo_box_set_active(GTK_COMBO_BOX(widget),f); | ||
384 | + } | ||
385 | + | ||
386 | + g_free(str); | ||
347 | 387 | ||
348 | - int f; | ||
349 | - int col = 0; | ||
350 | - int row = 0; | ||
351 | 388 | ||
352 | - GtkWidget * container = gtk_expander_new_with_mnemonic(_( "_Host options")); | 389 | + gtk_table_attach(frame,widget,1,2,0,1,GTK_EXPAND|GTK_FILL,0,0,0); |
390 | + gtk_label_set_mnemonic_widget(GTK_LABEL(label),GTK_WIDGET(widget)); | ||
391 | + | ||
392 | + gtk_box_pack_start(container,GTK_WIDGET(frame),FALSE,TRUE,0); | ||
393 | + } | ||
394 | + | ||
395 | +/* | ||
353 | GtkTable * frame = GTK_TABLE(gtk_table_new(2,2,FALSE)); | 396 | GtkTable * frame = GTK_TABLE(gtk_table_new(2,2,FALSE)); |
354 | 397 | ||
355 | for(f=0;f<LIB3270_OPTION_COUNT;f++) | 398 | for(f=0;f<LIB3270_OPTION_COUNT;f++) |
@@ -371,7 +414,10 @@ | @@ -371,7 +414,10 @@ | ||
371 | } | 414 | } |
372 | 415 | ||
373 | gtk_container_add(GTK_CONTAINER(container),GTK_WIDGET(frame)); | 416 | gtk_container_add(GTK_CONTAINER(container),GTK_WIDGET(frame)); |
374 | - gtk_table_attach(table,container,1,2,2,3,GTK_EXPAND|GTK_FILL,0,0,0); | 417 | + |
418 | +*/ | ||
419 | + gtk_container_add(GTK_CONTAINER(expander),GTK_WIDGET(container)); | ||
420 | + gtk_table_attach(table,expander,1,2,2,3,GTK_EXPAND|GTK_FILL,0,0,0); | ||
375 | } | 421 | } |
376 | 422 | ||
377 | 423 | ||
@@ -425,9 +471,10 @@ | @@ -425,9 +471,10 @@ | ||
425 | ); | 471 | ); |
426 | 472 | ||
427 | { | 473 | { |
428 | - int f; | 474 | +// int f; |
429 | LIB3270_OPTION opt = 0; | 475 | LIB3270_OPTION opt = 0; |
430 | 476 | ||
477 | +/* | ||
431 | for(f=0;f<LIB3270_OPTION_COUNT;f++) | 478 | for(f=0;f<LIB3270_OPTION_COUNT;f++) |
432 | { | 479 | { |
433 | gboolean val = gtk_toggle_button_get_active(optcheck[f]); | 480 | gboolean val = gtk_toggle_button_get_active(optcheck[f]); |
@@ -435,7 +482,7 @@ | @@ -435,7 +482,7 @@ | ||
435 | opt |= options[f].value; | 482 | opt |= options[f].value; |
436 | set_boolean_to_config("host", options[f].key, val); | 483 | set_boolean_to_config("host", options[f].key, val); |
437 | } | 484 | } |
438 | - | 485 | +*/ |
439 | v3270_set_session_options(widget,opt); | 486 | v3270_set_session_options(widget,opt); |
440 | 487 | ||
441 | } | 488 | } |