Commit 781c9f0a3b65a1a79a2236b54a8c95c1b14f209f

Authored by Perry Werneck
1 parent 635047f1

Enable new windows and tab lockdown.

schemas/linux/application.gschema.xml.in
@@ -44,6 +44,18 @@ @@ -44,6 +44,18 @@
44 <description>Allow changing of host session properties</description> 44 <description>Allow changing of host session properties</description>
45 </key> 45 </key>
46 46
  47 + <key name="allow-new-tab-actions" type="b">
  48 + <default>true</default>
  49 + <summary>Enable new tab actions</summary>
  50 + <description>Enable new tab actions</description>
  51 + </key>
  52 +
  53 + <key name="allow-new-window-actions" type="b">
  54 + <default>true</default>
  55 + <summary>Enable new window actions</summary>
  56 + <description>Enable new window actions</description>
  57 + </key>
  58 +
47 </schema> 59 </schema>
48 60
49 </schemalist> 61 </schemalist>
src/objects/application/application.c
@@ -352,14 +352,15 @@ @@ -352,14 +352,15 @@
352 352
353 G_APPLICATION_CLASS(pw3270Application_parent_class)->startup(application); 353 G_APPLICATION_CLASS(pw3270Application_parent_class)->startup(application);
354 354
  355 + g_autoptr(GSettings) settings = pw3270_application_get_settings(application);
  356 +
  357 + //
  358 + // Common actions
  359 + //
355 GAction * actions[] = { 360 GAction * actions[] = {
356 pw3270_about_action_new(), 361 pw3270_about_action_new(),
357 pw3270_preferences_action_new(), 362 pw3270_preferences_action_new(),
358 - pw3270_new_tab_action_new(),  
359 - pw3270_new_window_action_new(),  
360 - pw3270_quit_action_new(),  
361 - pw3270_open_window_action_new(),  
362 - pw3270_open_tab_action_new() 363 + pw3270_quit_action_new()
363 }; 364 };
364 365
365 for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { 366 for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) {
@@ -367,6 +368,38 @@ @@ -367,6 +368,38 @@
367 } 368 }
368 369
369 // 370 //
  371 + // New tab actions
  372 + //
  373 + if(g_settings_get_boolean(settings,"allow-new-tab-actions")) {
  374 +
  375 + GAction * new_tab_actions[] = {
  376 + pw3270_open_tab_action_new(),
  377 + pw3270_new_tab_action_new()
  378 + };
  379 +
  380 + for(ix = 0; ix < G_N_ELEMENTS(new_tab_actions); ix++) {
  381 + g_action_map_add_action(G_ACTION_MAP(application),new_tab_actions[ix]);
  382 + }
  383 +
  384 + }
  385 +
  386 + //
  387 + // New window actions
  388 + //
  389 + if(g_settings_get_boolean(settings,"allow-new-window-actions")) {
  390 +
  391 + GAction * new_window_actions[] = {
  392 + pw3270_open_window_action_new(),
  393 + pw3270_new_window_action_new()
  394 + };
  395 +
  396 + for(ix = 0; ix < G_N_ELEMENTS(new_window_actions); ix++) {
  397 + g_action_map_add_action(G_ACTION_MAP(application),new_window_actions[ix]);
  398 + }
  399 +
  400 + }
  401 +
  402 + //
370 // Setup application menus 403 // Setup application menus
371 // 404 //
372 GtkBuilder * builder; 405 GtkBuilder * builder;