org.gnu.gnome

Class Client


public class Client
extends GtkObject

The GnomeClient object makes it possible for your application to save session information when the user logs out. If, when logging out, the user chooses to save the current settings, a save_yourself signal is sent to each application. Then an application can save information in such a way that it is supported on the command line whenever the program automatically restarts a user login.

Constructor Summary

Client()
Create a new session management client and try to connect to a session manager.
Client(Handle handle)
Initialize a client from a handle to a native resource.

Method Summary

void
addListener(ClientListener listener)
Register an object to handle Client events.
void
connect()
Try to connect to a session manager.
void
disconnect()
Disconnect from the session manager.
protected static int
findListener(Vector list, Object listener)
Give us a way to locate a specific listener in a Vector.
protected void
fireClientEvent(ClientEvent event)
void
flush()
Flush the underlying connection to the connection manager.
String
getConfigPrefix()
Get the config prefix for a client.
String
getDesktopID()
Class
getEventListenerClass(String signal)
EventType
getEventType(String signal)
ClientFlags
getFlags()
Returns some flags, that give additional information about this client.
String
getGlobalConfigPrefix()
Get the config prefix for clients which have NOT been restarted or cloned.
String
getID()
String
getPreviousID()
static Type
getType()
Retrieve the runtime type used by the GLib library.
protected static void
gnome_client_connect(Handle client)
protected static void
gnome_client_disconnect(Handle client)
protected static void
gnome_client_flush(Handle client)
protected static String
gnome_client_get_config_prefix(Handle client)
protected static String
gnome_client_get_desktop_id(Handle client)
protected static int
gnome_client_get_flags(Handle client)
protected static String
gnome_client_get_global_config_prefix(Handle client)
protected static String
gnome_client_get_id(Handle client)
protected static String
gnome_client_get_previous_id(Handle client)
protected static int
gnome_client_get_type()
protected static Handle
gnome_client_new()
protected static void
gnome_client_request_phase_2(Handle client)
protected static void
gnome_client_request_save(Handle client, int save_style, boolean shutdown, int interact_style, boolean fast, boolean global)
protected static void
gnome_client_save_any_dialog(Handle client, Handle dialog)
protected static void
gnome_client_save_error_dialog(Handle client, Handle dialog)
protected static void
gnome_client_set_clone_command(Handle client, int argc, String[] args)
protected static void
gnome_client_set_current_directory(Handle client, String dir)
protected static void
gnome_client_set_discard_command(Handle client, int argc, String[] args)
protected static void
gnome_client_set_environment(Handle client, String name, String value)
protected static void
gnome_client_set_global_config_prefix(Handle client, String prefix)
protected static void
gnome_client_set_id(Handle client, String id)
protected static void
gnome_client_set_priority(Handle client, int priority)
protected static void
gnome_client_set_process_id(Handle client, int id)
protected static void
gnome_client_set_program(Handle client, String program)
protected static void
gnome_client_set_resign_command(Handle client, int argc, String[] args)
protected static void
gnome_client_set_restart_command(Handle client, int argc, String[] args)
protected static void
gnome_client_set_restart_style(Handle client, int style)
protected static void
gnome_client_set_shutdown_command(Handle client, int argc, String[] args)
protected static void
gnome_client_set_user_id(Handle client, String id)
void
removeListener(ClientListener listener)
Removes a listener
void
requestPhase2()
void
requestSave(SaveStyle saveStyle, boolean shutdown, InteractStyle interactStyle, boolean fast, boolean global)
Request the session manager to save the session in some way.
void
saveAnyDialog(Dialog dialog)
void
saveErrorDialog(Dialog dialog)
void
setCloneCommand(String[] args)
void
setCurrentDirectory(String dir)
Sets the directory where all commands are executed.
void
setDiscardCommand(String[] args)
void
setEnvironment(String name, String value)
void
setGlobalConfigPrefix(String prefix)
Set the value used for the global config prefix.
void
setID(String id)
void
setPriority(int priority)
The gnome-session manager includes an extension to the protocol which allows the order in which clients are started up to be organized into a number of run levels.
void
setProcessID(int id)
void
setProgram(String program)
void
setResignCommand(String[] args)
void
setRestartCommand(String[] args)
Provide the command that should be used to restart this application.
void
setRestartStyle(RestartStyle style)
The session manager usually only restarts clients which are running when the session was last saved.
void
setShutdownCommand(String[] args)
void
setUserID(String id)

Constructor Details

Client

public Client()
Create a new session management client and try to connect to a session manager.


Client

protected Client(Handle handle)
Initialize a client from a handle to a native resource.

Method Details

addListener

public void addListener(ClientListener listener)
Register an object to handle Client events.

See Also:
ClientListener


connect

public void connect()
Try to connect to a session manager. This should only be called after a disconnect().


disconnect

public void disconnect()
Disconnect from the session manager.


findListener

protected static int findListener(Vector list,
                                  Object listener)
Give us a way to locate a specific listener in a Vector.

Parameters:
list - The Vector of listeners to search.
listener - The object that is to be located in the Vector.

Returns:
Returns the index of the listener in the Vector, or -1 if the listener is not contained in the Vector.


fireClientEvent

protected void fireClientEvent(ClientEvent event)


flush

public void flush()
Flush the underlying connection to the connection manager. This is useful if you have some pending changes that you want to make sure get committed.


getConfigPrefix

public String getConfigPrefix()
Get the config prefix for a client. The 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).


getDesktopID

public String getDesktopID()


getEventListenerClass

public Class getEventListenerClass(String signal)


getEventType

public EventType getEventType(String signal)


getFlags

public ClientFlags getFlags()
Returns some flags, that give additional information about this client.


getGlobalConfigPrefix

public String getGlobalConfigPrefix()
Get the config prefix for clients which have NOT been restarted or cloned. This config prefix may be used to write the user's preferred config for these "new" clients.

You may 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 user's freedom to configure each instance in a different way so it should be used with caution.


getID

public String getID()


getPreviousID

public String getPreviousID()


getType

public static Type getType()
Retrieve the runtime type used by the GLib library.


gnome_client_connect

protected static final void gnome_client_connect(Handle client)


gnome_client_disconnect

protected static final void gnome_client_disconnect(Handle client)


gnome_client_flush

protected static final void gnome_client_flush(Handle client)


gnome_client_get_config_prefix

protected static final String gnome_client_get_config_prefix(Handle client)


gnome_client_get_desktop_id

protected static final String gnome_client_get_desktop_id(Handle client)


gnome_client_get_flags

protected static final int gnome_client_get_flags(Handle client)


gnome_client_get_global_config_prefix

protected static final String gnome_client_get_global_config_prefix(Handle client)


gnome_client_get_id

protected static final String gnome_client_get_id(Handle client)


gnome_client_get_previous_id

protected static final String gnome_client_get_previous_id(Handle client)


gnome_client_get_type

protected static final int gnome_client_get_type()


gnome_client_new

protected static final Handle gnome_client_new()


gnome_client_request_phase_2

protected static final void gnome_client_request_phase_2(Handle client)


gnome_client_request_save

protected static final void gnome_client_request_save(Handle client,
                                                      int save_style,
                                                      boolean shutdown,
                                                      int interact_style,
                                                      boolean fast,
                                                      boolean global)


gnome_client_save_any_dialog

protected static final void gnome_client_save_any_dialog(Handle client,
                                                         Handle dialog)


gnome_client_save_error_dialog

protected static final void gnome_client_save_error_dialog(Handle client,
                                                           Handle dialog)


gnome_client_set_clone_command

protected static final void gnome_client_set_clone_command(Handle client,
                                                           int argc,
                                                           String[] args)


gnome_client_set_current_directory

protected static final void gnome_client_set_current_directory(Handle client,
                                                               String dir)


gnome_client_set_discard_command

protected static final void gnome_client_set_discard_command(Handle client,
                                                             int argc,
                                                             String[] args)


gnome_client_set_environment

protected static final void gnome_client_set_environment(Handle client,
                                                         String name,
                                                         String value)


gnome_client_set_global_config_prefix

protected static final void gnome_client_set_global_config_prefix(Handle client,
                                                                  String prefix)


gnome_client_set_id

protected static final void gnome_client_set_id(Handle client,
                                                String id)


gnome_client_set_priority

protected static final void gnome_client_set_priority(Handle client,
                                                      int priority)


gnome_client_set_process_id

protected static final void gnome_client_set_process_id(Handle client,
                                                        int id)


gnome_client_set_program

protected static final void gnome_client_set_program(Handle client,
                                                     String program)


gnome_client_set_resign_command

protected static final void gnome_client_set_resign_command(Handle client,
                                                            int argc,
                                                            String[] args)


gnome_client_set_restart_command

protected static final void gnome_client_set_restart_command(Handle client,
                                                             int argc,
                                                             String[] args)


gnome_client_set_restart_style

protected static final void gnome_client_set_restart_style(Handle client,
                                                           int style)


gnome_client_set_shutdown_command

protected static final void gnome_client_set_shutdown_command(Handle client,
                                                              int argc,
                                                              String[] args)


gnome_client_set_user_id

protected static final void gnome_client_set_user_id(Handle client,
                                                     String id)


removeListener

public void removeListener(ClientListener listener)
Removes a listener

See Also:
addListener(ClientListener)


requestPhase2

public void requestPhase2()


requestSave

public void requestSave(SaveStyle saveStyle,
                        boolean shutdown,
                        InteractStyle interactStyle,
                        boolean fast,
                        boolean global)
Request the session manager to save the session in some way.


saveAnyDialog

public void saveAnyDialog(Dialog dialog)


saveErrorDialog

public void saveErrorDialog(Dialog dialog)


setCloneCommand

public void setCloneCommand(String[] args)


setCurrentDirectory

public void setCurrentDirectory(String dir)
Sets the directory where all commands are executed.


setDiscardCommand

public void setDiscardCommand(String[] args)


setEnvironment

public void setEnvironment(String name,
                           String value)


setGlobalConfigPrefix

public void setGlobalConfigPrefix(String prefix)
Set the value used for the global config prefix. The config prefixes returned by getGlobalConfigPrefix() are formed by extending this prefix with a unique identifier.

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.


setID

public void setID(String id)


setPriority

public void setPriority(int priority)
The gnome-session manager includes an extension to the protocol which allows the order in which clients are started up to be organized into a number of run levels. This method may be used to inform the gnome-session manager of where this client should appear in this run level ordering. The priority runs from 0 (started first) to 99 (started last) and defaults to 50.


setProcessID

public void setProcessID(int id)


setProgram

public void setProgram(String program)


setResignCommand

public void setResignCommand(String[] args)


setRestartCommand

public void setRestartCommand(String[] args)
Provide the command that should be used to restart this application.


setRestartStyle

public void setRestartStyle(RestartStyle style)
The session manager usually only restarts clients which are running when the session was last saved. You can set the restart style to make the manager restart the client: - at the start of every session (RESTART_AWAY) - whenever the client dies (RESTART_IMMEDIATELY) - never (RESTART_NEVER)


setShutdownCommand

public void setShutdownCommand(String[] args)


setUserID

public void setUserID(String id)