Commit 922f7557d4486894bd859815914ed9045608c97a
1 parent
33b7e9c1
Exists in
master
and in
1 other branch
Small adjustments in comboboxes.
Showing
1 changed file
with
67 additions
and
35 deletions
Show diff stats
src/dialogs/settings/host.c
@@ -428,9 +428,6 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -428,9 +428,6 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
428 | 428 | ||
429 | } | 429 | } |
430 | 430 | ||
431 | - // Cell renderer | ||
432 | - GtkCellRenderer * text_renderer = gtk_cell_renderer_text_new(); | ||
433 | - | ||
434 | // Connection properties | 431 | // Connection properties |
435 | gtk_grid_set_row_spacing(GTK_GRID(grids[CONNECTION]),6); | 432 | gtk_grid_set_row_spacing(GTK_GRID(grids[CONNECTION]),6); |
436 | gtk_grid_set_column_spacing(GTK_GRID(grids[CONNECTION]),12); | 433 | gtk_grid_set_column_spacing(GTK_GRID(grids[CONNECTION]),12); |
@@ -538,7 +535,11 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -538,7 +535,11 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
538 | 535 | ||
539 | // Create combo boxes | 536 | // Create combo boxes |
540 | { | 537 | { |
541 | - size_t combo, item; | 538 | + // Cell renderer |
539 | + size_t combo; | ||
540 | + size_t item; | ||
541 | + | ||
542 | + GtkCellRenderer * text_renderer = gtk_cell_renderer_text_new(); | ||
542 | 543 | ||
543 | for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) { | 544 | for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) { |
544 | 545 | ||
@@ -552,59 +553,90 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -552,59 +553,90 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
552 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->input.combos[combo]), text_renderer, TRUE); | 553 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->input.combos[combo]), text_renderer, TRUE); |
553 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.combos[combo]), text_renderer, "text", 0, NULL); | 554 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.combos[combo]), text_renderer, "text", 0, NULL); |
554 | 555 | ||
555 | - for(item = 0; combos[combo].labels[item]; item++) | ||
556 | - { | 556 | + v3270_grid_attach(GTK_GRID(grids[EMULATION]), (struct v3270_entry_field *) & combos[combo], GTK_WIDGET(widget->input.combos[combo])); |
557 | + | ||
558 | + for(item = 0; combos[combo].labels[item]; item++) { | ||
557 | GtkTreeIter iter; | 559 | GtkTreeIter iter; |
558 | gtk_list_store_append((GtkListStore *) model, &iter); | 560 | gtk_list_store_append((GtkListStore *) model, &iter); |
559 | gtk_list_store_set((GtkListStore *) model, &iter, 0, g_dgettext(PACKAGE_NAME, combos[combo].labels[item]), 1, combos[combo].values[item], -1); | 561 | gtk_list_store_set((GtkListStore *) model, &iter, 0, g_dgettext(PACKAGE_NAME, combos[combo].labels[item]), 1, combos[combo].values[item], -1); |
560 | } | 562 | } |
561 | 563 | ||
562 | - v3270_grid_attach(GTK_GRID(grids[EMULATION]), (struct v3270_entry_field *) & combos[combo], GTK_WIDGET(widget->input.combos[combo])); | 564 | + } |
565 | + | ||
566 | + // Create Charset Combo | ||
567 | + { | ||
568 | + GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(1,G_TYPE_STRING); | ||
569 | + | ||
570 | + widget->input.charset = GTK_COMBO_BOX(gtk_combo_box_new_with_model(model)); | ||
571 | + | ||
572 | + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->input.charset), text_renderer, TRUE); | ||
573 | + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.charset), text_renderer, "text", 0, NULL); | ||
574 | + | ||
575 | + static const gchar * charsets[] = | ||
576 | + { | ||
577 | + "us", | ||
578 | + "bracket", | ||
579 | + "cp500" | ||
580 | + }; | ||
581 | + | ||
582 | + size_t charset; | ||
583 | + for(charset = 0; charset < G_N_ELEMENTS(charsets); charset++) | ||
584 | + { | ||
585 | + GtkTreeIter iter; | ||
586 | + gtk_list_store_append((GtkListStore *) model, &iter); | ||
587 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, charsets[charset], -1); | ||
588 | + }; | ||
589 | + | ||
590 | + static const struct v3270_entry_field descriptor = | ||
591 | + { | ||
592 | + .top = 2, | ||
593 | + .left = 0, | ||
594 | + .width = 2, | ||
595 | + .height = 1, | ||
596 | + | ||
597 | + .label = N_("_Charset"), | ||
598 | + .tooltip = N_("The EBCDIC host character set. "), | ||
599 | + | ||
600 | + }; | ||
601 | + | ||
602 | + v3270_grid_attach(GTK_GRID(grids[EMULATION]), &descriptor, GTK_WIDGET(widget->input.charset)); | ||
563 | 603 | ||
564 | } | 604 | } |
565 | 605 | ||
566 | } | 606 | } |
567 | 607 | ||
568 | - // Create Charset Combo | 608 | + |
609 | + /* | ||
610 | + // Create combo boxes | ||
569 | { | 611 | { |
570 | - GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(1,G_TYPE_STRING); | 612 | + size_t combo, item; |
571 | 613 | ||
572 | - widget->input.charset = GTK_COMBO_BOX(gtk_combo_box_new_with_model(model)); | 614 | + for(combo = 0; combo < G_N_ELEMENTS(combos); combo++) { |
573 | 615 | ||
574 | - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->input.charset), text_renderer, TRUE); | ||
575 | - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.charset), text_renderer, "text", 0, NULL); | ||
576 | 616 | ||
577 | - static const gchar * charsets[] = | ||
578 | - { | ||
579 | - "us", | ||
580 | - "bracket", | ||
581 | - "cp500" | ||
582 | - }; | 617 | + widget->input.combos[combo] = GTK_COMBO_BOX(gtk_combo_box_new_with_model(model)); |
583 | 618 | ||
584 | - size_t charset; | ||
585 | - for(charset = 0; charset < G_N_ELEMENTS(charsets); charset++) | ||
586 | - { | ||
587 | - GtkTreeIter iter; | ||
588 | - gtk_list_store_append((GtkListStore *) model, &iter); | ||
589 | - gtk_list_store_set((GtkListStore *) model, &iter, 0, charsets[charset], -1); | ||
590 | - }; | 619 | + if(combos[combo].tooltip) |
620 | + gtk_widget_set_tooltip_markup(GTK_WIDGET(widget->input.combos[combo]),combos[combo].tooltip); | ||
591 | 621 | ||
592 | - static const struct v3270_entry_field descriptor = | ||
593 | - { | ||
594 | - .top = 2, | ||
595 | - .left = 0, | ||
596 | - .width = 2, | ||
597 | - .height = 1, | 622 | + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->input.combos[combo]), text_renderer, TRUE); |
623 | + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.combos[combo]), text_renderer, "text", 0, NULL); | ||
598 | 624 | ||
599 | - .label = N_("_Charset"), | ||
600 | - .tooltip = N_("The EBCDIC host character set. "), | 625 | + for(item = 0; combos[combo].labels[item]; item++) |
626 | + { | ||
627 | + GtkTreeIter iter; | ||
628 | + gtk_list_store_append((GtkListStore *) model, &iter); | ||
629 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, g_dgettext(PACKAGE_NAME, combos[combo].labels[item]), 1, combos[combo].values[item], -1); | ||
630 | + } | ||
601 | 631 | ||
602 | - }; | 632 | + v3270_grid_attach(GTK_GRID(grids[EMULATION]), (struct v3270_entry_field *) & combos[combo], GTK_WIDGET(widget->input.combos[combo])); |
603 | 633 | ||
604 | - v3270_grid_attach(GTK_GRID(grids[EMULATION]), &descriptor, GTK_WIDGET(widget->input.charset)); | 634 | + } |
605 | 635 | ||
606 | } | 636 | } |
607 | 637 | ||
638 | + */ | ||
639 | + | ||
608 | gtk_widget_show_all(GTK_WIDGET(widget)); | 640 | gtk_widget_show_all(GTK_WIDGET(widget)); |
609 | 641 | ||
610 | } | 642 | } |