diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index 18bc16745..301c40937 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -47,8 +47,8 @@ struct _MetaLauncher { - Login1Session *session_proxy; - Login1Seat *seat_proxy; + MetaDbusLogin1Session *session_proxy; + MetaDbusLogin1Seat *seat_proxy; char *seat_id; struct { @@ -224,14 +224,15 @@ find_systemd_session (gchar **session_id, return TRUE; } -static Login1Session * +static MetaDbusLogin1Session * get_session_proxy (GCancellable *cancellable, GError **error) { g_autofree char *proxy_path = NULL; g_autofree char *session_id = NULL; g_autoptr (GError) local_error = NULL; - Login1Session *session_proxy; + GDBusProxyFlags flags; + MetaDbusLogin1Session *session_proxy; if (!find_systemd_session (&session_id, &local_error)) { @@ -243,28 +244,35 @@ get_session_proxy (GCancellable *cancellable, proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/session", session_id); - session_proxy = login1_session_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, - "org.freedesktop.login1", - proxy_path, - cancellable, error); + flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; + session_proxy = + meta_dbus_login1_session_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + flags, + "org.freedesktop.login1", + proxy_path, + cancellable, error); if (!session_proxy) g_prefix_error(error, "Could not get session proxy: "); return session_proxy; } -static Login1Seat * +static MetaDbusLogin1Seat * get_seat_proxy (gchar *seat_id, GCancellable *cancellable, GError **error) { g_autofree char *seat_proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/seat", seat_id); - Login1Seat *seat = login1_seat_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, - "org.freedesktop.login1", - seat_proxy_path, - cancellable, error); + GDBusProxyFlags flags; + MetaDbusLogin1Seat *seat; + + flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; + seat = + meta_dbus_login1_seat_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + flags, + "org.freedesktop.login1", + seat_proxy_path, + cancellable, error); if (!seat) g_prefix_error(error, "Could not get seat proxy: "); @@ -272,26 +280,26 @@ get_seat_proxy (gchar *seat_id, } static gboolean -take_device (Login1Session *session_proxy, - int dev_major, - int dev_minor, - int *out_fd, - GCancellable *cancellable, - GError **error) +take_device (MetaDbusLogin1Session *session_proxy, + int dev_major, + int dev_minor, + int *out_fd, + GCancellable *cancellable, + GError **error) { g_autoptr (GVariant) fd_variant = NULL; g_autoptr (GUnixFDList) fd_list = NULL; int fd = -1; - if (!login1_session_call_take_device_sync (session_proxy, - dev_major, - dev_minor, - NULL, - &fd_variant, - NULL, /* paused */ - &fd_list, - cancellable, - error)) + if (!meta_dbus_login1_session_call_take_device_sync (session_proxy, + dev_major, + dev_minor, + NULL, + &fd_variant, + NULL, /* paused */ + &fd_list, + cancellable, + error)) return FALSE; fd = g_unix_fd_list_get (fd_list, g_variant_get_handle (fd_variant), error); @@ -363,6 +371,7 @@ void meta_launcher_close_restricted (MetaLauncher *launcher, int fd) { + MetaDbusLogin1Session *session_proxy = launcher->session_proxy; int major, minor; GError *error = NULL; @@ -372,9 +381,9 @@ meta_launcher_close_restricted (MetaLauncher *launcher, goto out; } - if (!login1_session_call_release_device_sync (launcher->session_proxy, - major, minor, - NULL, &error)) + if (!meta_dbus_login1_session_call_release_device_sync (session_proxy, + major, minor, + NULL, &error)) { g_warning ("Could not release device (%d,%d): %s", major, minor, error->message); @@ -441,8 +450,10 @@ sync_active (MetaLauncher *self) { MetaBackend *backend = meta_get_backend (); MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend); - gboolean active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy)); + MetaDbusLogin1Session *session_proxy = self->session_proxy; + gboolean active; + active = meta_dbus_login1_session_get_active (session_proxy); if (active == self->session_active) return; @@ -455,9 +466,9 @@ sync_active (MetaLauncher *self) } static void -on_active_changed (Login1Session *session, - GParamSpec *pspec, - gpointer user_data) +on_active_changed (MetaDbusLogin1Session *session, + GParamSpec *pspec, + gpointer user_data) { MetaLauncher *self = user_data; sync_active (self); @@ -496,8 +507,8 @@ MetaLauncher * meta_launcher_new (GError **error) { MetaLauncher *self = NULL; - g_autoptr (Login1Session) session_proxy = NULL; - g_autoptr (Login1Seat) seat_proxy = NULL; + g_autoptr (MetaDbusLogin1Session) session_proxy = NULL; + g_autoptr (MetaDbusLogin1Seat) seat_proxy = NULL; g_autofree char *seat_id = NULL; gboolean have_control = FALSE; @@ -505,7 +516,10 @@ meta_launcher_new (GError **error) if (!session_proxy) goto fail; - if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL, error)) + if (!meta_dbus_login1_session_call_take_control_sync (session_proxy, + FALSE, + NULL, + error)) { g_prefix_error (error, "Could not take control: "); goto fail; @@ -538,7 +552,10 @@ meta_launcher_new (GError **error) fail: if (have_control) - login1_session_call_release_control_sync (session_proxy, NULL, NULL); + { + meta_dbus_login1_session_call_release_control_sync (session_proxy, + NULL, NULL); + } return NULL; } @@ -558,5 +575,6 @@ meta_launcher_activate_vt (MetaLauncher *launcher, signed char vt, GError **error) { - return login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, NULL, error); + return meta_dbus_login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, + NULL, error); } diff --git a/src/meson.build b/src/meson.build index 459a56315..284bdf522 100644 --- a/src/meson.build +++ b/src/meson.build @@ -833,22 +833,10 @@ if have_native_backend ) mutter_built_sources += default_modes_h - gdbus_codegen = find_program('gdbus-codegen') - dbus_login1_built_sources = custom_target('meta-dbus-login1', - input: 'org.freedesktop.login1.xml', - output: [ - 'meta-dbus-login1.c', - 'meta-dbus-login1.h', - ], - command: [ - gdbus_codegen, - '--interface-prefix', 'org.freedesktop.login1', - '--c-namespace', 'Login1', - '--generate-c-code', 'meta-dbus-login1', - '--output-directory', meson.current_build_dir(), - '--c-generate-autocleanup', 'all', - '@INPUT@', - ] + dbus_login1_built_sources = gnome.gdbus_codegen('meta-dbus-login1', + 'org.freedesktop.login1.xml', + interface_prefix: 'org.freedesktop.login1.', + namespace: 'MetaDbusLogin1', ) mutter_built_sources += dbus_login1_built_sources endif