1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- 2 * 3 * Copyright (C) 2006 William Jon McCann <mccann@jhu.edu> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 */ 20 21 22 #ifndef __CK_SESSION_H 23 #define __CK_SESSION_H 24 25 #include <glib-object.h> 26 #include "ck-session-generated.h" 27 28 G_BEGIN_DECLS 29 30 #define CK_TYPE_SESSION (ck_session_get_type ()) 31 #define CK_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CK_TYPE_SESSION, CkSession)) 32 #define CK_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CK_TYPE_SESSION, CkSessionClass)) 33 #define CK_IS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CK_TYPE_SESSION)) 34 #define CK_IS_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CK_TYPE_SESSION)) 35 #define CK_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CK_TYPE_SESSION, CkSessionClass)) 36 37 typedef struct CkSessionPrivate CkSessionPrivate; 38 39 typedef struct 40 { 41 ConsoleKitSessionSkeleton parent; 42 CkSessionPrivate *priv; 43 } CkSession; 44 45 typedef struct 46 { 47 /* internal signals */ 48 void (* activate) (CkSession *session, 49 GDBusMethodInvocation *context); 50 51 ConsoleKitSessionSkeletonClass parent_class; 52 } CkSessionClass; 53 54 typedef enum 55 { 56 CK_SESSION_ERROR_FAILED, 57 CK_SESSION_ERROR_GENERAL, 58 CK_SESSION_ERROR_INSUFFICIENT_PERMISSION, 59 CK_SESSION_ERROR_NOT_SUPPORTED, 60 CK_SESSION_ERROR_ALREADY_ACTIVE, 61 CK_SESSION_NUM_ERRORS 62 } CkSessionError; 63 64 #define CK_SESSION_ERROR ck_session_error_quark () 65 66 67 GQuark ck_session_error_quark (void); 68 GType ck_session_error_get_type (void); 69 GType ck_session_get_type (void); 70 71 CkSession * ck_session_new (const char *ssid, 72 const char *cookie, 73 GDBusConnection *connection); 74 CkSession * ck_session_new_with_parameters (const char *ssid, 75 const char *cookie, 76 const GVariant *parameters, 77 GDBusConnection *connection); 78 79 void ck_session_dump (CkSession *session, 80 GKeyFile *key_file); 81 void ck_session_run_programs (CkSession *session, 82 const char *action); 83 84 gboolean ck_session_set_active (CkSession *session, 85 gboolean active, 86 gboolean force); 87 gboolean ck_session_set_is_local (CkSession *session, 88 gboolean is_local, 89 GError **error); 90 gboolean ck_session_set_unix_user (CkSession *session, 91 guint uid, 92 GError **error); 93 gboolean ck_session_set_x11_display (CkSession *session, 94 const char *xdisplay, 95 GError **error); 96 gboolean ck_session_set_x11_display_device (CkSession *session, 97 const char *xdisplay, 98 GError **error); 99 gboolean ck_session_set_display_device (CkSession *session, 100 const char *device, 101 GError **error); 102 gboolean ck_session_set_remote_host_name (CkSession *session, 103 const char *remote_host_name, 104 GError **error); 105 gboolean ck_session_set_session_type (CkSession *session, 106 const char *type, 107 GError **error); 108 void ck_session_set_session_controller (CkSession *session, 109 const gchar *bus_name); 110 111 /* Authoritative properties */ 112 gboolean ck_session_get_id (CkSession *session, 113 char **ssid, 114 GError **error); 115 gboolean ck_session_get_seat_id (CkSession *session, 116 char **sid, 117 GError **error); 118 gboolean ck_session_is_active (CkSession *session, 119 gboolean *active, 120 GError **error); 121 gboolean ck_session_is_local (CkSession *session, 122 gboolean *local, 123 GError **error); 124 gboolean ck_session_get_login_session_id (CkSession *session, 125 char **login_session_id, 126 GError **error); 127 gboolean ck_session_get_creation_time (CkSession *session, 128 char **iso8601_datetime, 129 GError **error); 130 const char * ck_session_get_runtime_dir (CkSession *session); 131 132 133 gboolean ck_session_set_runtime_dir (CkSession *session, 134 const char *runtime_dir); 135 136 gboolean ck_session_set_id (CkSession *session, 137 const char *ssid, 138 GError **error); 139 gboolean ck_session_set_cookie (CkSession *session, 140 const char *cookie, 141 GError **error); 142 gboolean ck_session_set_seat_id (CkSession *session, 143 const char *sid, 144 GError **error); 145 gboolean ck_session_set_login_session_id (CkSession *session, 146 const char *login_session_id, 147 GError **error); 148 149 void ck_session_lock (CkSession *session); 150 void ck_session_unlock (CkSession *session); 151 152 G_END_DECLS 153 154 #endif /* __CK_SESSION_H */ 155