gtk-ng: use action helper in window
parent
a10b95f052
commit
d66212dcce
|
|
@ -331,42 +331,27 @@ pub const Window = extern struct {
|
||||||
|
|
||||||
/// Setup our action map.
|
/// Setup our action map.
|
||||||
fn initActionMap(self: *Self) void {
|
fn initActionMap(self: *Self) void {
|
||||||
const actions = .{
|
const actions = [_]ext.Action(Self){
|
||||||
.{ "about", actionAbout, null },
|
.init("about", actionAbout, null),
|
||||||
.{ "close", actionClose, null },
|
.init("close", actionClose, null),
|
||||||
.{ "close-tab", actionCloseTab, null },
|
.init("close-tab", actionCloseTab, null),
|
||||||
.{ "new-tab", actionNewTab, null },
|
.init("new-tab", actionNewTab, null),
|
||||||
.{ "new-window", actionNewWindow, null },
|
.init("new-window", actionNewWindow, null),
|
||||||
.{ "ring-bell", actionRingBell, null },
|
.init("ring-bell", actionRingBell, null),
|
||||||
.{ "split-right", actionSplitRight, null },
|
.init("split-right", actionSplitRight, null),
|
||||||
.{ "split-left", actionSplitLeft, null },
|
.init("split-left", actionSplitLeft, null),
|
||||||
.{ "split-up", actionSplitUp, null },
|
.init("split-up", actionSplitUp, null),
|
||||||
.{ "split-down", actionSplitDown, null },
|
.init("split-down", actionSplitDown, null),
|
||||||
.{ "copy", actionCopy, null },
|
.init("copy", actionCopy, null),
|
||||||
.{ "paste", actionPaste, null },
|
.init("paste", actionPaste, null),
|
||||||
.{ "reset", actionReset, null },
|
.init("reset", actionReset, null),
|
||||||
.{ "clear", actionClear, null },
|
.init("clear", actionClear, null),
|
||||||
// TODO: accept the surface that toggled the command palette
|
// TODO: accept the surface that toggled the command palette
|
||||||
.{ "toggle-command-palette", actionToggleCommandPalette, null },
|
.init("toggle-command-palette", actionToggleCommandPalette, null),
|
||||||
.{ "toggle-inspector", actionToggleInspector, null },
|
.init("toggle-inspector", actionToggleInspector, null),
|
||||||
};
|
};
|
||||||
|
|
||||||
const action_map = self.as(gio.ActionMap);
|
ext.addActions(Self, self, &actions);
|
||||||
inline for (actions) |entry| {
|
|
||||||
const action = gio.SimpleAction.new(
|
|
||||||
entry[0],
|
|
||||||
entry[2],
|
|
||||||
);
|
|
||||||
defer action.unref();
|
|
||||||
_ = gio.SimpleAction.signals.activate.connect(
|
|
||||||
action,
|
|
||||||
*Self,
|
|
||||||
entry[1],
|
|
||||||
self,
|
|
||||||
.{},
|
|
||||||
);
|
|
||||||
action_map.addAction(action.as(gio.Action));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Winproto backend for this window.
|
/// Winproto backend for this window.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue