summaryrefslogtreecommitdiff
path: root/src/ck-session.h
blob: d9b35cd1787dc5865be6641fdcee6b476c1bef91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2006 William Jon McCann <mccann@jhu.edu>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */


#ifndef __CK_SESSION_H
#define __CK_SESSION_H

#include <glib-object.h>
#include "ck-session-generated.h"

G_BEGIN_DECLS

#define CK_TYPE_SESSION         (ck_session_get_type ())
#define CK_SESSION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CK_TYPE_SESSION, CkSession))
#define CK_SESSION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), CK_TYPE_SESSION, CkSessionClass))
#define CK_IS_SESSION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), CK_TYPE_SESSION))
#define CK_IS_SESSION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CK_TYPE_SESSION))
#define CK_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CK_TYPE_SESSION, CkSessionClass))

typedef struct CkSessionPrivate CkSessionPrivate;

typedef struct
{
        ConsoleKitSessionSkeleton  parent;
        CkSessionPrivate  *priv;
} CkSession;

typedef struct
{
        /* internal signals */
        void          (* activate)          (CkSession             *session,
                                             GDBusMethodInvocation *context);

        ConsoleKitSessionSkeletonClass parent_class;
} CkSessionClass;

typedef enum
{
        CK_SESSION_ERROR_FAILED,
        CK_SESSION_ERROR_GENERAL,
        CK_SESSION_ERROR_INSUFFICIENT_PERMISSION,
        CK_SESSION_ERROR_NOT_SUPPORTED,
        CK_SESSION_ERROR_ALREADY_ACTIVE,
        CK_SESSION_NUM_ERRORS
} CkSessionError;

#define CK_SESSION_ERROR ck_session_error_quark ()


GQuark              ck_session_error_quark            (void);
GType               ck_session_error_get_type         (void);
GType               ck_session_get_type               (void);

CkSession         * ck_session_new                    (const char            *ssid,
                                                       const char            *cookie,
                                                       GDBusConnection       *connection);
CkSession         * ck_session_new_with_parameters    (const char            *ssid,
                                                       const char            *cookie,
                                                       const GVariant        *parameters,
                                                       GDBusConnection       *connection);

void                ck_session_dump                   (CkSession             *session,
                                                       GKeyFile              *key_file);
void                ck_session_run_programs           (CkSession             *session,
                                                       const char            *action);

gboolean            ck_session_set_active             (CkSession             *session,
                                                       gboolean               active,
                                                       GError               **error);
gboolean            ck_session_set_is_local           (CkSession             *session,
                                                       gboolean               is_local,
                                                       GError               **error);
gboolean            ck_session_set_unix_user          (CkSession             *session,
                                                       guint                  uid,
                                                       GError               **error);
gboolean            ck_session_set_x11_display        (CkSession             *session,
                                                       const char            *xdisplay,
                                                       GError               **error);
gboolean            ck_session_set_x11_display_device (CkSession             *session,
                                                       const char            *xdisplay,
                                                       GError               **error);
gboolean            ck_session_set_display_device     (CkSession             *session,
                                                       const char            *device,
                                                       GError               **error);
gboolean            ck_session_set_remote_host_name   (CkSession             *session,
                                                       const char            *remote_host_name,
                                                       GError               **error);
gboolean            ck_session_set_session_type       (CkSession             *session,
                                                       const char            *type,
                                                       GError               **error);

/* Authoritative properties */
gboolean            ck_session_get_id                 (CkSession             *session,
                                                       char                 **ssid,
                                                       GError               **error);
gboolean            ck_session_get_seat_id            (CkSession             *session,
                                                       char                 **sid,
                                                       GError               **error);
gboolean            ck_session_is_active              (CkSession             *session,
                                                       gboolean              *active,
                                                       GError               **error);
gboolean            ck_session_is_local               (CkSession             *session,
                                                       gboolean              *local,
                                                       GError               **error);
gboolean            ck_session_get_login_session_id   (CkSession             *session,
                                                       char                 **login_session_id,
                                                       GError               **error);
gboolean            ck_session_get_creation_time      (CkSession             *session,
                                                       char                 **iso8601_datetime,
                                                       GError               **error);


gboolean            ck_session_set_id                 (CkSession             *session,
                                                       const char            *ssid,
                                                       GError               **error);
gboolean            ck_session_set_cookie             (CkSession             *session,
                                                       const char            *cookie,
                                                       GError               **error);
gboolean            ck_session_set_seat_id            (CkSession             *session,
                                                       const char            *sid,
                                                       GError               **error);
gboolean            ck_session_set_login_session_id   (CkSession             *session,
                                                       const char            *login_session_id,
                                                       GError               **error);


G_END_DECLS

#endif /* __CK_SESSION_H */