From a08530e838218b3c5859550058e78b8f1abee434 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 25 Oct 2006 14:38:19 -0400 Subject: Initial import --- src/ck-session.h | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/ck-session.h (limited to 'src/ck-session.h') diff --git a/src/ck-session.h b/src/ck-session.h new file mode 100644 index 0000000..761edc9 --- /dev/null +++ b/src/ck-session.h @@ -0,0 +1,156 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2006 William Jon McCann + * + * 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 +#include + +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 +{ + GObject parent; + CkSessionPrivate *priv; +} CkSession; + +typedef struct +{ + GObjectClass parent_class; + + /* internal signals */ + void (* activate) (CkSession *session, + DBusGMethodInvocation *context); + + /* exported signals */ + void (* lock) (CkSession *session); + void (* unlock) (CkSession *session); + void (* active_changed) (CkSession *session, + gboolean active); +} CkSessionClass; + +typedef enum +{ + CK_SESSION_ERROR_GENERAL +} CkSessionError; + +#define CK_SESSION_ERROR ck_session_error_quark () + +GQuark ck_session_error_quark (void); +GType ck_session_get_type (void); +CkSession * ck_session_new (const char *ssid, + const char *cookie); +CkSession * ck_session_new_with_parameters (const char *ssid, + const char *cookie, + const GPtrArray *parameters); + +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_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_user (CkSession *session, + guint uid, + GError **error); +gboolean ck_session_set_x11_display (CkSession *session, + const char *xdisplay, + GError **error); +gboolean ck_session_set_display_device (CkSession *session, + const char *device, + GError **error); +gboolean ck_session_set_host_name (CkSession *session, + const char *host_name, + GError **error); +gboolean ck_session_set_session_type (CkSession *session, + const char *type, + GError **error); + +/* Exported methods */ + +/* 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_user (CkSession *session, + guint *uid, + GError **error); +gboolean ck_session_get_x11_display (CkSession *session, + char **display, + GError **error); +gboolean ck_session_get_display_device (CkSession *session, + char **display, + GError **error); +gboolean ck_session_get_session_type (CkSession *session, + char **type, + GError **error); +gboolean ck_session_get_host_name (CkSession *session, + char **host_name, + GError **error); + +/* Non-authoritative properties */ +gboolean ck_session_get_idle (CkSession *session, + gboolean *idle, + GError **error); +gboolean ck_session_set_idle (CkSession *session, + gboolean idle, + GError **error); + +/* Privileged actions */ +gboolean ck_session_activate (CkSession *session, + DBusGMethodInvocation *context); +gboolean ck_session_lock (CkSession *session, + DBusGMethodInvocation *context); +gboolean ck_session_unlock (CkSession *session, + DBusGMethodInvocation *context); + + +G_END_DECLS + +#endif /* __CK_SESSION_H */ -- cgit