dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
Blob Blame History Raw
From bfd6d8a322414a7ebd1a64a717c1834e6cb00d7d Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Mon, 29 Sep 2014 15:36:20 +0200
Subject: [PATCH] terminal: add helper to retrieve the seat of a session

Allow sysview users to retrieve the seat that a session is assigned to.
---
 src/libsystemd-terminal/sysview.c | 6 ++++++
 src/libsystemd-terminal/sysview.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index 919fadf6fe..70a6ca726c 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -267,6 +267,12 @@ const char *sysview_session_get_name(sysview_session *session) {
         return session->name;
 }
 
+sysview_seat *sysview_session_get_seat(sysview_session *session) {
+        assert_return(session, NULL);
+
+        return session->seat;
+}
+
 static int session_take_control_fn(sd_bus *bus,
                                    sd_bus_message *reply,
                                    void *userdata,
diff --git a/src/libsystemd-terminal/sysview.h b/src/libsystemd-terminal/sysview.h
index 31b800f698..cad603d59f 100644
--- a/src/libsystemd-terminal/sysview.h
+++ b/src/libsystemd-terminal/sysview.h
@@ -128,6 +128,7 @@ void sysview_session_set_userdata(sysview_session *session, void *userdata);
 void *sysview_session_get_userdata(sysview_session *session);
 
 const char *sysview_session_get_name(sysview_session *session);
+sysview_seat *sysview_session_get_seat(sysview_session *session);
 
 int sysview_session_take_control(sysview_session *session);
 void sysview_session_release_control(sysview_session *session);