From a7945373dad2c47677f2605f8a6ee98744fe15e7 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Mon, 3 Nov 2014 16:54:43 +0000 Subject: [PATCH] Ativação do SSL pelo diálogo não estava reajustando a URL --- src/lib3270/host.c | 2 +- src/lib3270/options.c | 9 +++++++++ src/pw3270/hostdialog.c | 384 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/pw3270/v3270/hostselect.c | 1 + 4 files changed, 11 insertions(+), 385 deletions(-) diff --git a/src/lib3270/host.c b/src/lib3270/host.c index 3707c2b..41cad48 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -208,7 +208,7 @@ static void update_host(H3270 *h) h->host.srvc )); - trace("hosturl=[%s]",h->host.full); + trace("hosturl=[%s] ssl=%s",h->host.full,(h->options&LIB3270_OPTION_SSL) ? "yes" : "no"); } diff --git a/src/lib3270/options.c b/src/lib3270/options.c index fdd0df0..06e54de 100644 --- a/src/lib3270/options.c +++ b/src/lib3270/options.c @@ -83,6 +83,15 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) { CHECK_SESSION_HANDLE(hSession); hSession->options = opt; + + Replace(hSession->host.full, + lib3270_strdup_printf( + "%s%s:%s", + hSession->options&LIB3270_OPTION_SSL ? "tn3270s://" : "tn3270://", + hSession->host.current, + hSession->host.srvc + )); + } LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession) diff --git a/src/pw3270/hostdialog.c b/src/pw3270/hostdialog.c index 9403239..0b46058 100644 --- a/src/pw3270/hostdialog.c +++ b/src/pw3270/hostdialog.c @@ -32,107 +32,6 @@ /*--[ Globals ]--------------------------------------------------------------------------------------*/ -/* - static const struct _host_type - { - const gchar * name; - const gchar * description; - LIB3270_OPTION option; - } host_type[] = - { - { "S390", N_( "IBM S/390" ), LIB3270_OPTION_S390 }, - { "AS400", N_( "IBM AS/400" ), LIB3270_OPTION_AS400 }, - { "TSO", N_( "Other (TSO)" ), LIB3270_OPTION_TSO }, - { "VM/CMS", N_( "Other (VM/CMS)" ), 0 } - }; - - static const struct _colortable - { - unsigned short colors; - const gchar * description; - } colortable[] = - { - { 16, N_( "16 colors" ) }, - { 8, N_( "8 colors" ) }, - { 2, N_( "Monochrome" ) }, - }; -*/ - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - -/* - LIB3270_OPTION pw3270_options_by_hosttype(const gchar *systype) - { - int f; - - for(f=0;G_N_ELEMENTS(host_type);f++) - { - if(!g_ascii_strcasecmp(host_type[f].name,systype)) - return host_type[f].option; - } - - g_message("Unexpected system type: \"%s\"",systype); - return 0; - } - -#if GTK_CHECK_VERSION(3,0,0) - static void set_row(int row, GtkWidget *widget, GtkGrid *container, const gchar *text) - { - GtkWidget *label = gtk_label_new_with_mnemonic(text); - - gtk_misc_set_alignment(GTK_MISC(label),0,0.5); - - gtk_grid_attach(container,label,0,row,1,1); - gtk_grid_attach(container,widget,1,row,1,1); - - gtk_label_set_mnemonic_widget(GTK_LABEL(label),widget); - } -#else - static void set_row(int row, GtkWidget *widget, GtkTable *container, const gchar *text) - { - GtkWidget *label = gtk_label_new_with_mnemonic(text); - - gtk_misc_set_alignment(GTK_MISC(label),0,0.5); - - gtk_table_attach(container,label,0,1,row,row+1,GTK_FILL,0,5,0); - gtk_table_attach(container,widget,1,2,row,row+1,GTK_FILL,0,0,0); - - gtk_label_set_mnemonic_widget(GTK_LABEL(label),widget); - } -#endif // GTK_CHECK_VERSION - - static void systype_changed(GtkComboBox *widget, int *iHostType) - { - GValue value = { 0, }; - GtkTreeIter iter; - - if(!gtk_combo_box_get_active_iter(widget,&iter)) - return; - - gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,1,&value); - - *iHostType = g_value_get_int(&value); - - trace("Selected host type: %s",host_type[*iHostType].name); - - } - - static void color_changed(GtkComboBox *widget, int *iColorTable) - { - GValue value = { 0, }; - GtkTreeIter iter; - - if(!gtk_combo_box_get_active_iter(widget,&iter)) - return; - - gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,1,&value); - - *iColorTable = g_value_get_int(&value); - - trace("Selected color type: %d",(int) colortable[*iColorTable].colors); - - } -*/ void hostname_action(GtkAction *action, GtkWidget *widget) { H3270 * hSession = v3270_get_session(widget); @@ -147,288 +46,5 @@ v3270_select_host(widget); -/* - const gchar * title = g_object_get_data(G_OBJECT(action),"title"); - gchar * ptr; - gboolean again = TRUE; - int iHostType = 0; - int iColorTable = 0; -#if GTK_CHECK_VERSION(3,0,0) - GtkGrid * grid = GTK_GRID(gtk_grid_new()); -#else - GtkTable * table = GTK_TABLE(gtk_table_new(3,4,FALSE)); -#endif // GTK_CHECK_VERSION - GtkEntry * host = GTK_ENTRY(gtk_entry_new()); - GtkEntry * port = GTK_ENTRY(gtk_entry_new()); - GtkToggleButton * sslcheck = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic( _( "_Secure connection" ) )); - GtkWidget * dialog = gtk_dialog_new_with_buttons( - gettext(title ? title : N_( "Select hostname" )), - GTK_WINDOW(gtk_widget_get_toplevel(widget)), - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - NULL ); - - gtk_window_set_icon_name(GTK_WINDOW(dialog),GTK_STOCK_HOME); - gtk_entry_set_max_length(host,0xFF); - gtk_entry_set_width_chars(host,50); - - gtk_entry_set_max_length(port,6); - gtk_entry_set_width_chars(port,7); - - -#if GTK_CHECK_VERSION(3,0,0) - - gtk_grid_set_column_spacing(grid,5); - gtk_grid_set_row_spacing(grid,3); - - { - // Host info - GtkGrid version - struct _line - { - const gchar * label; - GtkWidget * widget; - } line[] = - { - { N_( "_Hostname:" ), GTK_WIDGET(host) }, - { N_( "_Port:" ), GTK_WIDGET(port) } - }; - - int f; - int c = 0; - - for(f=0;fhSession,gtk_entry_get_text(widget->entry[ENTRY_HOSTNAME])); lib3270_set_srvcname(widget->hSession,gtk_entry_get_text(widget->entry[ENTRY_SRVCNAME])); + lib3270_set_options(widget->hSession,widget->options); return lib3270_connect(widget->hSession,0); -- libgit2 0.21.2