Skip to content

Commit

Permalink
Fix activation of radio menu items (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
p-e-w committed May 6, 2017
1 parent 04f7876 commit 2c2a711
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Command.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ namespace Plotinus {

class ActionCommand : Command {
private Action action;
private Variant? parameter;

public override void execute() {
action.activate(null);
action.activate(parameter);
}

public ActionCommand(string[] path, string label, string[] accelerators, Action action) {
public ActionCommand(string[] path, string label, string[] accelerators, Action action, Variant? parameter) {
base(path, label, accelerators);
this.action = action;
this.parameter = parameter;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/CommandExtractor.vala
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class Plotinus.CommandExtractor : Object {

if (label != null && label != "" && action != null && action.enabled) {
var accelerators = (application != null) ? application.get_accels_for_action(action_name) : new string[0];
commands += new ActionCommand(path, label, accelerators, action);
var target = menu_model.get_item_attribute_value(i, Menu.ATTRIBUTE_TARGET, null);
commands += new ActionCommand(path, label, accelerators, action, target);
}

var link_iterator = menu_model.iterate_item_links(i);
Expand Down

0 comments on commit 2c2a711

Please sign in to comment.