XfceSMClient

XfceSMClient — Session management client

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <libxfce4ui/libxfce4ui.h>

                    XfceSMClient;
enum                XfceSMClientPriority;
enum                XfceSMClientRestartStyle;
enum                XfceSMClientShutdownHint;
GOptionGroup *      xfce_sm_client_get_option_group     (gint argc,
                                                         gchar **argv);
XfceSMClient *      xfce_sm_client_get                  (void);
XfceSMClient *      xfce_sm_client_get_with_argv        (gint argc,
                                                         gchar **argv,
                                                         XfceSMClientRestartStyle restart_style,
                                                         guchar priority);
XfceSMClient *      xfce_sm_client_get_full             (XfceSMClientRestartStyle restart_style,
                                                         guchar priority,
                                                         const gchar *resumed_client_id,
                                                         const gchar *current_directory,
                                                         const gchar **restart_command,
                                                         const gchar *desktop_file);
gboolean            xfce_sm_client_connect              (XfceSMClient *sm_client,
                                                         GError **error);
void                xfce_sm_client_disconnect           (XfceSMClient *sm_client);
gboolean            xfce_sm_client_is_connected         (XfceSMClient *sm_client);
gboolean            xfce_sm_client_is_resumed           (XfceSMClient *sm_client);
void                xfce_sm_client_set_desktop_file     (XfceSMClient *sm_client,
                                                         const gchar *desktop_file);
void                xfce_sm_client_request_shutdown     (XfceSMClient *sm_client,
                                                         XfceSMClientShutdownHint shutdown_hint);
const gchar *       xfce_sm_client_get_client_id        (XfceSMClient *sm_client);
const gchar *       xfce_sm_client_get_state_file       (XfceSMClient *sm_client);
const gchar *       xfce_sm_client_get_current_directory
                                                        (XfceSMClient *sm_client);
void                xfce_sm_client_set_current_directory
                                                        (XfceSMClient *sm_client,
                                                         const gchar *current_directory);
guint8              xfce_sm_client_get_priority         (XfceSMClient *sm_client);
void                xfce_sm_client_set_priority         (XfceSMClient *sm_client,
                                                         guint8 priority);
const gchar * const * xfce_sm_client_get_restart_command
                                                        (XfceSMClient *sm_client);
void                xfce_sm_client_set_restart_command  (XfceSMClient *sm_client,
                                                         gchar **restart_command);
XfceSMClientRestartStyle xfce_sm_client_get_restart_style
                                                        (XfceSMClient *sm_client);
void                xfce_sm_client_set_restart_style    (XfceSMClient *sm_client,
                                                         XfceSMClientRestartStyle restart_style);

Object Hierarchy

  GObject
   +----XfceSMClient
  GEnum
   +----XfceSMClientRestartStyle
  GEnum
   +----XfceSMClientShutdownHint

Properties

  "argc"                     gint                  : Write / Construct Only
  "argv"                     GStrv                 : Write / Construct Only
  "client-id"                gchar*                : Read / Write / Construct Only
  "current-directory"        gchar*                : Read / Write
  "desktop-file"             gchar*                : Read / Write
  "priority"                 guchar                : Read / Write / Construct
  "restart-command"          GStrv                 : Read / Write
  "restart-style"            XfceSMClientRestartStyle  : Read / Write / Construct
  "resumed"                  gboolean              : Read

Signals

  "quit"                                           : Run Last
  "quit-cancelled"                                 : Run Last
  "quit-requested"                                 : Run Last
  "save-state"                                     : Run Last
  "save-state-extended"                            : Run Last

Description

XfceSMClient is a session management client that speaks the X Session Management Protocol (XSMP). It's designed to be easy to use and hide some of the more esoteric feaures of XSMP from the API user.

Details

XfceSMClient

typedef struct _XfceSMClient XfceSMClient;

An opaque struct with only private fields.


enum XfceSMClientPriority

typedef enum {
    XFCE_SM_CLIENT_PRIORITY_HIGHEST = 0,
    XFCE_SM_CLIENT_PRIORITY_WM = 15,
    XFCE_SM_CLIENT_PRIORITY_CORE = 25,
    XFCE_SM_CLIENT_PRIORITY_DESKTOP = 35,
    XFCE_SM_CLIENT_PRIORITY_DEFAULT = 50,
    XFCE_SM_CLIENT_PRIORITY_LOWEST = 255,
} XfceSMClientPriority;

Some sample priority values for use with xfce_sm_client_set_priority().

XFCE_SM_CLIENT_PRIORITY_HIGHEST

A high priority value. You probably don't want to use this.

XFCE_SM_CLIENT_PRIORITY_WM

A priority value for use by the window manager.

XFCE_SM_CLIENT_PRIORITY_CORE

A priority value for use by applications that place windows on the screen and possibly set window manager struts.

XFCE_SM_CLIENT_PRIORITY_DESKTOP

A priority value for use by applications that draw on the desktop.

XFCE_SM_CLIENT_PRIORITY_DEFAULT

A priority value for regular applications.

XFCE_SM_CLIENT_PRIORITY_LOWEST

The lowest possible priority value.

enum XfceSMClientRestartStyle

typedef enum {
    XFCE_SM_CLIENT_RESTART_NORMAL = 0,
    XFCE_SM_CLIENT_RESTART_IMMEDIATELY,
} XfceSMClientRestartStyle;

An enumeration describing how the session manager should restart the application.

XFCE_SM_CLIENT_RESTART_NORMAL

Only restart the application if it is still running when the session is next saved.

XFCE_SM_CLIENT_RESTART_IMMEDIATELY

Immediately restart the application if it ever quits.

enum XfceSMClientShutdownHint

typedef enum {
    XFCE_SM_CLIENT_SHUTDOWN_HINT_ASK = 0,
    XFCE_SM_CLIENT_SHUTDOWN_HINT_LOGOUT,
    XFCE_SM_CLIENT_SHUTDOWN_HINT_HALT,
    XFCE_SM_CLIENT_SHUTDOWN_HINT_REBOOT,
} XfceSMClientShutdownHint;

Hints to the session manager what kind of shutdown the session manager should perform.

XFCE_SM_CLIENT_SHUTDOWN_HINT_ASK

Prompt the user for a choice,

XFCE_SM_CLIENT_SHUTDOWN_HINT_LOGOUT

End the current session,

XFCE_SM_CLIENT_SHUTDOWN_HINT_HALT

Shut down the computer.

XFCE_SM_CLIENT_SHUTDOWN_HINT_REBOOT

Restart the computer.

xfce_sm_client_get_option_group ()

GOptionGroup *      xfce_sm_client_get_option_group     (gint argc,
                                                         gchar **argv);

Constructs a GOptionGroup suitable for use with Glib's command-line option parser.

This function is a bit sneaky in that it will make a copy of the program's argc and argv before GTK+ etc. has a chance to mess around with it, so XfceSMClient can later construct an accurate restart command. Instead of calling gtk_init() or gtk_init_with_args(), instead you'd do something like:

1
2
3
4
5
6
7