Modify error handling logic
[platform/core/system/tlm.git] / src / daemon / tlm-seat.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of tlm (Tiny Login Manager)
5  *
6  * Copyright (C) 2013-2014 Intel Corporation.
7  *
8  * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
9  *          Jussi Laako <jussi.laako@linux.intel.com>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24  * 02110-1301 USA
25  */
26
27 #ifndef _TLM_SEAT_H
28 #define _TLM_SEAT_H
29
30 #include <glib-object.h>
31 #include <tlm-config.h>
32 #include "tlm-types.h"
33
34 G_BEGIN_DECLS
35
36 #define TLM_TYPE_SEAT       (tlm_seat_get_type())
37 #define TLM_SEAT(obj)       (G_TYPE_CHECK_INSTANCE_CAST((obj), \
38                               TLM_TYPE_SEAT, TlmSeat))
39 #define TLM_IS_SEAT(obj)    (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
40                              TLM_TYPE_SEAT))
41 #define TLM_SEAT_CLASS(kls) (G_TYPE_CHECK_CLASS_CAST((kls), \
42                              TLM_TYPE_SEAT))
43 #define TLM_SEAT_IS_CLASS(kls)  (G_TYPE_CHECK_CLASS_TYPE((kls), \
44                                  TLM_TYPE_SEAT))
45
46 typedef struct _TlmSeatPrivate TlmSeatPrivate;
47
48 struct _TlmSeat
49 {
50     GObject parent;
51     /* Private */
52     TlmSeatPrivate *priv;
53 };
54
55 struct _TlmSeatClass
56 {
57     GObjectClass parent_class;
58 };
59
60 GType tlm_seat_get_type(void);
61
62 TlmSeat *
63 tlm_seat_new (TlmConfig *config,
64               const gchar *id,
65               const gchar *path);
66
67 const gchar *
68 tlm_seat_get_id (TlmSeat *seat);
69
70 /** Get the username who occupies the seat
71  * @return  The name of the user who holds the seat (to be freed)
72  * @return  NULL if nobody occupies the seat
73  */
74 gchar *
75 tlm_seat_get_occupying_username (TlmSeat* seat);
76
77 gboolean
78 tlm_seat_switch_user (TlmSeat *seat,
79                       const gchar *service,
80                       const gchar *username,
81                       const gchar *password,
82                       GHashTable *environment);
83
84 gboolean
85 tlm_seat_create_session (TlmSeat *seat,
86                          const gchar *service,
87                          const gchar *username,
88                          const gchar *password,
89                          GHashTable *environment);
90
91 gboolean
92 tlm_seat_terminate_session (TlmSeat *seat, gboolean stop);
93
94 G_END_DECLS
95
96 #endif /* _TLM_SEAT_H */