Try something2
[gmpc.git] / src / smclient / eggsmclient.h
blobe620b754a3668218efb0a1dcf031bc9f9168bcc8
1 /* eggsmclient.h
2 * Copyright (C) 2007 Novell, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __EGG_SM_CLIENT_H__
21 #define __EGG_SM_CLIENT_H__
23 #include <glib-object.h>
25 G_BEGIN_DECLS
27 #define EGG_TYPE_SM_CLIENT (egg_sm_client_get_type ())
28 #define EGG_SM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT, EggSMClient))
29 #define EGG_SM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT, EggSMClientClass))
30 #define EGG_IS_SM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT))
31 #define EGG_IS_SM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT))
32 #define EGG_SM_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT, EggSMClientClass))
34 typedef struct _EggSMClient EggSMClient;
35 typedef struct _EggSMClientClass EggSMClientClass;
36 typedef struct _EggSMClientPrivate EggSMClientPrivate;
38 typedef enum {
39 EGG_SM_CLIENT_END_SESSION_DEFAULT,
40 EGG_SM_CLIENT_LOGOUT,
41 EGG_SM_CLIENT_REBOOT,
42 EGG_SM_CLIENT_SHUTDOWN
43 } EggSMClientEndStyle;
45 typedef enum {
46 EGG_SM_CLIENT_MODE_DISABLED,
47 EGG_SM_CLIENT_MODE_NO_RESTART,
48 EGG_SM_CLIENT_MODE_NORMAL
49 } EggSMClientMode;
51 struct _EggSMClient
53 GObject parent;
57 struct _EggSMClientClass
59 GObjectClass parent_class;
61 /* signals */
62 void (*save_state) (EggSMClient *client,
63 GKeyFile *state_file);
65 void (*quit_requested) (EggSMClient *client);
66 void (*quit_cancelled) (EggSMClient *client);
67 void (*quit) (EggSMClient *client);
69 /* virtual methods */
70 void (*startup) (EggSMClient *client,
71 const char *client_id);
72 void (*set_restart_command) (EggSMClient *client,
73 int argc,
74 const char **argv);
75 void (*will_quit) (EggSMClient *client,
76 gboolean will_quit);
77 gboolean (*end_session) (EggSMClient *client,
78 EggSMClientEndStyle style,
79 gboolean request_confirmation);
81 /* Padding for future expansion */
82 void (*_egg_reserved1) (void);
83 void (*_egg_reserved2) (void);
84 void (*_egg_reserved3) (void);
85 void (*_egg_reserved4) (void);
88 GType egg_sm_client_get_type (void) G_GNUC_CONST;
90 GOptionGroup *egg_sm_client_get_option_group (void);
92 /* Initialization */
93 void egg_sm_client_set_mode (EggSMClientMode mode);
94 EggSMClientMode egg_sm_client_get_mode (void);
95 EggSMClient *egg_sm_client_get (void);
97 /* Resuming a saved session */
98 gboolean egg_sm_client_is_resumed (EggSMClient *client);
99 GKeyFile *egg_sm_client_get_state_file (EggSMClient *client);
101 /* Alternate means of saving state */
102 void egg_sm_client_set_restart_command (EggSMClient *client,
103 int argc,
104 const char **argv);
106 /* Handling "quit_requested" signal */
107 void egg_sm_client_will_quit (EggSMClient *client,
108 gboolean will_quit);
110 /* Initiate a logout/reboot/shutdown */
111 gboolean egg_sm_client_end_session (EggSMClientEndStyle style,
112 gboolean request_confirmation);
114 G_END_DECLS
117 #endif /* __EGG_SM_CLIENT_H__ */