Use constants

This commit is contained in:
Leonhard 2024-03-13 18:05:21 +01:00
parent 3d24111852
commit d9db718513
2 changed files with 5 additions and 4 deletions

View File

@ -6,8 +6,9 @@
*/
public class Gala.DaemonManager : GLib.Object {
private const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
private const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";
public const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
public const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";
private const int SPACING = 12;
[DBus (name = "org.pantheon.gala.daemon")]

View File

@ -24,12 +24,12 @@ public class Gala.SessionManager : Object {
private EndSessionDialog? proxy = null;
construct {
Bus.watch_name (SESSION, "org.pantheon.gala.daemon", NONE, () => on_proxy_appeared.begin (), () => proxy = null);
Bus.watch_name (SESSION, DaemonManager.DAEMON_DBUS_NAME, NONE, () => on_proxy_appeared.begin (), () => proxy = null);
}
private async void on_proxy_appeared () {
try {
proxy = yield Bus.get_proxy (BusType.SESSION, "org.pantheon.gala.daemon", "/org/pantheon/gala/daemon", 0, null);
proxy = yield Bus.get_proxy (BusType.SESSION, DaemonManager.DAEMON_DBUS_NAME, DaemonManager.DAEMON_DBUS_OBJECT_PATH, 0, null);
} catch (Error e) {
warning ("Could not connect to io.elementary.wm.daemon.EndSessionDialog proxy: %s", e.message);
return;