summaryrefslogtreecommitdiff
path: root/xfce4-session/xfsm-manager.h
blob: 0691a0e950afa720c41186a42cd138df8d3641d6 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/* $Id$ */
/*-
 * Copyright (c) 2003-2006 Benedikt Meurer <benny@xfce.org>
 * Copyright (c) 2008 Brian Tarricone <bjt23@cornell.edu>
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 */

#ifndef __XFSM_MANAGER_H__
#define __XFSM_MANAGER_H__

#include <glib-object.h>

#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>

#include <xfce4-session/xfsm-client.h>
#include <xfce4-session/xfsm-global.h>
#include <xfce4-session/xfsm-shutdown.h>

G_BEGIN_DECLS

#define XFSM_TYPE_MANAGER     (xfsm_manager_get_type())
#define XFSM_MANAGER(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), XFSM_TYPE_MANAGER, XfsmManager))
#define XFSM_IS_MANAGER(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFSM_TYPE_MANAGER))

#define DIE_TIMEOUT            (     7 * 1000)
#define SAVE_TIMEOUT           (    60 * 1000)
#define STARTUP_TIMEOUT        (     8 * 1000)
#define RESTART_RESET_TIMEOUT  (5 * 60 * 1000)
#define XFSM_CHOOSE_LOGOUT  0
#define XFSM_CHOOSE_LOAD    1
#define XFSM_CHOOSE_NEW     2

typedef enum
{
  XFSM_MANAGER_STARTUP,
  XFSM_MANAGER_IDLE,
  XFSM_MANAGER_CHECKPOINT,
  XFSM_MANAGER_SHUTDOWN,
  XFSM_MANAGER_SHUTDOWNPHASE2,
} XfsmManagerState;

typedef enum
{
    XFSM_MANAGER_QUEUE_PENDING_PROPS = 0,
    XFSM_MANAGER_QUEUE_STARTING_PROPS,
    XFSM_MANAGER_QUEUE_RESTART_PROPS,
    XFSM_MANAGER_QUEUE_RUNNING_CLIENTS,
    XFSM_MANAGER_QUEUE_FAILSAFE_CLIENTS,
} XfsmManagerQueueType;

typedef enum
{
    XFSM_MANAGER_COMPAT_GNOME = 0,
    XFSM_MANAGER_COMPAT_KDE,
} XfsmManagerCompatType;

typedef struct _XfsmManager  XfsmManager;

GType xfsm_manager_get_type (void) G_GNUC_CONST;

XfsmManager *xfsm_manager_new (GDBusConnection *connection);

void xfsm_manager_load (XfsmManager   *manager,
                        XfconfChannel *channel);

gboolean xfsm_manager_restart (XfsmManager *manager);

/* call when startup is finished */
void xfsm_manager_signal_startup_done (XfsmManager *manager);

/* call for each client that fails */
gboolean xfsm_manager_handle_failed_properties (XfsmManager    *manager,
                                                XfsmProperties *properties);

XfsmClient* xfsm_manager_new_client (XfsmManager *manager,
                                     SmsConn      sms_conn,
                                     gchar      **error);

gboolean xfsm_manager_register_client (XfsmManager *manager,
                                       XfsmClient  *client,
                                       const gchar *dbus_client_id,
                                       const gchar *previous_id);

void xfsm_manager_start_interact (XfsmManager *manager,
                                  XfsmClient  *client);

void xfsm_manager_interact (XfsmManager *manager,
                            XfsmClient  *client,
                            gint         dialog_type);

void xfsm_manager_interact_done (XfsmManager *manager,
                                 XfsmClient  *client,
                                 gboolean     cancel_shutdown);

void xfsm_manager_save_yourself (XfsmManager *manager,
                                 XfsmClient  *client,
                                 gint         save_type,
                                 gboolean     shutdown,
                                 gint         interact_style,
                                 gboolean     fast,
                                 gboolean     global);

void xfsm_manager_save_yourself_phase2 (XfsmManager *manager,
                                        XfsmClient  *client);

void xfsm_manager_save_yourself_done (XfsmManager *manager,
                                      XfsmClient  *client,
                                      gboolean     success);

void xfsm_manager_close_connection (XfsmManager *manager,
                                    XfsmClient  *client,
                                    gboolean     cleanup);

void xfsm_manager_close_connection_by_ice_conn (XfsmManager *manager,
                                                IceConn ice_conn);

gboolean xfsm_manager_check_clients_saving (XfsmManager *manager);

gboolean xfsm_manager_maybe_enter_phase2 (XfsmManager *manager);

gboolean xfsm_manager_terminate_client (XfsmManager *manager,
                                        XfsmClient  *client,
                                        GError     **error);

void xfsm_manager_perform_shutdown (XfsmManager *manager);

gboolean xfsm_manager_run_command (XfsmManager          *manager,
                                   const XfsmProperties *properties,
                                   const gchar          *command);

void xfsm_manager_store_session (XfsmManager *manager);

void xfsm_manager_complete_saveyourself (XfsmManager *manager);

XfsmShutdownType xfsm_manager_get_shutdown_type (XfsmManager *manager);

XfsmManagerState xfsm_manager_get_state (XfsmManager *manager);

GQueue *xfsm_manager_get_queue (XfsmManager         *manager,
                                XfsmManagerQueueType q_type);

gboolean xfsm_manager_get_use_failsafe_mode (XfsmManager *manager);

gboolean xfsm_manager_get_compat_startup (XfsmManager          *manager,
                                          XfsmManagerCompatType type);

gboolean xfsm_manager_get_start_at (XfsmManager *manager);

#endif /* !__XFSM_MANAGER_H__ */