"save-yourself" |
The GNOME project uses a special object - the GnomeClient object - to implement session management. This object handles the connection to a session manager, the setting and removing of properties and the handling of messages sent by a session manager.
There are two functions in the GNOME libraries, that create a new GnomeClient object: gnome_client_new() and gnome_client_new_without_connection(). As one may guess from the functions names: The first function tries to connect to a session manager automatically, while the second one does not.
typedef enum { GNOME_CLIENT_IS_CONNECTED= 1 << 0, GNOME_CLIENT_RESTARTED = 1 << 1, GNOME_CLIENT_RESTORED = 1 << 2 } GnomeClientFlags; |
typedef enum { GNOME_INTERACT_NONE, GNOME_INTERACT_ERRORS, GNOME_INTERACT_ANY } GnomeInteractStyle; |
typedef enum { GNOME_SAVE_GLOBAL, GNOME_SAVE_LOCAL, GNOME_SAVE_BOTH } GnomeSaveStyle; |
typedef enum { GNOME_RESTART_IF_RUNNING, GNOME_RESTART_ANYWAY, GNOME_RESTART_IMMEDIATELY, GNOME_RESTART_NEVER } GnomeRestartStyle; |
typedef enum { GNOME_CLIENT_IDLE, GNOME_CLIENT_SAVING_PHASE_1, GNOME_CLIENT_WAITING_FOR_PHASE_2, GNOME_CLIENT_SAVING_PHASE_2, GNOME_CLIENT_FROZEN, GNOME_CLIENT_DISCONNECTED, GNOME_CLIENT_REGISTERING } GnomeClientState; |
void (*GnomeInteractFunction) (GnomeClient *client, |
client : | |
key : | |
dialog_type : | |
data : |
GnomeClient* gnome_client_new (void); |
Allocates memory for a new GNOME session management client object. After allocating, the client tries to connect to a session manager.
Returns : | Pointer to a newly allocated GNOME session management client object. |
GnomeClient* gnome_client_new_without_connection (void); |
Allocates memory for a new GNOME session management client object.
Returns : | Pointer to a newly allocated GNOME session management client object. |
void gnome_client_connect (GnomeClient *client); |
client : | Pointer to GNOME session client object. |
void gnome_client_disconnect (GnomeClient *client); |
client : | Pointer to GNOME session client object. |
void gnome_client_set_id (GnomeClient *client, const |
client : | Pointer to GNOME session client object. |
client_id : |
|
client : | Pointer to GNOME session client object. |
Returns : | Pointer to |
|
client : | Pointer to GNOME session client object. |
Returns : | Pointer to |
|
client : | Pointer to GNOME session client object. |
Returns : | Pointer to |
|
client : | Pointer to GNOME session client object. |
Returns : | Pointer to |
void gnome_client_set_global_config_prefix (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
prefix : | Prefix for saving the global configuration |
GnomeClientFlags gnome_client_get_flags (GnomeClient *client); |
client : | Pointer to GNOME session client object. |
Returns : | some flags, that give additional information about this client. Right now, the following flags are supported: - GNOME_CLIENT_IS_CONNECTED: The client is connected to a session manager (It's the same information like using * GNOME_CLIENT_CONNECTED). - GNOME_CLIENT_RESTARTED: The client has been restarted, i. e. it has been running with the same client id before. - GNOME_CLIENT_RESTORED: This flag is only used for the master client. It indicates, that there may be a configuraion file from which the clients state should be restored (using the gnome_client_get_config_prefix call). |
void gnome_client_set_restart_style (GnomeClient *client, GnomeRestartStyle style); |
client : | Pointer to GNOME session client object. |
style : |
void gnome_client_set_restart_command (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
argc : | |
argv : |
void gnome_client_add_static_arg (GnomeClient *client, ...); |
client : | Pointer to GNOME session client object. |
... : |
void gnome_client_set_discard_command (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
argc : | |
argv : |
void gnome_client_set_resign_command (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
argc : | |
argv : |
void gnome_client_set_shutdown_command (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
argc : | |
argv : |
void gnome_client_set_current_directory (GnomeClient *client, const |
client : | Pointer to GNOME session client object. |
dir : |
void gnome_client_set_environment (GnomeClient *client, const |
client : | Pointer to GNOME session client object. |
name : | |
value : |
void gnome_client_set_clone_command (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
argc : | |
argv : |
void gnome_client_set_process_id (GnomeClient *client, |
client : | Pointer to GNOME session client object. |
pid : |
void gnome_client_set_program (GnomeClient *client, const |
client : | Pointer to GNOME session client object. |
program : |
void gnome_client_set_user_id (GnomeClient *client, const |
client : | Pointer to GNOME session client object. |
user_id : |
void gnome_client_request_phase_2 (GnomeClient *client); |
client : | Pointer to GNOME session client object. |
void gnome_client_save_any_dialog (GnomeClient *client, GnomeDialog *dialog); |
May be called during a "save_youself" 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 interact_style == GNOME_INTERACT_ANY. A "Cancel Logout" button will be added during a shutdown.
client : | Pointer to GNOME session client object. |
dialog : | Pointer to GNOME dialog widget. |
void gnome_client_save_error_dialog (GnomeClient *client, GnomeDialog *dialog); |
May be called during a "save_youself" handler when an error has occured during the save. The session manager decides when the dialog is shown but it will not be shown when the interact_style == GNOME_INTERACT_NONE. A "Cancel Logout" button will be added during a shutdown.
client : | Pointer to GNOME session client object. |
dialog : | Pointer to GNOME dialog widget. |
void gnome_client_request_interaction (GnomeClient *client, GnomeDialogType dialog, GnomeInteractFunction func, |
client : | Pointer to GNOME session client object. |
dialog : | |
func : | |
client_data : |
void gnome_client_request_interaction_interp (GnomeClient *client, GnomeDialogType dialog, |
client : | Pointer to GNOME session client object. |
dialog : | |
func : | |
data : | |
destroy : |
void gnome_interaction_key_return ( |
key : | |
cancel_shutdown : |
void gnome_client_request_save (GnomeClient *client, GnomeSaveStyle save_style, |
client : | Pointer to GNOME session client object. |
save_style : | |
shutdown : | |
interact_style : | |
fast : | |
global : |
void gnome_client_flush (GnomeClient *client); |
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.
client : | Pointer to GNOME session client object. |
|
This signal is probably the most important one, because it causes the clients to save the programs state. Clients should connect to this signal and save their state.
client : | the object which received the signal. |
arg1 : | |
arg2 : | |
arg3 : | |
arg4 : | |
arg5 : | |
user_data : | user data set when the signal handler was connected. |
Returns : |
void user_function (GnomeClient *client, |
client : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GnomeClient *client, |
client : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GnomeClient *client, |
client : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GnomeClient *client, |
client : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (GnomeClient *client, |
client : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |