~noskcaj/ubuntu/wily/epiphany-browser/merge2

« back to all changes in this revision

Viewing changes to lib/egg/eggsmclient.h

Tags: upstream-2.28.0
ImportĀ upstreamĀ versionĀ 2.28.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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     (*set_discard_command) (EggSMClient          *client,
 
76
                                   int                   argc,
 
77
                                   const char          **argv);
 
78
  void     (*will_quit)           (EggSMClient          *client,
 
79
                                   gboolean              will_quit);
 
80
  gboolean (*end_session)         (EggSMClient          *client,
 
81
                                   EggSMClientEndStyle   style,
 
82
                                   gboolean              request_confirmation);
 
83
 
 
84
  /* Padding for future expansion */
 
85
  void (*_egg_reserved1) (void);
 
86
  void (*_egg_reserved2) (void);
 
87
  void (*_egg_reserved3) (void);
 
88
  void (*_egg_reserved4) (void);
 
89
};
 
90
 
 
91
GType            egg_sm_client_get_type            (void) G_GNUC_CONST;
 
92
 
 
93
GOptionGroup    *egg_sm_client_get_option_group    (void);
 
94
 
 
95
/* Initialization */
 
96
void             egg_sm_client_set_mode            (EggSMClientMode mode);
 
97
EggSMClientMode  egg_sm_client_get_mode            (void);
 
98
EggSMClient     *egg_sm_client_get                 (void);
 
99
 
 
100
/* Resuming a saved session */
 
101
gboolean         egg_sm_client_is_resumed          (EggSMClient *client);
 
102
GKeyFile        *egg_sm_client_get_state_file      (EggSMClient *client);
 
103
 
 
104
/* Alternate means of saving state */
 
105
void             egg_sm_client_set_restart_command (EggSMClient  *client,
 
106
                                                    int           argc,
 
107
                                                    const char  **argv);
 
108
void             egg_sm_client_set_discard_command (EggSMClient  *client,
 
109
                                                    int           argc,
 
110
                                                    const char  **argv);
 
111
 
 
112
/* Handling "quit_requested" signal */
 
113
void             egg_sm_client_will_quit           (EggSMClient *client,
 
114
                                                    gboolean     will_quit);
 
115
 
 
116
/* Initiate a logout/reboot/shutdown */
 
117
gboolean         egg_sm_client_end_session         (EggSMClientEndStyle  style,
 
118
                                                    gboolean             request_confirmation);
 
119
 
 
120
G_END_DECLS
 
121
 
 
122
 
 
123
#endif /* __EGG_SM_CLIENT_H__ */