zsh: update to 5.7.1 & native build
[unleashed-userland.git] / components / ConsoleKit / patches / 19-listsessions.patch
blob89392f7304afa25a53ec9b7fc0e054aef782f0ba
1 diff --git a/tools/list-sessions.c.orig b/tools/list-sessions.c
2 index cc69d57..be35ecf 100644
3 --- a/tools/list-sessions.c.orig
4 +++ b/tools/list-sessions.c
5 @@ -56,8 +56,10 @@ typedef struct CkSessionOutput {
6 static gboolean do_all = FALSE;
7 static gboolean do_version = FALSE;
8 static char *do_format = NULL;
9 +static char *session_id = NULL;
10 static GOptionEntry entries [] = {
11 { "all", 'a', 0, G_OPTION_ARG_NONE, &do_all, N_("List all sessions. If not given, only list open sessions"), NULL },
12 + { "sid", 's', 0, G_OPTION_ARG_STRING, &session_id, N_("List one sessions."), NULL },
13 { "format", 'f', 0, G_OPTION_ARG_STRING, &do_format, N_("Prints information according to the given format"), NULL },
14 { "version", 'V', 0, G_OPTION_ARG_NONE, &do_version, N_("Version of this application"), NULL },
15 { NULL }
16 @@ -242,7 +244,7 @@ list_session (DBusGConnection *connection,
17 get_string (proxy, "GetCreationTime", &creation_time);
18 get_string (proxy, "GetIdleSinceHint", &idle_since_hint);
20 - if (!do_all && !is_open) {
21 + if (!do_all && !is_open && !session_id) {
22 return;
25 @@ -352,11 +354,23 @@ list_sessions (DBusGConnection *connection,
28 for (i = 0; i < sessions->len; i++) {
29 - char *ssid;
30 + char *ssid;
31 + gboolean do_it = TRUE;
33 ssid = g_ptr_array_index (sessions, i);
35 - list_session (connection, ssid);
36 + if (session_id) {
37 + do_it = FALSE;
39 + if (!g_strcmp0(session_id, ssid))
40 + do_it = TRUE;
42 + else if (!g_strcmp0(session_id, g_basename(ssid)))
43 + do_it = TRUE;
44 + }
46 + if (do_it)
47 + list_session (connection, ssid);
49 g_free (ssid);