Commit 4ff7cbe02c60df3a5fed41d6ee35d6865869507f
1 parent
0c06052f
Exists in
master
and in
5 other branches
Incluindo opcao para acesso a hosts com 8 cores
Showing
3 changed files
with
68 additions
and
28 deletions
Show diff stats
src/pw3270/actions.c
| ... | ... | @@ -73,6 +73,7 @@ static void connect_action(GtkAction *action, GtkWidget *widget) |
| 73 | 73 | |
| 74 | 74 | if(host) |
| 75 | 75 | { |
| 76 | + lib3270_set_options(v3270_get_session(widget),0); | |
| 76 | 77 | v3270_connect(widget,host); |
| 77 | 78 | return; |
| 78 | 79 | } |
| ... | ... | @@ -80,6 +81,7 @@ static void connect_action(GtkAction *action, GtkWidget *widget) |
| 80 | 81 | host = get_string_from_config("host","uri",""); |
| 81 | 82 | if(*host) |
| 82 | 83 | { |
| 84 | + load_3270_options_from_config(widget); | |
| 83 | 85 | v3270_connect(widget,host); |
| 84 | 86 | g_free(host); |
| 85 | 87 | return; | ... | ... |
src/pw3270/dialog.c
| ... | ... | @@ -32,7 +32,46 @@ |
| 32 | 32 | #include "globals.h" |
| 33 | 33 | #include <pw3270/v3270.h> |
| 34 | 34 | |
| 35 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
| 35 | + static const struct _lib3270_options | |
| 36 | + { | |
| 37 | + LIB3270_OPTION value; | |
| 38 | + const gchar * key; | |
| 39 | + const gchar * text; | |
| 40 | + const gchar * tooltip; | |
| 41 | + } lib3270_options[] = | |
| 42 | + { | |
| 43 | + { | |
| 44 | + LIB3270_OPTION_COLOR8, | |
| 45 | + "color8", | |
| 46 | + N_( "_8 colors" ), | |
| 47 | + N_( "If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors." ) | |
| 48 | + }, | |
| 49 | + | |
| 50 | + { | |
| 51 | + LIB3270_OPTION_AS400, | |
| 52 | + "as400", | |
| 53 | + N_( "Host is AS_400" ), | |
| 54 | + NULL | |
| 55 | + }, | |
| 56 | + | |
| 57 | + }; | |
| 58 | + | |
| 59 | + | |
| 60 | +/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
| 61 | + | |
| 62 | + void load_3270_options_from_config(GtkWidget *widget) | |
| 63 | + { | |
| 64 | + int f; | |
| 65 | + LIB3270_OPTION opt = 0; | |
| 66 | + | |
| 67 | + for(f=0;f<G_N_ELEMENTS(lib3270_options);f++) | |
| 68 | + { | |
| 69 | + if(get_boolean_from_config("host",lib3270_options[f].key,FALSE)) | |
| 70 | + opt |= lib3270_options[f].value; | |
| 71 | + } | |
| 72 | + lib3270_set_options(v3270_get_session(widget),opt); | |
| 73 | + } | |
| 74 | + | |
| 36 | 75 | |
| 37 | 76 | static void charset_changed(GtkComboBox *widget,gchar **encoding) |
| 38 | 77 | { |
| ... | ... | @@ -286,28 +325,9 @@ |
| 286 | 325 | return 0; |
| 287 | 326 | } |
| 288 | 327 | |
| 328 | + | |
| 289 | 329 | void hostname_action(GtkAction *action, GtkWidget *widget) |
| 290 | 330 | { |
| 291 | - static const struct _option | |
| 292 | - { | |
| 293 | - LIB3270_OPTION value; | |
| 294 | - const gchar * text; | |
| 295 | - const gchar * tooltip; | |
| 296 | - } option[] = | |
| 297 | - { | |
| 298 | - { | |
| 299 | - LIB3270_OPTION_COLOR8, | |
| 300 | - N_( "_8 colors" ), | |
| 301 | - N_( "If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors." ) | |
| 302 | - }, | |
| 303 | - | |
| 304 | - { | |
| 305 | - LIB3270_OPTION_AS400, | |
| 306 | - N_( "Host is AS_400" ), | |
| 307 | - NULL | |
| 308 | - }, | |
| 309 | - }; | |
| 310 | - | |
| 311 | 331 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); |
| 312 | 332 | gchar * cfghost = get_string_from_config("host","uri",""); |
| 313 | 333 | gchar * hostname; |
| ... | ... | @@ -318,7 +338,7 @@ |
| 318 | 338 | GtkEntry * host = GTK_ENTRY(gtk_entry_new()); |
| 319 | 339 | GtkEntry * port = GTK_ENTRY(gtk_entry_new()); |
| 320 | 340 | GtkToggleButton * sslcheck = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic( _( "_Secure connection" ) )); |
| 321 | - GtkToggleButton * optcheck[G_N_ELEMENTS(option)]; | |
| 341 | + GtkToggleButton * optcheck[G_N_ELEMENTS(lib3270_options)]; | |
| 322 | 342 | GtkWidget * dialog = gtk_dialog_new_with_buttons( gettext(title ? title : N_( "Select hostname" )), |
| 323 | 343 | GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
| 324 | 344 | GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, |
| ... | ... | @@ -347,20 +367,19 @@ |
| 347 | 367 | int f; |
| 348 | 368 | int col = 1; |
| 349 | 369 | int row = 0; |
| 350 | - LIB3270_OPTION optval = lib3270_get_options(v3270_get_session(widget)); | |
| 351 | 370 | |
| 352 | 371 | GtkTable * frame = GTK_TABLE(gtk_table_new(2,2,FALSE)); |
| 353 | 372 | gtk_table_attach(frame,GTK_WIDGET(sslcheck), 0,1,0,1,GTK_EXPAND|GTK_FILL,0,0,0); |
| 354 | 373 | |
| 355 | - for(f=0;f<G_N_ELEMENTS(option);f++) | |
| 374 | + for(f=0;f<G_N_ELEMENTS(lib3270_options);f++) | |
| 356 | 375 | { |
| 357 | - optcheck[f] = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic( gettext( option[f].text ) )); | |
| 376 | + optcheck[f] = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic( gettext( lib3270_options[f].text ) )); | |
| 358 | 377 | |
| 359 | - if(option[f].tooltip) | |
| 360 | - gtk_widget_set_tooltip_markup(GTK_WIDGET(optcheck[f]),gettext(option[f].tooltip)); | |
| 378 | + if(lib3270_options[f].tooltip) | |
| 379 | + gtk_widget_set_tooltip_markup(GTK_WIDGET(optcheck[f]),gettext(lib3270_options[f].tooltip)); | |
| 361 | 380 | |
| 362 | 381 | gtk_table_attach(frame,GTK_WIDGET(optcheck[f]),col,col+1,row,row+1,GTK_EXPAND|GTK_FILL,0,0,0); |
| 363 | - gtk_toggle_button_set_active(optcheck[f],optval & option[f].value ? TRUE : FALSE); | |
| 382 | + gtk_toggle_button_set_active(optcheck[f],get_boolean_from_config("host", lib3270_options[f].key, FALSE)); | |
| 364 | 383 | |
| 365 | 384 | if(++col > 1); |
| 366 | 385 | { |
| ... | ... | @@ -423,6 +442,22 @@ |
| 423 | 442 | NULL |
| 424 | 443 | ); |
| 425 | 444 | |
| 445 | + { | |
| 446 | + int f; | |
| 447 | + LIB3270_OPTION opt = 0; | |
| 448 | + | |
| 449 | + for(f=0;f<G_N_ELEMENTS(lib3270_options);f++) | |
| 450 | + { | |
| 451 | + gboolean val = gtk_toggle_button_get_active(optcheck[f]); | |
| 452 | + if(val) | |
| 453 | + opt |= lib3270_options[f].value; | |
| 454 | + set_boolean_to_config("host", lib3270_options[f].key, val); | |
| 455 | + } | |
| 456 | + | |
| 457 | + lib3270_set_options(v3270_get_session(widget),opt); | |
| 458 | + | |
| 459 | + } | |
| 460 | + | |
| 426 | 461 | if(!lib3270_connect(v3270_get_session(widget),hostname,1)) |
| 427 | 462 | again = FALSE; |
| 428 | 463 | ... | ... |
src/pw3270/globals.h
| ... | ... | @@ -62,6 +62,9 @@ |
| 62 | 62 | G_GNUC_INTERNAL void load_color_schemes(GtkWidget *widget, gchar *active); |
| 63 | 63 | G_GNUC_INTERNAL GtkWidget * color_scheme_new(const GdkColor *current); |
| 64 | 64 | |
| 65 | + G_GNUC_INTERNAL void load_3270_options_from_config(GtkWidget *widget); | |
| 66 | + | |
| 67 | + | |
| 65 | 68 | // actions |
| 66 | 69 | G_GNUC_INTERNAL void paste_file_action(GtkAction *action, GtkWidget *widget); |
| 67 | 70 | G_GNUC_INTERNAL void hostname_action(GtkAction *action, GtkWidget *widget); | ... | ... |