]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/session.h
Load all users only when really needed
[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 typedef enum
22 {
23     SESSION_TYPE_LOCAL,
24     SESSION_TYPE_REMOTE
25 } SessionType;
26
27 #include "session-config.h"
28 #include "display-server.h"
29 #include "accounts.h"
30 #include "x-authority.h"
31 #include "logger.h"
32 #include "log-file.h"
33 #include "greeter.h"
34
35 G_BEGIN_DECLS
36
37 #define SESSION_TYPE           (session_get_type())
38 #define SESSION(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), SESSION_TYPE, Session))
39 #define SESSION_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE, SessionClass))
40 #define SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE, SessionClass))
41
42 #define SESSION_SIGNAL_CREATE_GREETER          "create-greeter"
43 #define SESSION_SIGNAL_GOT_MESSAGES            "got-messages"
44 #define SESSION_SIGNAL_AUTHENTICATION_COMPLETE "authentication-complete"
45 #define SESSION_SIGNAL_STOPPED                 "stopped"
46
47 typedef struct SessionPrivate SessionPrivate;
48
49 struct Session
50 {
51     GObject         parent_instance;
52     SessionPrivate *priv;
53 };
54
55 typedef struct
56 {
57     GObjectClass parent_class;
58
59     gboolean (*start)(Session *session);
60     void (*run)(Session *session);
61     void (*stop)(Session *session);
62
63     Greeter *(*create_greeter)(Session *session);
64     void (*got_messages)(Session *session);
65     void (*authentication_complete)(Session *session);
66     void (*stopped)(Session *session);
67 } SessionClass;
68
69 GType session_get_type (void);
70
71 Session *session_new (void);
72
73 void session_set_config (Session *session, SessionConfig *config);
74
75 SessionConfig *session_get_config (Session *session);
76
77 const gchar *session_get_session_type (Session *session);
78
79 void session_set_pam_service (Session *session, const gchar *pam_service);
80
81 void session_set_username (Session *session, const gchar *username);
82
83 void session_set_do_authenticate (Session *session, gboolean do_authenticate);
84
85 void session_set_is_interactive (Session *session, gboolean is_interactive);
86
87 void session_set_is_guest (Session *session, gboolean is_guest);
88
89 gboolean session_get_is_guest (Session *session);
90
91 void session_set_log_file (Session *session, const gchar *filename, LogMode log_mode);
92
93 void session_set_display_server (Session *session, DisplayServer *display_server);
94
95 DisplayServer *session_get_display_server (Session *session);
96
97 void session_set_tty (Session *session, const gchar *tty);
98
99 void session_set_xdisplay (Session *session, const gchar *xdisplay);
100
101 void session_set_x_authority (Session *session, XAuthority *authority, gboolean use_system_location);
102
103 void session_set_remote_host_name (Session *session, const gchar *remote_host_name);
104
105 void session_set_env (Session *session, const gchar *name, const gchar *value);
106
107 const gchar *session_get_env (Session *session, const gchar *name);
108
109 void session_unset_env (Session *session, const gchar *name);
110
111 void session_set_argv (Session *session, gchar **argv);
112
113 // FIXME: Remove
114 User *session_get_user (Session *session);
115
116 gboolean session_start (Session *session);
117
118 gboolean session_get_is_started (Session *session);
119
120 const gchar *session_get_username (Session *session);
121
122 const gchar *session_get_login1_session_id (Session *session);
123
124 const gchar *session_get_console_kit_cookie (Session *session);
125
126 void session_respond (Session *session, struct pam_response *response);
127
128 void session_respond_error (Session *session, int error);
129
130 int session_get_messages_length (Session *session);
131
132 const struct pam_message *session_get_messages (Session *session);
133
134 gboolean session_get_is_authenticated (Session *session);
135
136 int session_get_authentication_result (Session *session);
137
138 const gchar *session_get_authentication_result_string (Session *session);
139
140 void session_run (Session *session);
141
142 gboolean session_get_is_run (Session *session);
143
144 void session_lock (Session *session);
145
146 void session_unlock (Session *session);
147
148 void session_activate (Session *session);
149
150 void session_stop (Session *session);
151
152 gboolean session_get_is_stopping (Session *session);
153
154 G_END_DECLS
155
156 #endif /* SESSION_H_ */