Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar3/eggsmclient-xsmp.h
blob: 1fbf5c5bc9ce5cdf6d9f73852c802dc16b4e3412 (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
/* eggsmclient.h
 * Copyright (C) 2007 Novell, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __EGG_SM_CLIENT_XSMP_H__
#define __EGG_SM_CLIENT_XSMP_H__

#include <glib-object.h>
#include <X11/SM/SMlib.h>

G_BEGIN_DECLS


#define EGG_TYPE_SM_CLIENT_XSMP            (egg_sm_client_xsmp_get_type ())
#define EGG_SM_CLIENT_XSMP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
#define EGG_SM_CLIENT_XSMP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass))
#define EGG_IS_SM_CLIENT_XSMP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_XSMP))
#define EGG_IS_SM_CLIENT_XSMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_XSMP))
#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass))

typedef struct _EggSMClientXSMP        EggSMClientXSMP;
typedef struct _EggSMClientXSMPClass   EggSMClientXSMPClass;

/* These mostly correspond to the similarly-named states in section
 * 9.1 of the XSMP spec. Some of the states there aren't represented
 * here, because we don't need them. SHUTDOWN_CANCELLED is slightly
 * different from the spec; we use it when the client is IDLE after a
 * ShutdownCancelled message, but the application is still interacting
 * and doesn't know the shutdown has been cancelled yet.
 */
typedef enum
{
  XSMP_STATE_START,
  XSMP_STATE_IDLE,
  XSMP_STATE_SAVE_YOURSELF,
  XSMP_STATE_INTERACT_REQUEST,
  XSMP_STATE_INTERACT,
  XSMP_STATE_SAVE_YOURSELF_DONE,
  XSMP_STATE_SHUTDOWN_CANCELLED,
  XSMP_STATE_CONNECTION_CLOSED,
} EggSMClientXSMPState;

struct _EggSMClientXSMP
{
  EggSMClient parent;

  SmcConn connection;
  char *client_id;

  EggSMClientXSMPState state;
  char **restart_command;
  gboolean set_restart_command;
  int restart_style;

  guint idle;

  /* Current SaveYourself state */
  guint expecting_initial_save_yourself : 1;
  guint need_save_state : 1;
  guint need_quit_requested : 1;
  guint interact_errors : 1;
  guint shutting_down : 1;

  /* Todo list */
  guint waiting_to_emit_quit : 1;
  guint waiting_to_emit_quit_cancelled : 1;
  guint waiting_to_save_myself : 1;

};

struct _EggSMClientXSMPClass
{
  EggSMClientClass parent_class;

};

GType            egg_sm_client_xsmp_get_type            (void) G_GNUC_CONST;

G_END_DECLS

#endif /* __EGG_SM_CLIENT_XSMP_H__ */