Commit a5f092d2ccf77267eb68f4010bbe8bc60b2e97c1

Authored by Perry Werneck
1 parent ec9e605e

Fixing actions.

src/objects/window/actions/close.c
... ... @@ -54,7 +54,7 @@
54 54  
55 55 V3270SimpleAction * action = v3270_simple_action_new();
56 56  
57   - action->parent.activate = activate;
  57 + action->activate = activate;
58 58 action->name = "close";
59 59 action->icon_name = "window-close";
60 60 action->label = _("Close window");
... ...
src/objects/window/actions/connect.c
... ... @@ -55,7 +55,7 @@
55 55 }
56 56  
57 57 action->name = "connect";
58   - action->parent.activate = activate;
  58 + action->activate = activate;
59 59 action->label = _("Connect");
60 60 action->tooltip = _("Connect to host");
61 61  
... ...
src/objects/window/actions/filetransfer.c
... ... @@ -38,7 +38,7 @@
38 38  
39 39 V3270SimpleAction * action = v3270_simple_action_new();
40 40  
41   - action->parent.activate = activate;
  41 + action->activate = activate;
42 42 action->group.id = LIB3270_ACTION_GROUP_ONLINE;
43 43 action->name = "file.transfer";
44 44 action->icon_name = "drive-harddisk";
... ...
src/objects/window/window.c
... ... @@ -429,19 +429,34 @@
429 429 GtkWidget * terminal = pw3270_application_window_new_tab(GTK_WIDGET(window), session_file);
430 430  
431 431 // Create property actions
432   - static const gchar * properties[] = {
433   - "model-number",
434   - "font-family",
435   - "dynamic-font-spacing",
436   - "trace",
  432 + static const struct Property {
  433 + LIB3270_ACTION_GROUP group;
  434 + const gchar *name;
  435 + } properties[] = {
  436 + {
  437 + .name = "model-number",
  438 + .group = LIB3270_ACTION_GROUP_OFFLINE
  439 + },
  440 + {
  441 + .name = "font-family",
  442 + .group = LIB3270_ACTION_GROUP_NONE
  443 + },
  444 + {
  445 + .name = "dynamic-font-spacing",
  446 + .group = LIB3270_ACTION_GROUP_NONE
  447 + },
  448 + {
  449 + .name = "trace",
  450 + .group = LIB3270_ACTION_GROUP_NONE
  451 + },
437 452 };
438 453  
439 454 for(ix = 0; ix < G_N_ELEMENTS(properties); ix++) {
440 455  
441   - GAction * action = G_ACTION(v3270_property_action_new(terminal,properties[ix]));
  456 + GAction * action = G_ACTION(v3270_property_action_new(terminal,properties[ix].name,properties[ix].group));
442 457  
443 458 if(!g_action_get_name(action)) {
444   - g_warning("Window property action %s is unnamed",properties[ix]);
  459 + g_warning("Window property action %s is unnamed",properties[ix].name);
445 460 } else {
446 461 g_action_map_add_action(G_ACTION_MAP(window),action);
447 462 }
... ... @@ -486,6 +501,8 @@
486 501  
487 502 void pw3270_application_window_set_active_terminal(GtkWidget *widget, GtkWidget *terminal) {
488 503  
  504 + size_t ix;
  505 +
489 506 pw3270ApplicationWindow * window = PW3270_APPLICATION_WINDOW(widget);
490 507  
491 508 if(window->terminal == terminal)
... ... @@ -512,23 +529,42 @@
512 529  
513 530 }
514 531  
515   - // Update actions
516   - size_t ix;
517   - gchar ** actions = g_action_group_list_actions(G_ACTION_GROUP(window));
  532 + // Update window actions
  533 + {
  534 + gchar ** actions = g_action_group_list_actions(G_ACTION_GROUP(window));
518 535  
519   - for(ix = 0; actions[ix]; ix++) {
  536 + for(ix = 0; actions[ix]; ix++) {
520 537  
521   -// debug("%s",actions[ix]);
  538 + GAction * action = g_action_map_lookup_action(G_ACTION_MAP(window), actions[ix]);
522 539  
523   - GAction * action = g_action_map_lookup_action(G_ACTION_MAP(window), actions[ix]);
  540 + if(action && V3270_IS_ACTION(action)) {
  541 + v3270_action_set_terminal_widget(action,terminal);
  542 + }
524 543  
525   - if(action && V3270_IS_ACTION(action)) {
526   - v3270_action_set_terminal_widget(action,terminal);
527 544 }
528 545  
  546 + g_strfreev(actions);
529 547 }
530 548  
531   - g_strfreev(actions);
  549 + // Update application actions
  550 + {
  551 + GtkApplication * application = GTK_APPLICATION(gtk_window_get_application(GTK_WINDOW(window)));
  552 +
  553 + if(application) {
  554 +
  555 + gchar ** actions = g_action_group_list_actions(G_ACTION_GROUP(application));
  556 +
  557 + for(ix = 0; actions[ix]; ix++) {
  558 +
  559 + GAction * action = g_action_map_lookup_action(G_ACTION_MAP(application), actions[ix]);
  560 + if(action && V3270_IS_ACTION(action)) {
  561 + v3270_action_set_terminal_widget(action,terminal);
  562 + }
  563 +
  564 + }
  565 +
  566 + }
  567 + }
532 568  
533 569 }
534 570  
... ...