launcher: Fix indentation and rename variable which is no longer local

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4022>
This commit is contained in:
Sebastian Wick 2024-11-12 19:47:05 +01:00
parent 2bdd17650f
commit 35c45c24ce

View File

@ -287,27 +287,27 @@ get_session_proxy_from_display (GCancellable *cancellable,
{ "wayland", "x11", "mir", NULL }; { "wayland", "x11", "mir", NULL };
const char * const active_states[] = const char * const active_states[] =
{ "active", "online", NULL }; { "active", "online", NULL };
g_autofree char *local_session_id = NULL; g_autofree char *session_id = NULL;
g_autofree char *type = NULL; g_autofree char *type = NULL;
g_autofree char *state = NULL; g_autofree char *state = NULL;
int saved_errno; int saved_errno;
g_assert (error == NULL || *error == NULL); g_assert (error == NULL || *error == NULL);
local_session_id = get_display_session (error); session_id = get_display_session (error);
if (!local_session_id) if (!session_id)
return NULL; return NULL;
/* sd_uid_get_display will return any session if there is no graphical /* sd_uid_get_display will return any session if there is no graphical
* one, so let's check it really is graphical. */ * one, so let's check it really is graphical. */
saved_errno = sd_session_get_type (local_session_id, &type); saved_errno = sd_session_get_type (session_id, &type);
if (saved_errno < 0) if (saved_errno < 0)
{ {
g_set_error (error, g_set_error (error,
G_IO_ERROR, G_IO_ERROR,
G_IO_ERROR_NOT_FOUND, G_IO_ERROR_NOT_FOUND,
"Couldn't get type for session '%s': %s", "Couldn't get type for session '%s': %s",
local_session_id, session_id,
g_strerror (-saved_errno)); g_strerror (-saved_errno));
return NULL; return NULL;
} }
@ -318,36 +318,36 @@ get_session_proxy_from_display (GCancellable *cancellable,
G_IO_ERROR, G_IO_ERROR,
G_IO_ERROR_NOT_FOUND, G_IO_ERROR_NOT_FOUND,
"Session '%s' is not a graphical session (type: '%s')", "Session '%s' is not a graphical session (type: '%s')",
local_session_id, session_id,
type); type);
return NULL; return NULL;
} }
/* and display sessions can be 'closing' if they are logged out but /* and display sessions can be 'closing' if they are logged out but
* some processes are lingering; we shouldn't consider these */ * some processes are lingering; we shouldn't consider these */
saved_errno = sd_session_get_state (local_session_id, &state); saved_errno = sd_session_get_state (session_id, &state);
if (saved_errno < 0) if (saved_errno < 0)
{ {
g_set_error (error, g_set_error (error,
G_IO_ERROR, G_IO_ERROR,
G_IO_ERROR_NOT_FOUND, G_IO_ERROR_NOT_FOUND,
"Couldn't get state for session '%s': %s", "Couldn't get state for session '%s': %s",
local_session_id, session_id,
g_strerror (-saved_errno)); g_strerror (-saved_errno));
return NULL; return NULL;
} }
if (!g_strv_contains (active_states, state)) if (!g_strv_contains (active_states, state))
{ {
g_set_error (error, g_set_error (error,
G_IO_ERROR, G_IO_ERROR,
G_IO_ERROR_NOT_FOUND, G_IO_ERROR_NOT_FOUND,
"Session '%s' is not active", "Session '%s' is not active",
local_session_id); session_id);
return NULL; return NULL;
} }
return get_session_proxy_from_id (local_session_id, cancellable, error); return get_session_proxy_from_id (session_id, cancellable, error);
} }
static MetaDBusLogin1Session * static MetaDBusLogin1Session *