From b7ca33a37de5dd2ecffa7575681c6009996b7ba2 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 1 Feb 2022 17:38:15 +0100 Subject: Initialize and use dbus interfaces async related #1155 --- libdino/src/dbus/login1.vala | 7 +++---- libdino/src/dbus/notifications.vala | 15 +++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'libdino/src/dbus') diff --git a/libdino/src/dbus/login1.vala b/libdino/src/dbus/login1.vala index 904f389c..da358a99 100644 --- a/libdino/src/dbus/login1.vala +++ b/libdino/src/dbus/login1.vala @@ -5,14 +5,13 @@ public interface Login1Manager : Object { public signal void PrepareForSleep(bool suspend); } -public static Login1Manager? get_login1() { - Login1Manager? login1 = null; +public static async Login1Manager? get_login1() { try { - login1 = Bus.get_proxy_sync(BusType.SYSTEM, "org.freedesktop.login1", "/org/freedesktop/login1"); + return yield Bus.get_proxy(BusType.SYSTEM, "org.freedesktop.login1", "/org/freedesktop/login1"); } catch (IOError e) { stderr.printf("%s\n", e.message); } - return login1; + return null; } } \ No newline at end of file diff --git a/libdino/src/dbus/notifications.vala b/libdino/src/dbus/notifications.vala index 68401440..25a567df 100644 --- a/libdino/src/dbus/notifications.vala +++ b/libdino/src/dbus/notifications.vala @@ -7,23 +7,22 @@ namespace Dino { public signal void notification_closed (uint32 id, uint32 reason); - public abstract uint32 notify(string app_name, uint32 replaces_id, string app_icon, string summary, + public abstract async uint32 notify(string app_name, uint32 replaces_id, string app_icon, string summary, string body, string[] actions, HashTable hints, int32 expire_timeout) throws DBusError, IOError; - public abstract void get_capabilities(out string[] capabilities) throws Error; + public abstract async void get_capabilities(out string[] capabilities) throws Error; - public abstract void close_notification(uint id) throws DBusError, IOError; + public abstract async 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 abstract async 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; + public static async DBusNotifications? get_notifications_dbus() { try { - upower = Bus.get_proxy_sync(BusType.SESSION, "org.freedesktop.Notifications", "/org/freedesktop/Notifications"); + return yield Bus.get_proxy(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; + return null; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2