annotate src/libeggsmclient/eggsmclient.h @ 4608:23a9ded30c70

Use str_assert_utf8() where it makes sense in the core.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 04 Jun 2008 23:30:29 +0300
parents c942eaef7bc6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4315
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
1 /* eggsmclient.h
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
2 * Copyright (C) 2007 Novell, Inc.
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
3 *
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
8 *
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
12 * Lesser General Public License for more details.
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
13 *
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
15 * License along with this library; if not, write to the
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
17 * Boston, MA 02111-1307, USA.
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
18 */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
19
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
20 #ifndef __EGG_SM_CLIENT_H__
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
21 #define __EGG_SM_CLIENT_H__
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
22
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
23 #include <glib-object.h>
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
24
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
25 G_BEGIN_DECLS
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
26
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
27 #define EGG_TYPE_SM_CLIENT (egg_sm_client_get_type ())
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
28 #define EGG_SM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT, EggSMClient))
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
29 #define EGG_SM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT, EggSMClientClass))
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
30 #define EGG_IS_SM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT))
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
31 #define EGG_IS_SM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT))
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
32 #define EGG_SM_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT, EggSMClientClass))
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
33
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
34 typedef struct _EggSMClient EggSMClient;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
35 typedef struct _EggSMClientClass EggSMClientClass;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
36 typedef struct _EggSMClientPrivate EggSMClientPrivate;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
37
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
38 typedef enum {
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
39 EGG_SM_CLIENT_END_SESSION_DEFAULT,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
40 EGG_SM_CLIENT_LOGOUT,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
41 EGG_SM_CLIENT_REBOOT,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
42 EGG_SM_CLIENT_SHUTDOWN
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
43 } EggSMClientEndStyle;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
44
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
45 typedef enum {
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
46 EGG_SM_CLIENT_MODE_DISABLED,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
47 EGG_SM_CLIENT_MODE_NO_RESTART,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
48 EGG_SM_CLIENT_MODE_NORMAL
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
49 } EggSMClientMode;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
50
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
51 struct _EggSMClient
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
52 {
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
53 GObject parent;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
54
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
55 };
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
56
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
57 struct _EggSMClientClass
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
58 {
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
59 GObjectClass parent_class;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
60
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
61 /* signals */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
62 void (*save_state) (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
63 GKeyFile *state_file);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
64
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
65 void (*quit_requested) (EggSMClient *client);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
66 void (*quit_cancelled) (EggSMClient *client);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
67 void (*quit) (EggSMClient *client);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
68
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
69 /* virtual methods */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
70 void (*startup) (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
71 const char *client_id);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
72 void (*set_restart_command) (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
73 int argc,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
74 const char **argv);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
75 void (*will_quit) (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
76 gboolean will_quit);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
77 gboolean (*end_session) (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
78 EggSMClientEndStyle style,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
79 gboolean request_confirmation);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
80
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
81 /* Padding for future expansion */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
82 void (*_egg_reserved1) (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
83 void (*_egg_reserved2) (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
84 void (*_egg_reserved3) (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
85 void (*_egg_reserved4) (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
86 };
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
87
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
88 GType egg_sm_client_get_type (void) G_GNUC_CONST;
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
89
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
90 GOptionGroup *egg_sm_client_get_option_group (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
91
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
92 /* Initialization */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
93 void egg_sm_client_set_mode (EggSMClientMode mode);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
94 EggSMClientMode egg_sm_client_get_mode (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
95 EggSMClient *egg_sm_client_get (void);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
96
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
97 /* Resuming a saved session */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
98 gboolean egg_sm_client_is_resumed (EggSMClient *client);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
99 GKeyFile *egg_sm_client_get_state_file (EggSMClient *client);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
100
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
101 /* Alternate means of saving state */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
102 void egg_sm_client_set_restart_command (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
103 int argc,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
104 const char **argv);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
105
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
106 /* Handling "quit_requested" signal */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
107 void egg_sm_client_will_quit (EggSMClient *client,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
108 gboolean will_quit);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
109
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
110 /* Initiate a logout/reboot/shutdown */
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
111 gboolean egg_sm_client_end_session (EggSMClientEndStyle style,
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
112 gboolean request_confirmation);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
113
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
114 G_END_DECLS
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
115
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
116
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff changeset
117 #endif /* __EGG_SM_CLIENT_H__ */