summaryrefslogtreecommitdiff
path: root/src/ck-session-leader.h
blob: ff1764414b52be17fe6fd197edd1961d4838516f (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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2006-2007 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_LEADER_H
#define __CK_SESSION_LEADER_H

#include <glib-object.h>
#include <dbus/dbus-glib.h>

G_BEGIN_DECLS

#define CK_TYPE_SESSION_LEADER         (ck_session_leader_get_type ())
#define CK_SESSION_LEADER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CK_TYPE_SESSION_LEADER, CkSessionLeader))
#define CK_SESSION_LEADER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), CK_TYPE_SESSION_LEADER, CkSessionLeaderClass))
#define CK_IS_SESSION_LEADER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), CK_TYPE_SESSION_LEADER))
#define CK_IS_SESSION_LEADER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CK_TYPE_SESSION_LEADER))
#define CK_SESSION_LEADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CK_TYPE_SESSION_LEADER, CkSessionLeaderClass))

typedef struct CkSessionLeaderPrivate CkSessionLeaderPrivate;

typedef struct
{
        GObject                 parent;
        CkSessionLeaderPrivate *priv;
} CkSessionLeader;

typedef struct
{
        GObjectClass   parent_class;

} CkSessionLeaderClass;

typedef enum
{
         CK_SESSION_LEADER_ERROR_GENERAL
} CkSessionLeaderError;

#define CK_SESSION_LEADER_ERROR ck_session_leader_error_quark ()

typedef void  (* CkSessionLeaderDoneFunc) (CkSessionLeader       *session_leader,
                                           GPtrArray             *parameters,
                                           DBusGMethodInvocation *context,
                                           gpointer               data);

GQuark              ck_session_leader_error_quark             (void);
GType               ck_session_leader_get_type                (void);
CkSessionLeader   * ck_session_leader_new                     (void);

void                ck_session_leader_set_pid                 (CkSessionLeader        *session_leader,
                                                               pid_t                   pid);
void                ck_session_leader_set_uid                 (CkSessionLeader        *session_leader,
                                                               uid_t                   uid);
void                ck_session_leader_set_session_id          (CkSessionLeader        *session_leader,
                                                               const char             *session_id);
void                ck_session_leader_set_cookie              (CkSessionLeader        *session_leader,
                                                               const char             *cookie);
void                ck_session_leader_set_service_name        (CkSessionLeader        *session_leader,
                                                               const char             *sender);

void                ck_session_leader_set_override_parameters (CkSessionLeader       *session_leader,
                                                               const GPtrArray       *parameters);

const char *        ck_session_leader_peek_session_id         (CkSessionLeader        *session_leader);
const char *        ck_session_leader_peek_cookie             (CkSessionLeader        *session_leader);
const char *        ck_session_leader_peek_service_name       (CkSessionLeader        *session_leader);
uid_t               ck_session_leader_get_uid                 (CkSessionLeader        *session_leader);
pid_t               ck_session_leader_get_pid                 (CkSessionLeader        *session_leader);


gboolean            ck_session_leader_collect_parameters      (CkSessionLeader        *session_leader,
                                                               DBusGMethodInvocation  *context,
                                                               CkSessionLeaderDoneFunc done_cb,
                                                               gpointer                data);
void                ck_session_leader_cancel                  (CkSessionLeader        *session_leader);

void                ck_session_leader_dump                    (CkSessionLeader         *session_leader,
                                                               GKeyFile                *key_file);


G_END_DECLS

#endif /* __CK_SESSION_LEADER_H */