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
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
/* -*- C -*- */ 
require gnomeui; 
 
class Gnome2.Client; 
//! 
inherit GTK2.Object; 
 
signal connect; 
//! Called once the client has been connected to the signal manager.<br> 
//!  int arg1, mixed user_data 
signal die; 
//! Called when the session manager wants the client to shut down.<br> 
//!  mixed user_data 
signal disconnect; 
//! Called when the client is disconnected from the session manager.<br> 
//!  mixed user_data 
signal save_complete; 
//! Called when the session manager has finished checkpointing all of the 
//! clients.  Clients are then free to change their state.<br> 
//!  mixed user_data 
signal save_yourself; 
//! Called when either a "SaveYourself" or a "SaveYourselfPhase2" call is made 
//! by the session manager.<br> 
//!  int arg1: the phase of the "SaveYourself" command ('1' or '2').<br> 
//!  int arg2: the data which should be saved (local, global, or both).<br> 
//!  int arg3: true if the session manager is shutting down.<br> 
//!  int arg4: how the client is allowed to interact with the user while saving.<br> 
//!  int arg5: true if this is to be a "fast" shutdown.<br> 
//!  mixed user_data 
signal shutdown_cancelled; 
//! Called if the session manager had sent a "SaveYourself" to all clients in 
//! preparation for shutting down and the shutdown was then cancelled.  A 
//! client can then continue running and change its state.<br> 
//!  mixed user_data 
 
void create() 
//! Gets the master session management client. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  THIS->obj=G_OBJECT(gnome_master_client()); 
  pgtk2_pop_n_elems(args); 
  pgtk2__init_this_object(); 
} 
 
string get_config_prefix(); 
//! Get the config prefix.  This config prefix provides a suitable place to 
//! store any details about the state of the client which can not be described 
//! using the app's command line arguments (as set in the restart command). 
 
string get_global_config_prefix(); 
//! Get the config prefix that will be returned by get_config_prefix() for 
//! clients which have NOT been restarted or cloned (i.e. for clients started 
//! by the user without '--sm-' options).  This config prefix may be used to 
//! write the user's preferred config for these "new"clients". 
//! <p> 
//! You could also use this prefix as a place to store and retrieve config 
//! details that you wish to apply to ALL instances of the app.  However, this 
//! practice limits the users freedom to configure each instance in a different 
//! way so it should be used with caution. 
 
void set_global_config_prefix(string prefix); 
//! Set the value used for the global config prefix. 
//! The global config prefix defaults to a name based on the name of the 
//! executable.  This function allows you to set it to a different value.  It 
//! should be called BEFORE retrieving the config prefix for the first time. 
//! Later calls will be ignored. 
 
int get_flags(); 
//! Determine the client's status with the session manager. 
 
void set_restart_style(int style); 
//! Tells the session manager how the client should be restarted in future 
//! sessions.  One of CONST(GNOME_RESTART_) 
 
void set_priority(int priority); 
//! The gnome-session manager restarts clients in order of their priorities in 
//! a similar way to the start up ordering in SysV.  This function allows the 
//! app to suggest a position in this ordering.  The value should be between 
//! 0 and 99.  A default value of 50 is assigned to apps that do not provide a 
//! value.  The user may assign a different priority. 
 
void set_restart_command(array(string) argv) 
//! When clients crash or the user logs out and back in, they are restarted. 
//! This command should perform the restart.  Executing the restart command on 
//! the local host should reproduce the state of the client at the time of the 
//! session save as closely as possible.  Saving config info under the 
//! get_config_prefix() is generally useful. 
//! Not implemented yet. 
{ 
} 
 
void set_discard_command(array(string) argv) 
//! Provides a command to run when a client is removed from the session.  It 
//! might delete session-specific config files, for example.  Executing the 
//! discard command on the local host should delete the information saved as 
//! part of the session save that was in progress when the discard command was 
//! set.  For example:<br> 
//! string prefix=client->get_config_prefix();<br> 
//! array argv=({ "rm","-r" });<br> 
//! argv+=({ Gnome2.Config->get_real_path(prefix) });<br> 
//! client->set_discard_command(argv);<br> 
//! Not implemented yet. 
{ 
} 
 
void set_resign_command(array(string) argv) 
//! Some clients can be "undone", removing their effects and deleting any saved 
//! state.  For example, xmodmap could register a resign command to undo the 
//! keymap changes it saved. 
//! <p> 
//! Used by clients that use the GTK2.GNOME_RESTART_ANYWAY restart style to undo 
//! their effects (these clients usually perform initialization functions and 
//! leave effects behind after they die).  The resign command combines the 
//! effects of a shutdown command and a discard command.  It is executed when 
//! the user decides that the client should cease to be restarted. 
//! Not implemented yet. 
{ 
} 
 
void set_shutdown_command(array(string) argv) 
//! GTK2.GNOME_RESTART_ANYWAY clients can set this command to run when the user 
//! logs out but the client is no longer running. 
//! <p> 
//! Used by clients that use the GTK2.GNOME_RESTART_ANYWAY restart style to undo 
//! their effects (these clients usually perform initialization functions and 
//! leave effects behind after they die).  The shutdown command simply undoes 
//! the effects of the client.  It is executed during a normal logout. 
//! Not implemented yet. 
{ 
} 
 
void set_current_directory(string dir); 
//! Set the directory to be in when running shutdown, discard, restart, etc. 
//! commands. 
 
void set_environment(string name, string value); 
//! Set an environment variable to be placed in the client's environment prior 
//! to running restart, shutdown, discard, etc. commands. 
 
void set_clone_command(array(string) argv) 
//! Set a command the session manager can use to create a new instance of the 
//! application. 
//! Not implemented yet. 
{ 
} 
 
void save_any_dialog(GTK2.Dialog dialog); 
//! May be called during a "save-yourself" handler to request that a (modal) 
//! dialog is presented to the user.  The session manager decides when the 
//! dialog is shown, but it will not be shown it unless the session manager is 
//! sending an interaction style of GTK2.GNOME_INTERACT_ANY.  "Cancel" and 
//! "Log out" buttons will be added during a shutdown. 
 
void save_error_dialog(GTK2.Dialog dialog); 
//! May be called during a "save-yourself" handler when an error has occurred 
//! during the save. 
 
void request_phase_2(); 
//! Request the session manager to emit the "save-yourself" signal for a second 
//! time after all the clients in the session have ceased interacting with the 
//! user and entered an idle state.  This might be useful if your app managers 
//! other apps and requires that they are in an idle state before saving its 
//! final data. 
 
void request_save(int save_style, int shutdown, int interact_style, int fast, 
                  int global); 
//! Request the session manager to save the session in some way.  The arguments 
//! correspond with the arguments passed to the "save-yourself" signal handler. 
//! <p> 
//! The save_style (CONST(GNOME_SAVE_)) indicates whether the save should 
//! affect data accessible to other users (GTK2.GNOME_SAVE_GLOBAL) or only the 
//! state visible to the current user (GTK2.GNOME_SAVE_LOCAL), or both.  Setting 
//! shutdown to true will initiate a logout.  The interact_style 
//! (CONST(GNOME_INTERACT_)) specifies which kinds of interaction will be 
//! available.  Setting fast to true will limit the save to setting the session 
//! manager properties plus any essential data.  Setting the value of global to 
//! true will request that all the other apps in the session do a save as well. 
//! A global save is mandatory when doing a shutdown. 
 
void flush(); 
//! This will force the underlying connection to the session manager to be 
//! flushed.  This is useful if you have some pending changes that you want to 
//! make sure get committed. 
 
void disconnect(); 
//! Disconnect the client from the session manager. 
 
string get_id(); 
//! Returns the session management ID. 
 
string get_previous_id(); 
//! Get the session management ID from the previous session. 
 
string get_desktop_id(); 
//! Get the client ID of the desktop's current instance, i.e. if you consider 
//! the desktop as a whole as a session managed app, this returns its session 
//! ID using a gnome extension to session management.  May return empty for 
//! apps not running under a recent version of gnome-session; apps should 
//! handle that case. 
 
endrequire;