Open sonnyp opened 2 years ago
Some ideas:
Doing some investigation.
Both applications are registered
but when running the Vala desktop notification demo:
#!/usr/bin/env -S vala workbench.vala --pkg gtk4 --pkg libadwaita-1
public void main () {
var application = workbench.application as GLib.Application;
// this is required now for some reason?
application.register(null);
var notification = new Notification ("Lunch is ready");
notification.set_body (
"Today we have pancakes and salad, and fruit and cake for dessert"
);
notification.set_default_action ("app.notification-reply");
notification.add_button ("Accept", "app.notification-accept");
notification.add_button ("Decline", "app.notification-decline");
var icon = new ThemedIcon ("object-rotate-right-symbolic");
notification.set_icon (icon);
var simple_button = workbench.builder.get_object ("button_simple") as Gtk.Button;
simple_button.clicked.connect (() => {
application.send_notification ("lunch-is-ready", notification);
});
var action_reply = new SimpleAction ("notification-reply", null);
action_reply.activate.connect (() => {
stdout.printf ("Reply");
});
application.add_action (action_reply);
var action_accept = new SimpleAction ("notification-accept", null);
action_accept.activate.connect (() => {
stdout.printf ("Accept");
});
application.add_action (action_accept);
var action_decline = new SimpleAction ("notification-decline", null);
action_decline.activate.connect (() => {
stdout.printf ("Decline");
});
application.add_action (action_decline);
}
the notification shows but clicking on an action Accept
or Decline
appears to communicate with /re/sonny/Workbench
instead of /re/sonny/Workbench/vala_previewer
.
Actions are registered properly on /re/sonny/Workbench/vala_preview
When using Vala, the code and preview runs in a separate process.
So far, we were unable to use actions there so we had to disable/downgrade demos for Vala. See
This ticket is about enabling the usage of actions in library entries when using Vala.
See the previous description below and comments for an analysis of the issue.
Since then, the architecture changed a little bit and the external process isn't a
GApplication
anymore. Instead Workench and the external process communicate via a direct dbus connection instead of via the session bus.See https://github.com/sonnyp/Workbench/pull/184/files#diff-24cdf4b8c7c2fbd1c6b43e8b7bcc877d14cae496dd01e82eb212b6d5b4c68d59
Please note that Flatpak apps cannot have multiple dbus targets. https://github.com/flatpak/flatpak/issues/1902
Todo
GActions
in Vala examplesGActions
like the js ones