Updated eggsmclient from git
This commit is contained in:
parent
e56ebb2368
commit
acd086a0b4
@ -185,6 +185,9 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file,
|
||||
{
|
||||
g_set_error (error, EGG_DESKTOP_FILE_ERROR,
|
||||
EGG_DESKTOP_FILE_ERROR_INVALID,
|
||||
/* translators: 'Version' is from a desktop file, and
|
||||
* should not be translated. '%s' would probably be a
|
||||
* version number. */
|
||||
_("Unrecognized desktop file Version '%s'"), version);
|
||||
g_free (version);
|
||||
g_key_file_free (key_file);
|
||||
@ -201,8 +204,11 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file,
|
||||
else
|
||||
desktop_file->source = g_strdup (source);
|
||||
|
||||
desktop_file->name = g_key_file_get_string (key_file, EGG_DESKTOP_FILE_GROUP,
|
||||
EGG_DESKTOP_FILE_KEY_NAME, error);
|
||||
desktop_file->name = g_key_file_get_locale_string (key_file,
|
||||
EGG_DESKTOP_FILE_GROUP,
|
||||
EGG_DESKTOP_FILE_KEY_NAME,
|
||||
NULL,
|
||||
error);
|
||||
if (!desktop_file->name)
|
||||
{
|
||||
egg_desktop_file_free (desktop_file);
|
||||
@ -1380,9 +1386,11 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file,
|
||||
{
|
||||
g_set_error (error, EGG_DESKTOP_FILE_ERROR,
|
||||
EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
|
||||
/* translators: The 'Type=Link' string is found in a
|
||||
* desktop file, and should not be translated. */
|
||||
_("Can't pass document URIs to a 'Type=Link' desktop entry"));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!parse_link (desktop_file, &app_desktop_file, &documents, error))
|
||||
return FALSE;
|
||||
@ -1501,10 +1509,10 @@ egg_set_desktop_file_without_defaults (const char *desktop_file_path)
|
||||
|
||||
/**
|
||||
* egg_get_desktop_file:
|
||||
*
|
||||
*
|
||||
* Gets the application's #EggDesktopFile, as set by
|
||||
* egg_set_desktop_file().
|
||||
*
|
||||
*
|
||||
* Return value: the #EggDesktopFile, or %NULL if it hasn't been set.
|
||||
**/
|
||||
EggDesktopFile *
|
||||
|
@ -165,7 +165,6 @@ sm_client_dbus_startup (EggSMClient *client,
|
||||
G_CALLBACK (dbus_client_end_session),
|
||||
dbus, NULL);
|
||||
dbus_g_proxy_add_signal (dbus->client_proxy, "CancelEndSession",
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (dbus->client_proxy, "CancelEndSession",
|
||||
G_CALLBACK (dbus_client_cancel_end_session),
|
||||
@ -185,7 +184,11 @@ sm_client_dbus_startup (EggSMClient *client,
|
||||
G_TYPE_INVALID))
|
||||
{
|
||||
gdk_threads_enter ();
|
||||
#if !GTK_CHECK_VERSION(2,23,3) && !GTK_CHECK_VERSION(3,0,0)
|
||||
gdk_set_sm_client_id (ret_client_id);
|
||||
#else
|
||||
gdk_x11_set_sm_client_id (ret_client_id);
|
||||
#endif
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_debug ("Got client ID \"%s\"", ret_client_id);
|
||||
|
@ -32,6 +32,10 @@
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "EggSMClient"
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GKeyFile *egg_sm_client_save_state (EggSMClient *client);
|
||||
|
@ -51,6 +51,8 @@
|
||||
#include "eggsmclient-private.h"
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define UNICODE
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
@ -95,7 +97,7 @@ static void sm_client_thread (gpointer data);
|
||||
G_DEFINE_TYPE (EggSMClientWin32, egg_sm_client_win32, EGG_TYPE_SM_CLIENT)
|
||||
|
||||
static void
|
||||
egg_sm_client_win32_init (G_GNUC_UNUSED EggSMClientWin32 *win32)
|
||||
egg_sm_client_win32_init (EggSMClientWin32 *win32)
|
||||
{
|
||||
;
|
||||
}
|
||||
@ -118,13 +120,13 @@ egg_sm_client_win32_new (void)
|
||||
|
||||
static void
|
||||
sm_client_win32_startup (EggSMClient *client,
|
||||
G_GNUC_UNUSED const char *client_id)
|
||||
const char *client_id)
|
||||
{
|
||||
EggSMClientWin32 *win32 = (EggSMClientWin32 *)client;
|
||||
|
||||
win32->message_event = CreateEvent (NULL, FALSE, FALSE, NULL);
|
||||
win32->response_event = CreateEvent (NULL, FALSE, FALSE, NULL);
|
||||
g_win32_handle_source_add (win32->message_event, got_message, win32);
|
||||
g_win32_handle_source_add (win32->message_event, got_message, win32);
|
||||
_beginthread (sm_client_thread, 0, client);
|
||||
}
|
||||
|
||||
@ -139,9 +141,9 @@ sm_client_win32_will_quit (EggSMClient *client,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sm_client_win32_end_session (G_GNUC_UNUSED EggSMClient *client,
|
||||
sm_client_win32_end_session (EggSMClient *client,
|
||||
EggSMClientEndStyle style,
|
||||
G_GNUC_UNUSED gboolean request_confirmation)
|
||||
gboolean request_confirmation)
|
||||
{
|
||||
UINT uFlags = EWX_LOGOFF;
|
||||
|
||||
@ -228,7 +230,7 @@ typedef struct {
|
||||
} GWin32HandleSource;
|
||||
|
||||
static gboolean
|
||||
g_win32_handle_source_prepare (G_GNUC_UNUSED GSource *source, gint *timeout)
|
||||
g_win32_handle_source_prepare (GSource *source, gint *timeout)
|
||||
{
|
||||
*timeout = -1;
|
||||
return FALSE;
|
||||
@ -243,13 +245,13 @@ g_win32_handle_source_check (GSource *source)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_win32_handle_source_dispatch (G_GNUC_UNUSED GSource *source, GSourceFunc callback, gpointer user_data)
|
||||
g_win32_handle_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
|
||||
{
|
||||
return (*callback) (user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
g_win32_handle_source_finalize (G_GNUC_UNUSED GSource *source)
|
||||
g_win32_handle_source_finalize (GSource *source)
|
||||
{
|
||||
;
|
||||
}
|
||||
@ -281,7 +283,7 @@ g_win32_handle_source_add (HANDLE handle, GSourceFunc callback, gpointer user_da
|
||||
|
||||
/* logout-listener thread */
|
||||
|
||||
static LRESULT CALLBACK
|
||||
LRESULT CALLBACK
|
||||
sm_client_win32_window_procedure (HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
@ -325,7 +327,7 @@ static void
|
||||
sm_client_thread (gpointer smclient)
|
||||
{
|
||||
HINSTANCE instance;
|
||||
WNDCLASSEXW wcl;
|
||||
WNDCLASSEXW wcl;
|
||||
ATOM klass;
|
||||
HWND window;
|
||||
MSG msg;
|
||||
|
@ -113,8 +113,6 @@ struct _EggSMClientXSMPClass
|
||||
|
||||
};
|
||||
|
||||
static void sm_client_xsmp_finalize (GObject *object);
|
||||
|
||||
static void sm_client_xsmp_startup (EggSMClient *client,
|
||||
const char *client_id);
|
||||
static void sm_client_xsmp_set_restart_command (EggSMClient *client,
|
||||
@ -190,24 +188,16 @@ egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass)
|
||||
sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command;
|
||||
sm_client_class->will_quit = sm_client_xsmp_will_quit;
|
||||
sm_client_class->end_session = sm_client_xsmp_end_session;
|
||||
|
||||
G_OBJECT_CLASS (klass)->finalize = sm_client_xsmp_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
sm_client_xsmp_finalize (GObject *object)
|
||||
{
|
||||
EggSMClientXSMP *xsmp = (EggSMClientXSMP *)object;
|
||||
|
||||
g_free (xsmp->client_id);
|
||||
g_strfreev (xsmp->restart_command);
|
||||
|
||||
G_OBJECT_CLASS (egg_sm_client_xsmp_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
EggSMClient *
|
||||
egg_sm_client_xsmp_new (void)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
if (!GDK_IS_X11_DISPLAY_MANAGER (gdk_display_manager_get ()))
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
if (!g_getenv ("SESSION_MANAGER"))
|
||||
return NULL;
|
||||
|
||||
@ -242,7 +232,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data)
|
||||
|
||||
if (xsmp->restart_style == SmRestartIfRunning)
|
||||
{
|
||||
if (egg_desktop_file_get_boolean (desktop_file,
|
||||
if (egg_desktop_file_get_boolean (desktop_file,
|
||||
"X-GNOME-AutoRestart", NULL))
|
||||
xsmp->restart_style = SmRestartImmediately;
|
||||
}
|
||||
@ -382,11 +372,13 @@ sm_client_xsmp_startup (EggSMClient *client,
|
||||
xsmp->client_id = g_strdup (ret_client_id);
|
||||
free (ret_client_id);
|
||||
|
||||
#if !GTK_CHECK_VERSION(2,91,7) && !GTK_CHECK_VERSION(3,0,0)
|
||||
gdk_threads_enter ();
|
||||
#if !GTK_CHECK_VERSION(2,23,3) && !GTK_CHECK_VERSION(3,0,0)
|
||||
gdk_set_sm_client_id (xsmp->client_id);
|
||||
#else
|
||||
gdk_x11_set_sm_client_id (xsmp->client_id);
|
||||
#endif
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_debug ("Got client ID \"%s\"", xsmp->client_id);
|
||||
}
|
||||
@ -461,7 +453,7 @@ sm_client_xsmp_will_quit (EggSMClient *client,
|
||||
|
||||
static gboolean
|
||||
sm_client_xsmp_end_session (EggSMClient *client,
|
||||
G_GNUC_UNUSED EggSMClientEndStyle style,
|
||||
EggSMClientEndStyle style,
|
||||
gboolean request_confirmation)
|
||||
{
|
||||
EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
|
||||
@ -627,7 +619,7 @@ fix_broken_state (EggSMClientXSMP *xsmp, const char *message,
|
||||
/* SM callbacks */
|
||||
|
||||
static void
|
||||
xsmp_save_yourself (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
xsmp_save_yourself (SmcConn smc_conn,
|
||||
SmPointer client_data,
|
||||
int save_type,
|
||||
Bool shutdown,
|
||||
@ -946,7 +938,7 @@ save_state (EggSMClientXSMP *xsmp)
|
||||
}
|
||||
|
||||
static void
|
||||
xsmp_interact (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
xsmp_interact (SmcConn smc_conn,
|
||||
SmPointer client_data)
|
||||
{
|
||||
EggSMClientXSMP *xsmp = client_data;
|
||||
@ -966,7 +958,7 @@ xsmp_interact (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
}
|
||||
|
||||
static void
|
||||
xsmp_die (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
xsmp_die (SmcConn smc_conn,
|
||||
SmPointer client_data)
|
||||
{
|
||||
EggSMClientXSMP *xsmp = client_data;
|
||||
@ -980,7 +972,7 @@ xsmp_die (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
}
|
||||
|
||||
static void
|
||||
xsmp_save_complete (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
xsmp_save_complete (SmcConn smc_conn,
|
||||
SmPointer client_data)
|
||||
{
|
||||
EggSMClientXSMP *xsmp = client_data;
|
||||
@ -995,7 +987,7 @@ xsmp_save_complete (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
}
|
||||
|
||||
static void
|
||||
xsmp_shutdown_cancelled (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
xsmp_shutdown_cancelled (SmcConn smc_conn,
|
||||
SmPointer client_data)
|
||||
{
|
||||
EggSMClientXSMP *xsmp = client_data;
|
||||
@ -1149,7 +1141,7 @@ delete_properties (EggSMClientXSMP *xsmp, ...)
|
||||
* until you're done with the SmProp.
|
||||
*/
|
||||
static SmProp *
|
||||
array_prop (const char *name, ...)
|
||||
array_prop (const char *name, ...)
|
||||
{
|
||||
SmProp *prop;
|
||||
SmPropValue pv;
|
||||
@ -1318,13 +1310,12 @@ process_ice_messages (IceConn ice_conn)
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ice_iochannel_watch (G_GNUC_UNUSED GIOChannel *channel,
|
||||
G_GNUC_UNUSED GIOCondition condition,
|
||||
ice_iochannel_watch (GIOChannel *channel,
|
||||
GIOCondition condition,
|
||||
gpointer client_data)
|
||||
{
|
||||
return process_ice_messages (client_data);
|
||||
@ -1332,7 +1323,7 @@ ice_iochannel_watch (G_GNUC_UNUSED GIOChannel *channel,
|
||||
|
||||
static void
|
||||
ice_connection_watch (IceConn ice_conn,
|
||||
G_GNUC_UNUSED IcePointer client_data,
|
||||
IcePointer client_data,
|
||||
Bool opening,
|
||||
IcePointer *watch_data)
|
||||
{
|
||||
@ -1359,31 +1350,31 @@ ice_connection_watch (IceConn ice_conn,
|
||||
}
|
||||
|
||||
static void
|
||||
ice_error_handler (G_GNUC_UNUSED IceConn ice_conn,
|
||||
G_GNUC_UNUSED Bool swap,
|
||||
G_GNUC_UNUSED int offending_minor_opcode,
|
||||
G_GNUC_UNUSED unsigned long offending_sequence,
|
||||
G_GNUC_UNUSED int error_class,
|
||||
G_GNUC_UNUSED int severity,
|
||||
G_GNUC_UNUSED IcePointer values)
|
||||
ice_error_handler (IceConn ice_conn,
|
||||
Bool swap,
|
||||
int offending_minor_opcode,
|
||||
unsigned long offending_sequence,
|
||||
int error_class,
|
||||
int severity,
|
||||
IcePointer values)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ice_io_error_handler (G_GNUC_UNUSED IceConn ice_conn)
|
||||
ice_io_error_handler (IceConn ice_conn)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
smc_error_handler (G_GNUC_UNUSED SmcConn smc_conn,
|
||||
G_GNUC_UNUSED Bool swap,
|
||||
G_GNUC_UNUSED int offending_minor_opcode,
|
||||
G_GNUC_UNUSED unsigned long offending_sequence,
|
||||
G_GNUC_UNUSED int error_class,
|
||||
G_GNUC_UNUSED int severity,
|
||||
G_GNUC_UNUSED SmPointer values)
|
||||
smc_error_handler (SmcConn smc_conn,
|
||||
Bool swap,
|
||||
int offending_minor_opcode,
|
||||
unsigned long offending_sequence,
|
||||
int error_class,
|
||||
int severity,
|
||||
SmPointer values)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ static EggSMClient *global_client;
|
||||
static EggSMClientMode global_client_mode = EGG_SM_CLIENT_MODE_NORMAL;
|
||||
|
||||
static void
|
||||
egg_sm_client_init (G_GNUC_UNUSED EggSMClient *client)
|
||||
egg_sm_client_init (EggSMClient *client)
|
||||
{
|
||||
;
|
||||
}
|
||||
@ -116,7 +116,7 @@ egg_sm_client_class_init (EggSMClientClass *klass)
|
||||
* handling this signal; if the user has requested that the session
|
||||
* be saved when logging out, then ::save_state will be emitted
|
||||
* separately.
|
||||
*
|
||||
*
|
||||
* If the application agrees to quit, it should then wait for either
|
||||
* the ::quit_cancelled or ::quit signals to be emitted.
|
||||
**/
|
||||
@ -181,10 +181,10 @@ static char *sm_client_id = NULL;
|
||||
static char *sm_config_prefix = NULL;
|
||||
|
||||
static gboolean
|
||||
sm_client_post_parse_func (G_GNUC_UNUSED GOptionContext *context,
|
||||
G_GNUC_UNUSED GOptionGroup *group,
|
||||
G_GNUC_UNUSED gpointer data,
|
||||
G_GNUC_UNUSED GError **error)
|
||||
sm_client_post_parse_func (GOptionContext *context,
|
||||
GOptionGroup *group,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
EggSMClient *client = egg_sm_client_get ();
|
||||
|
||||
@ -592,7 +592,7 @@ static void
|
||||
egg_sm_client_debug_handler (const char *log_domain,
|
||||
GLogLevelFlags log_level,
|
||||
const char *message,
|
||||
G_GNUC_UNUSED gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
static int debug = -1;
|
||||
|
||||
|
@ -898,8 +898,11 @@ moo_app_run (MooApp *app)
|
||||
G_CALLBACK (sm_quit_requested), app);
|
||||
g_signal_connect_swapped (app->priv->sm_client, "quit",
|
||||
G_CALLBACK (sm_quit), app);
|
||||
|
||||
gdk_threads_leave ();
|
||||
if (EGG_SM_CLIENT_GET_CLASS (app->priv->sm_client)->startup)
|
||||
EGG_SM_CLIENT_GET_CLASS (app->priv->sm_client)->startup (app->priv->sm_client, NULL);
|
||||
gdk_threads_enter ();
|
||||
|
||||
gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 1, (GSourceFunc) emit_started, app, NULL);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user