2 * Copyright (C) 2010-2011 Robert Ancell.
3 * Author: Robert Ancell <robert.ancell@canonical.com>
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
15 #include <glib-object.h>
17 #include <security/pam_appl.h>
19 typedef struct Session Session;
27 #include "session-config.h"
28 #include "display-server.h"
30 #include "x-authority.h"
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))
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"
47 typedef struct SessionPrivate SessionPrivate;
51 GObject parent_instance;
57 GObjectClass parent_class;
59 gboolean (*start)(Session *session);
60 void (*run)(Session *session);
61 void (*stop)(Session *session);
63 Greeter *(*create_greeter)(Session *session);
64 void (*got_messages)(Session *session);
65 void (*authentication_complete)(Session *session);
66 void (*stopped)(Session *session);
69 GType session_get_type (void);
71 Session *session_new (void);
73 void session_set_config (Session *session, SessionConfig *config);
75 SessionConfig *session_get_config (Session *session);
77 const gchar *session_get_session_type (Session *session);
79 void session_set_pam_service (Session *session, const gchar *pam_service);
81 void session_set_username (Session *session, const gchar *username);
83 void session_set_do_authenticate (Session *session, gboolean do_authenticate);
85 void session_set_is_interactive (Session *session, gboolean is_interactive);
87 void session_set_is_guest (Session *session, gboolean is_guest);
89 gboolean session_get_is_guest (Session *session);
91 void session_set_log_file (Session *session, const gchar *filename, LogMode log_mode);
93 void session_set_display_server (Session *session, DisplayServer *display_server);
95 DisplayServer *session_get_display_server (Session *session);
97 void session_set_tty (Session *session, const gchar *tty);
99 void session_set_xdisplay (Session *session, const gchar *xdisplay);
101 void session_set_x_authority (Session *session, XAuthority *authority, gboolean use_system_location);
103 void session_set_remote_host_name (Session *session, const gchar *remote_host_name);
105 void session_set_env (Session *session, const gchar *name, const gchar *value);
107 const gchar *session_get_env (Session *session, const gchar *name);
109 void session_unset_env (Session *session, const gchar *name);
111 void session_set_argv (Session *session, gchar **argv);
114 User *session_get_user (Session *session);
116 gboolean session_start (Session *session);
118 gboolean session_get_is_started (Session *session);
120 const gchar *session_get_username (Session *session);
122 const gchar *session_get_login1_session_id (Session *session);
124 const gchar *session_get_console_kit_cookie (Session *session);
126 void session_respond (Session *session, struct pam_response *response);
128 void session_respond_error (Session *session, int error);
130 int session_get_messages_length (Session *session);
132 const struct pam_message *session_get_messages (Session *session);
134 gboolean session_get_is_authenticated (Session *session);
136 int session_get_authentication_result (Session *session);
138 const gchar *session_get_authentication_result_string (Session *session);
140 void session_run (Session *session);
142 gboolean session_get_is_run (Session *session);
144 void session_lock (Session *session);
146 void session_unlock (Session *session);
148 void session_activate (Session *session);
150 void session_stop (Session *session);
152 gboolean session_get_is_stopping (Session *session);
156 #endif /* SESSION_H_ */