Commit 762f4b2d1997f1a0a88a840a575102dddf10d0a6

Authored by Perry Werneck
1 parent f7ba0208
Exists in master and in 1 other branch develop

Adding popup asking for user intervention when the SLL negotiation

fails.
Showing 1 changed file with 53 additions and 1 deletions   Show diff stats
src/terminal/callbacks.c
... ... @@ -360,7 +360,8 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title
360 360 {
361 361 GtkWidget *terminal = (GtkWidget *) lib3270_get_user_data(session);
362 362  
363   - if(terminal && GTK_IS_V3270(terminal)) {
  363 + if(terminal && GTK_IS_V3270(terminal))
  364 + {
364 365  
365 366 if(fmt)
366 367 {
... ... @@ -416,6 +417,56 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title
416 417 g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,(GSourceFunc) bg_update_oia, data, g_free);
417 418 }
418 419  
  420 + static int popup_ssl_error(H3270 *session, int rc, const char *title, const char *summary, const char *body)
  421 + {
  422 + GtkWidget *terminal = (GtkWidget *) lib3270_get_user_data(session);
  423 +
  424 + debug("%s.summary=\"%s\"",__FUNCTION__,summary);
  425 + debug("%s.body=\"%s\"",__FUNCTION__,body ? body : "undefined");
  426 +
  427 + if(terminal && GTK_IS_V3270(terminal))
  428 + {
  429 + GtkWidget * dialog = gtk_message_dialog_new_with_markup(
  430 + GTK_WINDOW(gtk_widget_get_toplevel(terminal)),
  431 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
  432 + GTK_MESSAGE_WARNING,
  433 + GTK_BUTTONS_NONE,
  434 + "%s",
  435 + summary
  436 + );
  437 +
  438 + gtk_window_set_title(GTK_WINDOW(dialog), title);
  439 +
  440 + if(body && *body)
  441 + {
  442 + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",body);
  443 + }
  444 + else if(rc)
  445 + {
  446 + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),_( "The error code was %d"),rc);
  447 + }
  448 +
  449 + gtk_dialog_add_buttons(
  450 + GTK_DIALOG(dialog),
  451 + _("Cancel"), GTK_RESPONSE_CANCEL,
  452 + _("Continue"), GTK_RESPONSE_APPLY,
  453 + NULL
  454 + );
  455 +
  456 + gtk_dialog_set_default_response(GTK_DIALOG (dialog),GTK_RESPONSE_CANCEL);
  457 +
  458 + gtk_widget_show_all(dialog);
  459 + int rc = gtk_dialog_run(GTK_DIALOG(dialog));
  460 + gtk_widget_destroy(dialog);
  461 +
  462 + if(rc == GTK_RESPONSE_APPLY)
  463 + return 0;
  464 +
  465 + }
  466 +
  467 + return -1;
  468 + }
  469 +
419 470 void v3270_install_callbacks(v3270 *widget)
420 471 {
421 472 struct lib3270_session_callbacks *cbk;
... ... @@ -450,6 +501,7 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title
450 501 cbk->message = message;
451 502 cbk->update_ssl = update_ssl;
452 503 cbk->print = print;
  504 + cbk->popup_ssl_error = popup_ssl_error;
453 505  
454 506 }
455 507  
... ...