Commit ed90bd96022beb9c40cc3389b0418d89175c5f26

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

Adjustments in host settings dialog.

Showing 1 changed file with 58 additions and 46 deletions   Show diff stats
src/dialogs/settings/host.c
... ... @@ -42,10 +42,19 @@
42 42  
43 43 /*--[ Globals ]--------------------------------------------------------------------------------------*/
44 44  
  45 + enum {
  46 + CONNECTION,
  47 + EMULATION,
  48 +
  49 + GRID_COUNT
  50 + };
  51 +
45 52 static const struct ToggleList
46 53 {
47 54 gint left;
48 55 gint top;
  56 + gint width;
  57 + unsigned short grid;
49 58  
50 59 LIB3270_TOGGLE_ID id;
51 60 }
... ... @@ -54,19 +63,32 @@
54 63 {
55 64 .left = 2,
56 65 .top = 3,
  66 + .width = 1,
  67 + .grid = CONNECTION,
57 68 .id = LIB3270_TOGGLE_CONNECT_ON_STARTUP,
58 69 },
59 70 {
60 71 .left = 3,
61 72 .top = 3,
  73 + .width = 1,
  74 + .grid = CONNECTION,
62 75 .id = LIB3270_TOGGLE_RECONNECT,
63 76 },
64 77 {
65 78 .left = 4,
66 79 .top = 3,
  80 + .width = 1,
  81 + .grid = CONNECTION,
67 82 .id = LIB3270_TOGGLE_KEEP_ALIVE,
68   - }
  83 + },
69 84  
  85 + {
  86 + .left = 6,
  87 + .top = 1,
  88 + .width = 2,
  89 + .grid = EMULATION,
  90 + .id = LIB3270_TOGGLE_ALTSCREEN,
  91 + }
70 92 };
71 93  
72 94 enum _entry
... ... @@ -185,6 +207,7 @@
185 207 {
186 208 ENTRY_FIELD_HEAD
187 209  
  210 + unsigned short grid;
188 211 gint max_length;
189 212 gint width_chars;
190 213  
... ... @@ -194,6 +217,7 @@
194 217 .top = 0,
195 218 .width = 4,
196 219 .height = 1,
  220 + .grid = CONNECTION,
197 221  
198 222 .label = N_( "_Host" ),
199 223 .tooltip = N_("Address or name of the host to connect."),
... ... @@ -206,6 +230,7 @@
206 230 .top = 1,
207 231 .width = 1,
208 232 .height = 1,
  233 + .grid = CONNECTION,
209 234  
210 235 .label = N_( "_Service" ),
211 236 .tooltip = N_("Port or service name (empty for \"telnet\")."),
... ... @@ -218,6 +243,7 @@
218 243 .left = 3,
219 244 .width = 2,
220 245 .height = 1,
  246 + .grid = EMULATION,
221 247  
222 248 .label = N_( "Oversize" ),
223 249 .tooltip = N_("Makes the screen larger than the default for the chosen model number."),
... ... @@ -230,6 +256,7 @@
230 256 .left = 0,
231 257 .width = 8,
232 258 .height = 1,
  259 + .grid = EMULATION,
233 260  
234 261 .label = N_( "Custom Remap" ),
235 262 .tooltip = N_("Path to XML file with custom charset mapping."),
... ... @@ -242,6 +269,7 @@
242 269 .top = 1,
243 270 .width = 2,
244 271 .height = 1,
  272 + .grid = CONNECTION,
245 273  
246 274 .label = N_( "L_U Names" ),
247 275 .tooltip = N_("Comma separated list of LU names."),
... ... @@ -398,28 +426,36 @@ static gboolean auto_disconnect_format(GtkSpinButton *spin, G_GNUC_UNUSED gpoint
398 426  
399 427 static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
400 428 {
  429 + GtkWidget *grids[GRID_COUNT];
  430 +
  431 + {
  432 + size_t grid;
  433 +
  434 + for(grid = 0; grid < G_N_ELEMENTS(grids); grid++)
  435 + grids[grid] = gtk_grid_new();
  436 +
  437 + }
  438 +
401 439 // Cell renderer
402 440 GtkCellRenderer * text_renderer = gtk_cell_renderer_text_new();
403 441  
404 442 // Connection properties
405   - GtkWidget * connection = gtk_grid_new();
406   - gtk_grid_set_row_spacing(GTK_GRID(connection),6);
407   - gtk_grid_set_column_spacing(GTK_GRID(connection),12);
  443 + gtk_grid_set_row_spacing(GTK_GRID(grids[CONNECTION]),6);
  444 + gtk_grid_set_column_spacing(GTK_GRID(grids[CONNECTION]),12);
408 445  
409 446 gtk_grid_attach(
410 447 GTK_GRID(widget),
411   - v3270_dialog_create_frame(connection,_("Connection")),
  448 + v3270_dialog_create_frame(grids[CONNECTION],_("Connection")),
412 449 0,0,10,5
413 450 );
414 451  
415 452 // Emulation properties
416   - GtkWidget * emulation = gtk_grid_new();
417   - gtk_grid_set_row_spacing(GTK_GRID(emulation),6);
418   - gtk_grid_set_column_spacing(GTK_GRID(emulation),12);
  453 + gtk_grid_set_row_spacing(GTK_GRID(grids[EMULATION]),6);
  454 + gtk_grid_set_column_spacing(GTK_GRID(grids[EMULATION]),12);
419 455  
420 456 gtk_grid_attach(
421 457 GTK_GRID(widget),
422   - v3270_dialog_create_frame(emulation,_("Emulation")),
  458 + v3270_dialog_create_frame(grids[EMULATION],_("Emulation")),
423 459 0,6,10,5
424 460 );
425 461  
... ... @@ -432,6 +468,13 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
432 468 widget->input.entry[entry] = GTK_ENTRY(gtk_entry_new());
433 469 gtk_entry_set_max_length(widget->input.entry[entry],entryfields[entry].max_length);
434 470 gtk_entry_set_width_chars(widget->input.entry[entry],entryfields[entry].width_chars);
  471 +
  472 + v3270_grid_attach(
  473 + GTK_GRID(grids[entryfields[entry].grid]),
  474 + (struct v3270_entry_field *) & entryfields[entry],
  475 + GTK_WIDGET(widget->input.entry[entry])
  476 + );
  477 +
435 478 }
436 479  
437 480 // Custom settings
... ... @@ -449,37 +492,6 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
449 492  
450 493 g_signal_connect(G_OBJECT(widget->input.entry[ENTRY_OVERSIZE]),"changed",G_CALLBACK(oversize_changed),widget);
451 494  
452   - // Add to containers
453   - v3270_grid_attach(
454   - GTK_GRID(connection),
455   - (struct v3270_entry_field *) & entryfields[0],
456   - GTK_WIDGET(widget->input.entry[0])
457   - );
458   -
459   - v3270_grid_attach(
460   - GTK_GRID(connection),
461   - (struct v3270_entry_field *) & entryfields[1],
462   - GTK_WIDGET(widget->input.entry[1])
463   - );
464   -
465   - v3270_grid_attach(
466   - GTK_GRID(emulation),
467   - (struct v3270_entry_field *) & entryfields[2],
468   - GTK_WIDGET(widget->input.entry[2])
469   - );
470   -
471   - v3270_grid_attach(
472   - GTK_GRID(emulation),
473   - (struct v3270_entry_field *) & entryfields[3],
474   - GTK_WIDGET(widget->input.entry[3])
475   - );
476   -
477   - v3270_grid_attach(
478   - GTK_GRID(connection),
479   - (struct v3270_entry_field *) & entryfields[4],
480   - GTK_WIDGET(widget->input.entry[4])
481   - );
482   -
483 495 }
484 496  
485 497 // Auto disconnect
... ... @@ -494,8 +506,8 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
494 506  
495 507 gtk_spin_button_set_increments(widget->input.auto_disconnect,1,1);
496 508  
497   - gtk_grid_attach(GTK_GRID(connection),label,0,2,1,1);
498   - gtk_grid_attach(GTK_GRID(connection),GTK_WIDGET(widget->input.auto_disconnect),1,2,1,1);
  509 + gtk_grid_attach(GTK_GRID(grids[CONNECTION]),label,0,2,1,1);
  510 + gtk_grid_attach(GTK_GRID(grids[CONNECTION]),GTK_WIDGET(widget->input.auto_disconnect),1,2,1,1);
499 511 g_signal_connect(G_OBJECT(widget->input.auto_disconnect),"output",G_CALLBACK(auto_disconnect_format),widget);
500 512 }
501 513  
... ... @@ -504,7 +516,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
504 516 widget->input.ssl = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(_( "_Secure connection." )));
505 517 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.ssl),_( "Check for SSL secure connection." ));
506 518 gtk_widget_set_halign(GTK_WIDGET(widget->input.ssl),GTK_ALIGN_START);
507   - gtk_grid_attach(GTK_GRID(connection),GTK_WIDGET(widget->input.ssl),1,3,1,1);
  519 + gtk_grid_attach(GTK_GRID(grids[CONNECTION]),GTK_WIDGET(widget->input.ssl),1,3,1,1);
508 520 }
509 521  
510 522 // Toggle checkboxes
... ... @@ -525,7 +537,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
525 537 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.toggles[toggle]),tooltip);
526 538  
527 539 gtk_widget_set_halign(GTK_WIDGET(widget->input.toggles[toggle]),GTK_ALIGN_START);
528   - gtk_grid_attach(GTK_GRID(connection),GTK_WIDGET(widget->input.toggles[toggle]),toggleList[toggle].left,toggleList[toggle].top,1,1);
  540 + gtk_grid_attach(GTK_GRID(grids[toggleList[toggle].grid]),GTK_WIDGET(widget->input.toggles[toggle]),toggleList[toggle].left,toggleList[toggle].top,toggleList[toggle].width,1);
529 541  
530 542 }
531 543  
... ... @@ -556,7 +568,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
556 568 gtk_list_store_set((GtkListStore *) model, &iter, 0, g_dgettext(PACKAGE_NAME, combos[combo].labels[item]), 1, combos[combo].values[item], -1);
557 569 }
558 570  
559   - v3270_grid_attach(GTK_GRID(emulation), (struct v3270_entry_field *) & combos[combo], GTK_WIDGET(widget->input.combos[combo]));
  571 + v3270_grid_attach(GTK_GRID(grids[EMULATION]), (struct v3270_entry_field *) & combos[combo], GTK_WIDGET(widget->input.combos[combo]));
560 572  
561 573 }
562 574  
... ... @@ -598,7 +610,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
598 610  
599 611 };
600 612  
601   - v3270_grid_attach(GTK_GRID(emulation), &descriptor, GTK_WIDGET(widget->input.charset));
  613 + v3270_grid_attach(GTK_GRID(grids[EMULATION]), &descriptor, GTK_WIDGET(widget->input.charset));
602 614  
603 615 }
604 616  
... ...