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,10 +42,19 @@
42 42
43 /*--[ Globals ]--------------------------------------------------------------------------------------*/ 43 /*--[ Globals ]--------------------------------------------------------------------------------------*/
44 44
  45 + enum {
  46 + CONNECTION,
  47 + EMULATION,
  48 +
  49 + GRID_COUNT
  50 + };
  51 +
45 static const struct ToggleList 52 static const struct ToggleList
46 { 53 {
47 gint left; 54 gint left;
48 gint top; 55 gint top;
  56 + gint width;
  57 + unsigned short grid;
49 58
50 LIB3270_TOGGLE_ID id; 59 LIB3270_TOGGLE_ID id;
51 } 60 }
@@ -54,19 +63,32 @@ @@ -54,19 +63,32 @@
54 { 63 {
55 .left = 2, 64 .left = 2,
56 .top = 3, 65 .top = 3,
  66 + .width = 1,
  67 + .grid = CONNECTION,
57 .id = LIB3270_TOGGLE_CONNECT_ON_STARTUP, 68 .id = LIB3270_TOGGLE_CONNECT_ON_STARTUP,
58 }, 69 },
59 { 70 {
60 .left = 3, 71 .left = 3,
61 .top = 3, 72 .top = 3,
  73 + .width = 1,
  74 + .grid = CONNECTION,
62 .id = LIB3270_TOGGLE_RECONNECT, 75 .id = LIB3270_TOGGLE_RECONNECT,
63 }, 76 },
64 { 77 {
65 .left = 4, 78 .left = 4,
66 .top = 3, 79 .top = 3,
  80 + .width = 1,
  81 + .grid = CONNECTION,
67 .id = LIB3270_TOGGLE_KEEP_ALIVE, 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 enum _entry 94 enum _entry
@@ -185,6 +207,7 @@ @@ -185,6 +207,7 @@
185 { 207 {
186 ENTRY_FIELD_HEAD 208 ENTRY_FIELD_HEAD
187 209
  210 + unsigned short grid;
188 gint max_length; 211 gint max_length;
189 gint width_chars; 212 gint width_chars;
190 213
@@ -194,6 +217,7 @@ @@ -194,6 +217,7 @@
194 .top = 0, 217 .top = 0,
195 .width = 4, 218 .width = 4,
196 .height = 1, 219 .height = 1,
  220 + .grid = CONNECTION,
197 221
198 .label = N_( "_Host" ), 222 .label = N_( "_Host" ),
199 .tooltip = N_("Address or name of the host to connect."), 223 .tooltip = N_("Address or name of the host to connect."),
@@ -206,6 +230,7 @@ @@ -206,6 +230,7 @@
206 .top = 1, 230 .top = 1,
207 .width = 1, 231 .width = 1,
208 .height = 1, 232 .height = 1,
  233 + .grid = CONNECTION,
209 234
210 .label = N_( "_Service" ), 235 .label = N_( "_Service" ),
211 .tooltip = N_("Port or service name (empty for \"telnet\")."), 236 .tooltip = N_("Port or service name (empty for \"telnet\")."),
@@ -218,6 +243,7 @@ @@ -218,6 +243,7 @@
218 .left = 3, 243 .left = 3,
219 .width = 2, 244 .width = 2,
220 .height = 1, 245 .height = 1,
  246 + .grid = EMULATION,
221 247
222 .label = N_( "Oversize" ), 248 .label = N_( "Oversize" ),
223 .tooltip = N_("Makes the screen larger than the default for the chosen model number."), 249 .tooltip = N_("Makes the screen larger than the default for the chosen model number."),
@@ -230,6 +256,7 @@ @@ -230,6 +256,7 @@
230 .left = 0, 256 .left = 0,
231 .width = 8, 257 .width = 8,
232 .height = 1, 258 .height = 1,
  259 + .grid = EMULATION,
233 260
234 .label = N_( "Custom Remap" ), 261 .label = N_( "Custom Remap" ),
235 .tooltip = N_("Path to XML file with custom charset mapping."), 262 .tooltip = N_("Path to XML file with custom charset mapping."),
@@ -242,6 +269,7 @@ @@ -242,6 +269,7 @@
242 .top = 1, 269 .top = 1,
243 .width = 2, 270 .width = 2,
244 .height = 1, 271 .height = 1,
  272 + .grid = CONNECTION,
245 273
246 .label = N_( "L_U Names" ), 274 .label = N_( "L_U Names" ),
247 .tooltip = N_("Comma separated list of LU names."), 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,28 +426,36 @@ static gboolean auto_disconnect_format(GtkSpinButton *spin, G_GNUC_UNUSED gpoint
398 426
399 static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) 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 // Cell renderer 439 // Cell renderer
402 GtkCellRenderer * text_renderer = gtk_cell_renderer_text_new(); 440 GtkCellRenderer * text_renderer = gtk_cell_renderer_text_new();
403 441
404 // Connection properties 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 gtk_grid_attach( 446 gtk_grid_attach(
410 GTK_GRID(widget), 447 GTK_GRID(widget),
411 - v3270_dialog_create_frame(connection,_("Connection")), 448 + v3270_dialog_create_frame(grids[CONNECTION],_("Connection")),
412 0,0,10,5 449 0,0,10,5
413 ); 450 );
414 451
415 // Emulation properties 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 gtk_grid_attach( 456 gtk_grid_attach(
421 GTK_GRID(widget), 457 GTK_GRID(widget),
422 - v3270_dialog_create_frame(emulation,_("Emulation")), 458 + v3270_dialog_create_frame(grids[EMULATION],_("Emulation")),
423 0,6,10,5 459 0,6,10,5
424 ); 460 );
425 461
@@ -432,6 +468,13 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -432,6 +468,13 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
432 widget->input.entry[entry] = GTK_ENTRY(gtk_entry_new()); 468 widget->input.entry[entry] = GTK_ENTRY(gtk_entry_new());
433 gtk_entry_set_max_length(widget->input.entry[entry],entryfields[entry].max_length); 469 gtk_entry_set_max_length(widget->input.entry[entry],entryfields[entry].max_length);
434 gtk_entry_set_width_chars(widget->input.entry[entry],entryfields[entry].width_chars); 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 // Custom settings 480 // Custom settings
@@ -449,37 +492,6 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -449,37 +492,6 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
449 492
450 g_signal_connect(G_OBJECT(widget->input.entry[ENTRY_OVERSIZE]),"changed",G_CALLBACK(oversize_changed),widget); 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 // Auto disconnect 497 // Auto disconnect
@@ -494,8 +506,8 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -494,8 +506,8 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
494 506
495 gtk_spin_button_set_increments(widget->input.auto_disconnect,1,1); 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 g_signal_connect(G_OBJECT(widget->input.auto_disconnect),"output",G_CALLBACK(auto_disconnect_format),widget); 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,7 +516,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
504 widget->input.ssl = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(_( "_Secure connection." ))); 516 widget->input.ssl = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(_( "_Secure connection." )));
505 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.ssl),_( "Check for SSL secure connection." )); 517 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.ssl),_( "Check for SSL secure connection." ));
506 gtk_widget_set_halign(GTK_WIDGET(widget->input.ssl),GTK_ALIGN_START); 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 // Toggle checkboxes 522 // Toggle checkboxes
@@ -525,7 +537,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) @@ -525,7 +537,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
525 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.toggles[toggle]),tooltip); 537 gtk_widget_set_tooltip_text(GTK_WIDGET(widget->input.toggles[toggle]),tooltip);
526 538
527 gtk_widget_set_halign(GTK_WIDGET(widget->input.toggles[toggle]),GTK_ALIGN_START); 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,7 +568,7 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget)
556 gtk_list_store_set((GtkListStore *) model, &iter, 0, g_dgettext(PACKAGE_NAME, combos[combo].labels[item]), 1, combos[combo].values[item], -1); 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,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