aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/dbus
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-11-20 15:21:34 +0100
committerfiaxh <git@lightrise.org>2020-11-20 15:21:34 +0100
commit11d9855a3994bc24ff67f5c2c4933c1d9559f6c5 (patch)
tree29407df7d6cfb36f82580de5f39f0bbf9c28d372 /libdino/src/dbus
parent07917f1d841f449157aa3aaa2507b0547dd274e7 (diff)
downloaddino-11d9855a3994bc24ff67f5c2c4933c1d9559f6c5.tar.gz
dino-11d9855a3994bc24ff67f5c2c4933c1d9559f6c5.zip
Refactor Notifications, add freedesktop backend
fixes #707
Diffstat (limited to 'libdino/src/dbus')
-rw-r--r--libdino/src/dbus/notifications.vala29
1 files changed, 29 insertions, 0 deletions
diff --git a/libdino/src/dbus/notifications.vala b/libdino/src/dbus/notifications.vala
new file mode 100644
index 00000000..68401440
--- /dev/null
+++ b/libdino/src/dbus/notifications.vala
@@ -0,0 +1,29 @@
+namespace Dino {
+
+ [DBus (name = "org.freedesktop.Notifications")]
+ public interface DBusNotifications : GLib.Object {
+
+ public signal void action_invoked(uint32 key, string action_key);
+
+ public signal void notification_closed (uint32 id, uint32 reason);
+
+ public abstract uint32 notify(string app_name, uint32 replaces_id, string app_icon, string summary,
+ string body, string[] actions, HashTable<string, Variant> hints, int32 expire_timeout) throws DBusError, IOError;
+
+ public abstract void get_capabilities(out string[] capabilities) throws Error;
+
+ public abstract void close_notification(uint id) throws DBusError, IOError;
+
+ public abstract void get_server_information(out string name, out string vendor, out string version, out string spec_version) throws DBusError, IOError;
+ }
+
+ public static DBusNotifications? get_notifications_dbus() {
+ DBusNotifications? upower = null;
+ try {
+ upower = Bus.get_proxy_sync(BusType.SESSION, "org.freedesktop.Notifications", "/org/freedesktop/Notifications");
+ } catch (IOError e) {
+ warning("Couldn't get org.freedesktop.Notifications DBus instance: %s\n", e.message);
+ }
+ return upower;
+ }
+} \ No newline at end of file