]> www.fi.muni.cz Git - evince.git/blob - cut-n-paste/smclient/eggsmclient.h
e620b754a3668218efb0a1dcf031bc9f9168bcc8
[evince.git] / cut-n-paste / smclient / eggsmclient.h
1 /* eggsmclient.h
2  * Copyright (C) 2007 Novell, Inc.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #ifndef __EGG_SM_CLIENT_H__
21 #define __EGG_SM_CLIENT_H__
22
23 #include <glib-object.h>
24
25 G_BEGIN_DECLS
26
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))
33
34 typedef struct _EggSMClient        EggSMClient;
35 typedef struct _EggSMClientClass   EggSMClientClass;
36 typedef struct _EggSMClientPrivate EggSMClientPrivate;
37
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;
44
45 typedef enum {
46   EGG_SM_CLIENT_MODE_DISABLED,
47   EGG_SM_CLIENT_MODE_NO_RESTART,
48   EGG_SM_CLIENT_MODE_NORMAL
49 } EggSMClientMode;
50
51 struct _EggSMClient
52 {
53   GObject parent;
54
55 };
56
57 struct _EggSMClientClass
58 {
59   GObjectClass parent_class;
60
61   /* signals */
62   void (*save_state)       (EggSMClient *client,
63                             GKeyFile    *state_file);
64
65   void (*quit_requested)   (EggSMClient *client);
66   void (*quit_cancelled)   (EggSMClient *client);
67   void (*quit)             (EggSMClient *client);
68
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);
80
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);
86 };
87
88 GType            egg_sm_client_get_type            (void) G_GNUC_CONST;
89
90 GOptionGroup    *egg_sm_client_get_option_group    (void);
91
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);
96
97 /* Resuming a saved session */
98 gboolean         egg_sm_client_is_resumed          (EggSMClient *client);
99 GKeyFile        *egg_sm_client_get_state_file      (EggSMClient *client);
100
101 /* Alternate means of saving state */
102 void             egg_sm_client_set_restart_command (EggSMClient  *client,
103                                                     int           argc,
104                                                     const char  **argv);
105
106 /* Handling "quit_requested" signal */
107 void             egg_sm_client_will_quit           (EggSMClient *client,
108                                                     gboolean     will_quit);
109
110 /* Initiate a logout/reboot/shutdown */
111 gboolean         egg_sm_client_end_session         (EggSMClientEndStyle  style,
112                                                     gboolean             request_confirmation);
113
114 G_END_DECLS
115
116
117 #endif /* __EGG_SM_CLIENT_H__ */