Commit bd3a838b33c0083c99280fff3d5a0e2a94605807
1 parent
5f05be7b
Exists in
master
and in
1 other branch
Changing SSL toggle to dropdown to allow more options.
Showing
1 changed file
with
43 additions
and
14 deletions
Show diff stats
src/dialogs/settings/host.c
| ... | ... | @@ -52,21 +52,21 @@ |
| 52 | 52 | { |
| 53 | 53 | { |
| 54 | 54 | .left = 2, |
| 55 | - .top = 3, | |
| 56 | - .width = 1, | |
| 55 | + .top = 2, | |
| 56 | + .width = 2, | |
| 57 | 57 | .grid = CONNECTION, |
| 58 | 58 | .id = LIB3270_TOGGLE_CONNECT_ON_STARTUP, |
| 59 | 59 | }, |
| 60 | 60 | { |
| 61 | - .left = 3, | |
| 62 | - .top = 3, | |
| 61 | + .left = 4, | |
| 62 | + .top = 2, | |
| 63 | 63 | .width = 1, |
| 64 | 64 | .grid = CONNECTION, |
| 65 | 65 | .id = LIB3270_TOGGLE_RECONNECT, |
| 66 | 66 | }, |
| 67 | 67 | { |
| 68 | - .left = 4, | |
| 69 | - .top = 3, | |
| 68 | + .left = 5, | |
| 69 | + .top = 2, | |
| 70 | 70 | .width = 1, |
| 71 | 71 | .grid = CONNECTION, |
| 72 | 72 | .id = LIB3270_TOGGLE_KEEP_ALIVE, |
| ... | ... | @@ -208,7 +208,7 @@ |
| 208 | 208 | { |
| 209 | 209 | .left = 0, |
| 210 | 210 | .top = 0, |
| 211 | - .width = 4, | |
| 211 | + .width = 5, | |
| 212 | 212 | .height = 1, |
| 213 | 213 | .grid = CONNECTION, |
| 214 | 214 | |
| ... | ... | @@ -260,7 +260,7 @@ |
| 260 | 260 | { |
| 261 | 261 | .left = 2, |
| 262 | 262 | .top = 1, |
| 263 | - .width = 2, | |
| 263 | + .width = 3, | |
| 264 | 264 | .height = 1, |
| 265 | 265 | .grid = CONNECTION, |
| 266 | 266 | |
| ... | ... | @@ -279,7 +279,7 @@ |
| 279 | 279 | struct |
| 280 | 280 | { |
| 281 | 281 | GtkEntry * entry[G_N_ELEMENTS(entryfields)]; ///< @brief Entry fields for host & service name. |
| 282 | - GtkToggleButton * ssl; ///< @brief SSL Connection? | |
| 282 | + GtkComboBox * ssl; ///< @brief SSL Connection? | |
| 283 | 283 | GtkComboBox * combos[G_N_ELEMENTS(combos)]; ///< @brief Combo-boxes. |
| 284 | 284 | GtkComboBox * charset; ///< @brief Charset combo box. |
| 285 | 285 | GtkToggleButton * toggles[G_N_ELEMENTS(toggleList)]; ///< @brief Toggle checks. |
| ... | ... | @@ -540,12 +540,41 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) |
| 540 | 540 | |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - // SSL checkbox | |
| 543 | + // SSL input | |
| 544 | 544 | { |
| 545 | + GtkWidget *label = gtk_label_new_with_mnemonic(_( "_Security" )); | |
| 546 | + gtk_widget_set_halign(label,GTK_ALIGN_END); | |
| 547 | + gtk_grid_attach(GTK_GRID(grids[CONNECTION]),label,0,3,1,1); | |
| 548 | + | |
| 549 | + GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(1,G_TYPE_STRING); | |
| 550 | + | |
| 551 | + widget->input.ssl = GTK_COMBO_BOX(gtk_combo_box_new_with_model(model)); | |
| 552 | + | |
| 553 | + GtkCellRenderer * text_renderer = gtk_cell_renderer_text_new(); | |
| 554 | + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->input.ssl), text_renderer, TRUE); | |
| 555 | + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.ssl), text_renderer, "text", 0, NULL); | |
| 556 | + | |
| 557 | + static const gchar * levels[] = | |
| 558 | + { | |
| 559 | + N_("Unsecure"), | |
| 560 | + N_("SSL/TLS") | |
| 561 | + }; | |
| 562 | + | |
| 563 | + size_t level; | |
| 564 | + for(level = 0; level < G_N_ELEMENTS(levels); level++) | |
| 565 | + { | |
| 566 | + GtkTreeIter iter; | |
| 567 | + gtk_list_store_append((GtkListStore *) model, &iter); | |
| 568 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, levels[level], -1); | |
| 569 | + }; | |
| 570 | + | |
| 571 | + /* | |
| 545 | 572 | widget->input.ssl = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(_( "_Secure connection." ))); |
| 546 | 573 | gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.ssl),_( "Check for SSL secure connection." )); |
| 547 | 574 | gtk_widget_set_halign(GTK_WIDGET(widget->input.ssl),GTK_ALIGN_START); |
| 548 | - gtk_grid_attach(GTK_GRID(grids[CONNECTION]),GTK_WIDGET(widget->input.ssl),1,3,1,1); | |
| 575 | + */ | |
| 576 | + | |
| 577 | + gtk_grid_attach(GTK_GRID(grids[CONNECTION]),GTK_WIDGET(widget->input.ssl),1,3,2,1); | |
| 549 | 578 | } |
| 550 | 579 | |
| 551 | 580 | // Toggle checkboxes |
| ... | ... | @@ -699,7 +728,7 @@ static void apply(GtkWidget *w, GtkWidget *terminal) |
| 699 | 728 | { |
| 700 | 729 | g_autofree gchar * url = |
| 701 | 730 | g_strconcat( |
| 702 | - (gtk_toggle_button_get_active(widget->input.ssl) ? "tn3270s://" : "tn3270://"), | |
| 731 | + (gtk_combo_box_get_active(widget->input.ssl) > 0 ? "tn3270s://" : "tn3270://"), | |
| 703 | 732 | gtk_entry_get_text(widget->input.entry[ENTRY_HOSTNAME]), |
| 704 | 733 | ":", |
| 705 | 734 | gtk_entry_get_text(widget->input.entry[ENTRY_SRVCNAME]), |
| ... | ... | @@ -778,9 +807,9 @@ static void load(GtkWidget *w, GtkWidget *terminal) |
| 778 | 807 | { |
| 779 | 808 | |
| 780 | 809 | g_autofree gchar * url = g_strdup(u); |
| 781 | - debug("URL=[%s]",url); | |
| 782 | 810 | |
| 783 | - gtk_toggle_button_set_active(widget->input.ssl,g_str_has_prefix(u,"tn3270s")); | |
| 811 | + gtk_combo_box_set_active(widget->input.ssl,(g_str_has_prefix(u,"tn3270s") ? 1 : 0)); | |
| 812 | +// gtk_toggle_button_set_active(widget->input.ssl,g_str_has_prefix(u,"tn3270s")); | |
| 784 | 813 | |
| 785 | 814 | gchar *hostname = strstr(url,"://"); |
| 786 | 815 | if(!hostname) | ... | ... |