]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/session.h
Merge from trunk
[sojka/lightdm.git] / src / session.h
1 /*
2  * Copyright (C) 2010-2011 Robert Ancell.
3  * Author: Robert Ancell <robert.ancell@canonical.com>
4  * 
5  * This program is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9  * license.
10  */
11
12 #ifndef SESSION_H_
13 #define SESSION_H_
14
15 #include <glib-object.h>
16
17 #include <security/pam_appl.h>
18
19 typedef struct Session Session;
20
21 #include "display-server.h"
22 #include "accounts.h"
23 #include "x-authority.h"
24
25 G_BEGIN_DECLS
26
27 #define SESSION_TYPE           (session_get_type())
28 #define SESSION(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), SESSION_TYPE, Session))
29 #define SESSION_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE, SessionClass))
30 #define SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE, SessionClass))
31
32 typedef struct SessionPrivate SessionPrivate;
33
34 struct Session
35 {
36     GObject         parent_instance;
37     SessionPrivate *priv;
38 };
39
40 typedef struct
41 {
42     GObjectClass parent_class;
43
44     gboolean (*start)(Session *session);
45     void (*run)(Session *session);
46     void (*stop)(Session *session);
47
48     void (*got_messages)(Session *session);
49     void (*authentication_complete)(Session *session);
50     void (*stopped)(Session *session);
51 } SessionClass;
52
53 typedef enum
54 {
55     SESSION_TYPE_LOCAL,
56     SESSION_TYPE_REMOTE
57 } SessionType;
58
59 #define XDG_SESSION_CLASS_USER        "user"
60 #define XDG_SESSION_CLASS_GREETER     "greeter"
61 #define XDG_SESSION_CLASS_LOCK_SCREEN "lock-screen"
62
63 GType session_get_type (void);
64
65 Session *session_new (void);
66
67 void session_set_session_type (Session *session, const gchar *session_type);
68
69 const gchar *session_get_session_type (Session *session);
70
71 void session_set_pam_service (Session *session, const gchar *pam_service);
72
73 void session_set_username (Session *session, const gchar *username);
74
75 void session_set_do_authenticate (Session *session, gboolean do_authenticate);
76
77 void session_set_is_interactive (Session *session, gboolean is_interactive);
78
79 void session_set_is_guest (Session *session, gboolean is_guest);
80
81 gboolean session_get_is_guest (Session *session);
82
83 void session_set_log_file (Session *session, const gchar *filename);
84
85 void session_set_class (Session *session, const gchar *class);
86
87 void session_set_display_server (Session *session, DisplayServer *display_server);
88
89 DisplayServer *session_get_display_server (Session *session);
90
91 void session_set_tty (Session *session, const gchar *tty);
92
93 void session_set_xdisplay (Session *session, const gchar *xdisplay);
94
95 void session_set_x_authority (Session *session, XAuthority *authority, gboolean use_system_location);
96
97 void session_set_remote_host_name (Session *session, const gchar *remote_host_name);
98
99 void session_set_env (Session *session, const gchar *name, const gchar *value);
100
101 void session_unset_env (Session *session, const gchar *name);
102
103 void session_set_argv (Session *session, gchar **argv);
104
105 // FIXME: Remove
106 User *session_get_user (Session *session);
107
108 gboolean session_start (Session *session);
109
110 gboolean session_get_is_started (Session *session);
111
112 const gchar *session_get_username (Session *session);
113
114 const gchar *session_get_console_kit_cookie (Session *session);
115
116 void session_respond (Session *session, struct pam_response *response);
117
118 void session_respond_error (Session *session, int error);
119
120 int session_get_messages_length (Session *session);
121
122 const struct pam_message *session_get_messages (Session *session);
123
124 gboolean session_get_is_authenticated (Session *session);
125
126 int session_get_authentication_result (Session *session);
127
128 const gchar *session_get_authentication_result_string (Session *session);
129
130 void session_run (Session *session);
131
132 void session_lock (Session *session);
133
134 void session_unlock (Session *session);
135
136 void session_stop (Session *session);
137
138 gboolean session_get_is_stopping (Session *session);
139
140 G_END_DECLS
141
142 #endif /* SESSION_H_ */