diff options
Diffstat (limited to 'mate-session')
47 files changed, 489 insertions, 353 deletions
diff --git a/mate-session/Makefile.am b/mate-session/Makefile.am index ffd88d1..26c5509 100644 --- a/mate-session/Makefile.am +++ b/mate-session/Makefile.am @@ -150,6 +150,13 @@ org.gnome.SessionManager.Presence.h: org.gnome.SessionManager.Presence.xml Makef org.gnome.SessionManager.Presence.c: org.gnome.SessionManager.Presence.h @: # generated as a side-effect +gsm-marshal.c: gsm-marshal.list + $(AM_V_GEN)echo "#include \"gsm-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --prefix=gsm_marshal --body >> $@ + +gsm-marshal.h: gsm-marshal.list + $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --prefix=gsm_marshal --header > $@ + BUILT_SOURCES = \ gsm-marshal.c \ gsm-marshal.h \ diff --git a/mate-session/gs-idle-monitor.c b/mate-session/gs-idle-monitor.c index e1ad441..e613e5c 100644 --- a/mate-session/gs-idle-monitor.c +++ b/mate-session/gs-idle-monitor.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mate-session/gs-idle-monitor.h b/mate-session/gs-idle-monitor.h index cf4be06..0eb316b 100644 --- a/mate-session/gs-idle-monitor.h +++ b/mate-session/gs-idle-monitor.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,6 @@ void gs_idle_monitor_remove_watch (GSIdleMonitor *monitor, guint id); void gs_idle_monitor_reset (GSIdleMonitor *monitor); - G_END_DECLS #endif /* __GS_IDLE_MONITOR_H */ diff --git a/mate-session/gsm-app.c b/mate-session/gsm-app.c index 42aebb2..2edde33 100644 --- a/mate-session/gsm-app.c +++ b/mate-session/gsm-app.c @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-app.h b/mate-session/gsm-app.h index 5baedd6..8c2424a 100644 --- a/mate-session/gsm-app.h +++ b/mate-session/gsm-app.h @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-autostart-app.c b/mate-session/gsm-autostart-app.c index f6ebda1..a73e9bb 100644 --- a/mate-session/gsm-autostart-app.c +++ b/mate-session/gsm-autostart-app.c @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -114,16 +115,6 @@ is_disabled (GsmApp *app) priv = gsm_autostart_app_get_instance_private (GSM_AUTOSTART_APP(app)); - /* GSM_AUTOSTART_APP_ENABLED_KEY key, used by old mate-session */ - if (egg_desktop_file_has_key (priv->desktop_file, - GSM_AUTOSTART_APP_ENABLED_KEY, NULL) && - !egg_desktop_file_get_boolean (priv->desktop_file, - GSM_AUTOSTART_APP_ENABLED_KEY, NULL)) { - g_debug ("app %s is disabled by " GSM_AUTOSTART_APP_ENABLED_KEY, - gsm_app_peek_id (app)); - return TRUE; - } - /* Hidden key, used by autostart spec */ if (egg_desktop_file_get_boolean (priv->desktop_file, EGG_DESKTOP_FILE_KEY_HIDDEN, NULL)) { @@ -1063,7 +1054,6 @@ gsm_autostart_app_provides (GsmApp *app, GsmAutostartApp *aapp; GsmAutostartAppPrivate *priv; - g_return_val_if_fail (GSM_IS_APP (app), FALSE); aapp = GSM_AUTOSTART_APP (app); diff --git a/mate-session/gsm-autostart-app.h b/mate-session/gsm-autostart-app.h index 48b2c48..c3a68d1 100644 --- a/mate-session/gsm-autostart-app.h +++ b/mate-session/gsm-autostart-app.h @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -42,7 +43,6 @@ struct _GsmAutostartAppClass GsmApp *gsm_autostart_app_new (const char *desktop_file); -#define GSM_AUTOSTART_APP_ENABLED_KEY "X-MATE-Autostart-enabled" #define GSM_AUTOSTART_APP_PHASE_KEY "X-MATE-Autostart-Phase" #define GSM_AUTOSTART_APP_PROVIDES_KEY "X-MATE-Provides" #define GSM_AUTOSTART_APP_STARTUP_ID_KEY "X-MATE-Autostart-startup-id" diff --git a/mate-session/gsm-client.c b/mate-session/gsm-client.c index e82d79f..ffe7db6 100644 --- a/mate-session/gsm-client.c +++ b/mate-session/gsm-client.c @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -545,7 +546,6 @@ gsm_client_cancel_end_session (GsmClient *client, return GSM_CLIENT_GET_CLASS (client)->impl_cancel_end_session (client, error); } - gboolean gsm_client_query_end_session (GsmClient *client, guint flags, diff --git a/mate-session/gsm-client.h b/mate-session/gsm-client.h index 5ba6bb1..c40c169 100644 --- a/mate-session/gsm-client.h +++ b/mate-session/gsm-client.h @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -93,13 +94,11 @@ GQuark gsm_client_error_quark (void); const char *gsm_client_peek_id (GsmClient *client); - const char * gsm_client_peek_startup_id (GsmClient *client); const char * gsm_client_peek_app_id (GsmClient *client); guint gsm_client_peek_restart_style_hint (GsmClient *client); guint gsm_client_peek_status (GsmClient *client); - char *gsm_client_get_app_name (GsmClient *client); void gsm_client_set_app_id (GsmClient *client, const char *app_id); diff --git a/mate-session/gsm-consolekit.c b/mate-session/gsm-consolekit.c index 870fc80..b7c24bd 100644 --- a/mate-session/gsm-consolekit.c +++ b/mate-session/gsm-consolekit.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -244,7 +245,7 @@ gsm_consolekit_ensure_ck_connection (GsmConsolekit *manager, out: if (priv->is_connected != is_connected) { - priv->is_connected = is_connected; + priv->is_connected = (is_connected != FALSE); g_object_notify (G_OBJECT (manager), "is-connected"); } @@ -544,7 +545,6 @@ gsm_consolekit_attempt_hibernate (GsmConsolekit *manager) G_TYPE_INVALID, G_TYPE_INVALID); - if (!res) { g_warning ("Unable to hibernate system: %s", error->message); g_error_free (error); @@ -709,7 +709,6 @@ gsm_consolekit_set_session_idle (GsmConsolekit *manager, goto out; } - g_debug ("Updating ConsoleKit idle status: %d", is_idle); message = dbus_message_new_method_call (CK_NAME, session_id, @@ -1064,7 +1063,6 @@ out: return ret; } - GsmConsolekit * gsm_get_consolekit (void) { diff --git a/mate-session/gsm-consolekit.h b/mate-session/gsm-consolekit.h index ce4a821..c41f92a 100644 --- a/mate-session/gsm-consolekit.h +++ b/mate-session/gsm-consolekit.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-dbus-client.c b/mate-session/gsm-dbus-client.c index 64cf2d3..5a45416 100644 --- a/mate-session/gsm-dbus-client.c +++ b/mate-session/gsm-dbus-client.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-dbus-client.h b/mate-session/gsm-dbus-client.h index a67afe9..d22ab5d 100644 --- a/mate-session/gsm-dbus-client.h +++ b/mate-session/gsm-dbus-client.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-inhibit-dialog.c b/mate-session/gsm-inhibit-dialog.c index a4e86e8..791a7b3 100644 --- a/mate-session/gsm-inhibit-dialog.c +++ b/mate-session/gsm-inhibit-dialog.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,13 +92,25 @@ G_DEFINE_TYPE (GsmInhibitDialog, gsm_inhibit_dialog, GTK_TYPE_DIALOG) static void lock_screen (GsmInhibitDialog *dialog) { - GError *error; - error = NULL; - g_spawn_command_line_async ("mate-screensaver-command --lock", &error); - if (error != NULL) { - g_warning ("Couldn't lock screen: %s", error->message); - g_error_free (error); + gchar **screen_locker_command; + + if ((screen_locker_command = gsm_get_screen_locker_command ()) != NULL) { + GError *error = NULL; + + g_spawn_async (NULL, screen_locker_command, NULL, + G_SPAWN_DEFAULT | G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, &error); + + if (error != NULL) { + g_warning ("Couldn't lock screen: %s", error->message); + g_error_free (error); + } + + } else { + g_warning ("Couldn't find any screen locker"); } + + g_strfreev (screen_locker_command); } static void @@ -268,7 +281,6 @@ _load_icon (GtkIconTheme *icon_theme, return retval; } - static GdkPixbuf * scale_pixbuf (GdkPixbuf *pixbuf, int max_width, @@ -296,8 +308,8 @@ scale_pixbuf (GdkPixbuf *pixbuf, /* always scale down, allow to disable scaling up */ if (scale_factor < 1.0 || !no_stretch_hint) { - int scale_x = (int) (pw * scale_factor); - int scale_y = (int) (ph * scale_factor); + int scale_x = (int) (scale_factor * (float) pw); + int scale_y = (int) (scale_factor * (float) ph); g_debug ("Scaling to %dx%d", scale_x, scale_y); return gdk_pixbuf_scale_simple (pixbuf, scale_x, @@ -721,7 +733,6 @@ gsm_inhibit_dialog_set_inhibitor_store (GsmInhibitDialog *dialog, g_object_unref (dialog->inhibitors); } - g_debug ("GsmInhibitDialog: setting store %p", store); dialog->inhibitors = store; diff --git a/mate-session/gsm-inhibit-dialog.h b/mate-session/gsm-inhibit-dialog.h index 89c7121..313b493 100644 --- a/mate-session/gsm-inhibit-dialog.h +++ b/mate-session/gsm-inhibit-dialog.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mate-session/gsm-inhibitor.c b/mate-session/gsm-inhibitor.c index 1d99850..0c8ed7c 100644 --- a/mate-session/gsm-inhibitor.c +++ b/mate-session/gsm-inhibitor.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-inhibitor.h b/mate-session/gsm-inhibitor.h index af9e796..ff8ec5f 100644 --- a/mate-session/gsm-inhibitor.h +++ b/mate-session/gsm-inhibitor.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-logout-dialog.c b/mate-session/gsm-logout-dialog.c index a775283..35f36e2 100644 --- a/mate-session/gsm-logout-dialog.c +++ b/mate-session/gsm-logout-dialog.c @@ -2,6 +2,7 @@ * * Copyright (C) 2006 Vincent Untz * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-logout-dialog.h b/mate-session/gsm-logout-dialog.h index 2166521..686af38 100644 --- a/mate-session/gsm-logout-dialog.h +++ b/mate-session/gsm-logout-dialog.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2006 Vincent Untz + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c index 73bc64f..bb7ddf9 100644 --- a/mate-session/gsm-manager.c +++ b/mate-session/gsm-manager.c @@ -3,6 +3,7 @@ * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,7 +82,6 @@ #define GDM_FLEXISERVER_COMMAND "gdmflexiserver" #define GDM_FLEXISERVER_ARGS "--startnew Standard" - #define LOCKDOWN_SCHEMA "org.mate.lockdown" #define KEY_LOCK_DISABLE "disable-lock-screen" #define KEY_LOG_OUT_DISABLE "disable-log-out" @@ -143,9 +143,8 @@ typedef struct { GSettings *settings_lockdown; GSettings *settings_screensaver; - const char *renderer; + //char *renderer; - DBusGProxy *bus_proxy; GDBusConnection *connection; GsmExportedManager *skeleton; gboolean dbus_disconnected : 1; @@ -186,6 +185,74 @@ static void _handle_client_end_session_response (GsmManager *manager, static gboolean auto_save_is_enabled (GsmManager *manager); static void maybe_save_session (GsmManager *manager); +gboolean gsm_manager_set_phase (GsmManager *manager, GsmManagerPhase phase); +//void _gsm_manager_set_renderer (GsmManager *manager, const char *renderer); +static gboolean gsm_manager_get_clients (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager); +static gboolean +gsm_manager_get_inhibitors (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager); +static gboolean +gsm_manager_inhibit (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + const char *app_id, + guint toplevel_xid, + const char *reason, + guint flags, + GsmManager *manager); +static gboolean +gsm_manager_is_inhibited (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + guint flags, + GsmManager *manager); +static gboolean +gsm_manager_initialization_error (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + const char *message, + gboolean fatal, + GsmManager *manager); +static gboolean +gsm_manager_register_client (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + const char *app_id, + const char *startup_id, + GsmManager *manager); +void request_logout (GsmManager *manager, GsmManagerLogoutMode mode); +void request_reboot (GsmManager *manager); +gboolean gsm_manager_logout (GsmManager *manager, + guint logout_mode, + GError **error); +gboolean +gsm_manager_request_reboot (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager); +gboolean +gsm_manager_request_shutdown (GsmManager *manager, + GError **error); +gboolean +gsm_manager_setenv (GsmManager *manager, + const char *variable, + const char *value, + GError **error); +static gboolean +gsm_manager_shutdown (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager); +static gboolean +gsm_manager_uninhibit (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + guint cookie, + GsmManager *manager); +static gboolean +gsm_manager_unregister_client (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + const char *client_id, + GsmManager *manager); +static void +user_logout (GsmManager *manager, + GsmManagerLogoutMode mode); static gpointer manager_object = NULL; @@ -232,29 +299,29 @@ debug_clients (GsmManager *manager) manager); } -static gboolean -_debug_inhibitor (const char *id G_GNUC_UNUSED, - GsmInhibitor *inhibitor, - GsmManager *manager G_GNUC_UNUSED) -{ - g_debug ("GsmManager: Inhibitor app:%s client:%s bus-name:%s reason:%s", - gsm_inhibitor_peek_app_id (inhibitor), - gsm_inhibitor_peek_client_id (inhibitor), - gsm_inhibitor_peek_bus_name (inhibitor), - gsm_inhibitor_peek_reason (inhibitor)); - return FALSE; -} - -static void -debug_inhibitors (GsmManager *manager) -{ - GsmManagerPrivate *priv; +//static gboolean +//_debug_inhibitor (const char *id G_GNUC_UNUSED, +// GsmInhibitor *inhibitor, +// GsmManager *manager G_GNUC_UNUSED) +//{ +// g_debug ("GsmManager: Inhibitor app:%s client:%s bus-name:%s reason:%s", +// gsm_inhibitor_peek_app_id (inhibitor), +// gsm_inhibitor_peek_client_id (inhibitor), +// gsm_inhibitor_peek_bus_name (inhibitor), +// gsm_inhibitor_peek_reason (inhibitor)); +// return FALSE; +//} - priv = gsm_manager_get_instance_private (manager); - gsm_store_foreach (priv->inhibitors, - (GsmStoreFunc)_debug_inhibitor, - manager); -} +//static void +//debug_inhibitors (GsmManager *manager) +//{ +// GsmManagerPrivate *priv; +// +// priv = gsm_manager_get_instance_private (manager); +// gsm_store_foreach (priv->inhibitors, +// (GsmStoreFunc)_debug_inhibitor, +// manager); +//} static gboolean _find_by_cookie (const char *id G_GNUC_UNUSED, @@ -752,7 +819,6 @@ typedef struct { guint flags; } ClientEndSessionData; - static gboolean _client_end_session (GsmClient *client, ClientEndSessionData *data) @@ -1209,21 +1275,34 @@ sleep_lock_is_enabled (GsmManager *manager) static void manager_perhaps_lock (GsmManager *manager) { - GError *error; - gboolean ret; + gchar **screen_locker_command; - /* only lock if mate-screensaver is set to lock */ - if (!sleep_lock_is_enabled (manager)) { - return; - } + if ((screen_locker_command = gsm_get_screen_locker_command ()) != NULL) { + GError *error = NULL; - /* do this sync to ensure it's on the screen when we start suspending */ - error = NULL; - ret = g_spawn_command_line_sync ("mate-screensaver-command --lock", NULL, NULL, NULL, &error); - if (!ret) { - g_warning ("Couldn't lock screen: %s", error->message); - g_error_free (error); + /* only lock if mate-screensaver is set to lock */ + if (!g_strcmp0 (screen_locker_command[0], "mate-screensaver-command") && + !sleep_lock_is_enabled (manager)) { + goto clear_screen_locker_command; + } + + /* do this sync to ensure it's on the screen when we start suspending */ + g_spawn_sync (NULL, screen_locker_command, NULL, + G_SPAWN_DEFAULT | G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL, NULL, &error); + + if (error) { + g_warning ("Couldn't lock screen: %s", error->message); + g_error_free (error); + } + + } else { + g_warning ("Couldn't find any screen locker"); } + +clear_screen_locker_command: + + g_strfreev (screen_locker_command); } static void @@ -1667,8 +1746,9 @@ _gsm_manager_set_renderer (GsmManager *manager, const char *renderer) { GsmManagerPrivate *priv; + priv = gsm_manager_get_instance_private (manager); - priv->renderer = renderer; + gsm_exported_manager_set_renderer (priv->skeleton, renderer); } static gboolean @@ -1848,7 +1928,6 @@ _disconnect_client (GsmManager *manager, goto out; } - if (app == NULL) { g_debug ("GsmManager: unable to find application for client - not restarting"); goto out; @@ -1954,29 +2033,29 @@ remove_clients_for_connection (GsmManager *manager, } } -static gboolean -inhibitor_has_bus_name (gpointer key G_GNUC_UNUSED, - GsmInhibitor *inhibitor, - RemoveClientData *data) -{ - gboolean matches; - const char *bus_name_b; - - bus_name_b = gsm_inhibitor_peek_bus_name (inhibitor); - - matches = FALSE; - if (! IS_STRING_EMPTY (data->service_name) && ! IS_STRING_EMPTY (bus_name_b)) { - matches = (strcmp (data->service_name, bus_name_b) == 0); - if (matches) { - g_debug ("GsmManager: removing inhibitor from %s for reason '%s' on connection %s", - gsm_inhibitor_peek_app_id (inhibitor), - gsm_inhibitor_peek_reason (inhibitor), - gsm_inhibitor_peek_bus_name (inhibitor)); - } - } - - return matches; -} +//static gboolean +//inhibitor_has_bus_name (gpointer key G_GNUC_UNUSED, +// GsmInhibitor *inhibitor, +// RemoveClientData *data) +//{ +// gboolean matches; +// const char *bus_name_b; +// +// bus_name_b = gsm_inhibitor_peek_bus_name (inhibitor); +// +// matches = FALSE; +// if (! IS_STRING_EMPTY (data->service_name) && ! IS_STRING_EMPTY (bus_name_b)) { +// matches = (strcmp (data->service_name, bus_name_b) == 0); +// if (matches) { +// g_debug ("GsmManager: removing inhibitor from %s for reason '%s' on connection %s", +// gsm_inhibitor_peek_app_id (inhibitor), +// gsm_inhibitor_peek_reason (inhibitor), +// gsm_inhibitor_peek_bus_name (inhibitor)); +// } +// } +// +// return matches; +//} static gboolean gsm_manager_can_shutdown (GsmExportedManager *skeleton, @@ -2018,26 +2097,66 @@ gsm_manager_can_shutdown (GsmExportedManager *skeleton, return TRUE; } -static void -remove_inhibitors_for_connection (GsmManager *manager, - const char *service_name) +static gboolean +_app_has_autostart_condition (const char *id G_GNUC_UNUSED, + GsmApp *app, + const char *condition) { - guint UNUSED_VARIABLE n_removed; - RemoveClientData data; + gboolean has; + gboolean disabled; + + has = gsm_app_has_autostart_condition (app, condition); + disabled = gsm_app_peek_is_disabled (app); + + return has && !disabled; +} + +static gboolean +gsm_manager_is_autostart_condition_handled (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + const char *condition, + GsmManager *manager) +{ + GsmApp *app; GsmManagerPrivate *priv; + gboolean handled; - data.service_name = service_name; - data.manager = manager; priv = gsm_manager_get_instance_private (manager); + app = (GsmApp *) gsm_store_find (priv->apps,( + GsmStoreFunc) _app_has_autostart_condition, + (char *)condition); + + if (app != NULL) { + handled = TRUE; + } else { + handled = FALSE; + } - debug_inhibitors (manager); + gsm_exported_manager_complete_is_autostart_condition_handled (skeleton, invocation, handled); - n_removed = gsm_store_foreach_remove (priv->inhibitors, - (GsmStoreFunc)inhibitor_has_bus_name, - &data); + return TRUE; } //static void +//remove_inhibitors_for_connection (GsmManager *manager, +// const char *service_name) +//{ +// guint UNUSED_VARIABLE n_removed; +// RemoveClientData data; +// GsmManagerPrivate *priv; +// +// data.service_name = service_name; +// data.manager = manager; +// priv = gsm_manager_get_instance_private (manager); +// +// debug_inhibitors (manager); +// +// n_removed = gsm_store_foreach_remove (priv->inhibitors, +// (GsmStoreFunc)inhibitor_has_bus_name, +// &data); +//} + +//static void //on_gsm_system_active_changed (GsmSystem *system, // GParamSpec *pspec, // GsmManager *self) @@ -2053,10 +2172,24 @@ remove_inhibitors_for_connection (GsmManager *manager, // gsm_exported_manager_set_session_is_active (priv->skeleton, is_active); //} +static gboolean +gsm_manager_is_session_running (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager) +{ + GsmManagerPrivate *priv; + + priv = gsm_manager_get_instance_private (manager); + + gsm_exported_manager_complete_is_session_running (skeleton, invocation, + priv->phase == GSM_MANAGER_PHASE_RUNNING); + return TRUE; +} + static void -on_session_connection_closed (GDBusConnection *connection, - gboolean remote_peer_vanished, - GError *error, +on_session_connection_closed (GDBusConnection *connection G_GNUC_UNUSED, + gboolean remote_peer_vanished G_GNUC_UNUSED, + GError *error G_GNUC_UNUSED, gpointer user_data) { GsmManager *manager; @@ -2070,10 +2203,75 @@ on_session_connection_closed (GDBusConnection *connection, remove_clients_for_connection (manager, NULL); } +gboolean +gsm_manager_logout (GsmManager *manager, + guint logout_mode, + GError **error) +{ + GsmManagerPrivate *priv; + g_debug ("GsmManager: Logout called"); + + g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); + + priv = gsm_manager_get_instance_private (manager); + if (priv->phase != GSM_MANAGER_PHASE_RUNNING) { + g_set_error (error, + GSM_MANAGER_ERROR, + GSM_MANAGER_ERROR_NOT_IN_RUNNING, + "Shutdown interface is only available during the Running phase"); + return FALSE; + } + + if (_log_out_is_locked_down (manager)) { + g_set_error (error, + GSM_MANAGER_ERROR, + GSM_MANAGER_ERROR_LOCKED_DOWN, + "Logout has been locked down"); + return FALSE; + } + + switch (logout_mode) { + case GSM_MANAGER_LOGOUT_MODE_NORMAL: + case GSM_MANAGER_LOGOUT_MODE_NO_CONFIRMATION: + case GSM_MANAGER_LOGOUT_MODE_FORCE: + user_logout (manager, logout_mode); + break; + + default: + g_debug ("Unknown logout mode option"); + + g_set_error (error, + GSM_MANAGER_ERROR, + GSM_MANAGER_ERROR_INVALID_OPTION, + "Unknown logout mode flag"); + return FALSE; + } + + return TRUE; +} + +static gboolean +gsm_manager_logout_dbus (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + guint logout_mode, + GsmManager *manager) +{ + GError *error = NULL; + + g_debug ("GsmManager: Logout called"); + + if (!gsm_manager_logout (manager, logout_mode, &error)) { + g_dbus_method_invocation_take_error (invocation, error); + } else { + gsm_exported_manager_complete_logout (skeleton, invocation); + } + + return TRUE; +} + static gboolean register_manager (GsmManager *manager) { - GDBusConnection *connection; GsmManagerPrivate *priv; GError *error = NULL; @@ -2132,7 +2330,7 @@ register_manager (GsmManager *manager) G_CALLBACK (gsm_manager_unregister_client), manager); priv->dbus_disconnected = FALSE; - g_signal_connect (connection, "closed", + g_signal_connect (priv->connection, "closed", G_CALLBACK (on_session_connection_closed), manager); //g_signal_connect (priv->system, "notify::active", @@ -2526,7 +2724,6 @@ gsm_manager_set_client_store (GsmManager *manager, g_object_unref (priv->clients); } - g_debug ("GsmManager: setting client store %p", store); priv->clients = store; @@ -2585,9 +2782,9 @@ gsm_manager_get_property (GObject *object, case PROP_CLIENT_STORE: g_value_set_object (value, priv->clients); break; - case PROP_RENDERER: - g_value_set_string (value, priv->renderer); - break; +// case PROP_RENDERER: +// g_value_set_string (value, priv->renderer); +// break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2750,13 +2947,13 @@ gsm_manager_class_init (GsmManagerClass *klass) GSM_TYPE_STORE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - g_object_class_install_property (object_class, - PROP_RENDERER, - g_param_spec_string ("renderer", - NULL, - NULL, - NULL, - G_PARAM_READABLE)); +// g_object_class_install_property (object_class, +// PROP_RENDERER, +// g_param_spec_string ("renderer", +// NULL, +// NULL, +// NULL, +// G_PARAM_READABLE)); } static void @@ -2947,11 +3144,12 @@ gsm_manager_setenv (GsmManager *manager, return TRUE; } -gboolean -gsm_manager_initialization_error (GsmManager *manager, - const char *message, - gboolean fatal, - GError **error) +static gboolean +gsm_manager_initialization_error (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + const char *message, + gboolean fatal, + GsmManager *manager) { GsmManagerPrivate *priv; g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); @@ -2959,15 +3157,17 @@ gsm_manager_initialization_error (GsmManager *manager, priv = gsm_manager_get_instance_private (manager); if (priv->phase > GSM_MANAGER_PHASE_INITIALIZATION) { - g_set_error (error, - GSM_MANAGER_ERROR, - GSM_MANAGER_ERROR_NOT_IN_INITIALIZATION, - "InitializationError interface is only available during the Initialization phase"); - return FALSE; + g_dbus_method_invocation_return_error (invocation, + GSM_MANAGER_ERROR, + GSM_MANAGER_ERROR_NOT_IN_INITIALIZATION, + "InitializationError interface is only available during the Initialization phase"); + return TRUE; } gsm_util_init_error (fatal, "%s", message); + gsm_exported_manager_complete_initialization_error (skeleton, invocation); + return TRUE; } @@ -3075,7 +3275,7 @@ request_reboot_privileges_completed_systemd (GsmSystemd *systemd, } #endif -static void +void request_reboot (GsmManager *manager) { GsmConsolekit *consolekit; @@ -3335,8 +3535,7 @@ request_hibernate (GsmManager *manager) gtk_widget_show (priv->inhibit_dialog); } - -static void +void request_logout (GsmManager *manager, GsmManagerLogoutMode mode) { @@ -3569,8 +3768,8 @@ gsm_manager_request_shutdown (GsmManager *manager, return TRUE; } -static gboolean -gsm_manager_reboot (GsmExportedManager *skeleton, +gboolean +gsm_manager_request_reboot (GsmExportedManager *skeleton, GDBusMethodInvocation *invocation, GsmManager *manager) { @@ -3655,72 +3854,6 @@ gsm_manager_shutdown (GsmExportedManager *skeleton, return TRUE; } -gboolean -gsm_manager_logout (GsmManager *manager, - guint logout_mode, - GError **error) -{ - GsmManagerPrivate *priv; - g_debug ("GsmManager: Logout called"); - - g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); - - priv = gsm_manager_get_instance_private (manager); - if (priv->phase != GSM_MANAGER_PHASE_RUNNING) { - g_set_error (error, - GSM_MANAGER_ERROR, - GSM_MANAGER_ERROR_NOT_IN_RUNNING, - "Shutdown interface is only available during the Running phase"); - return FALSE; - } - - if (_log_out_is_locked_down (manager)) { - g_set_error (error, - GSM_MANAGER_ERROR, - GSM_MANAGER_ERROR_LOCKED_DOWN, - "Logout has been locked down"); - return FALSE; - } - - switch (logout_mode) { - case GSM_MANAGER_LOGOUT_MODE_NORMAL: - case GSM_MANAGER_LOGOUT_MODE_NO_CONFIRMATION: - case GSM_MANAGER_LOGOUT_MODE_FORCE: - user_logout (manager, logout_mode); - break; - - default: - g_debug ("Unknown logout mode option"); - - g_set_error (error, - GSM_MANAGER_ERROR, - GSM_MANAGER_ERROR_INVALID_OPTION, - "Unknown logout mode flag"); - return FALSE; - } - - return TRUE; -} - -static gboolean -gsm_manager_logout_dbus (GsmExportedManager *skeleton, - GDBusMethodInvocation *invocation, - guint logout_mode, - GsmManager *manager) -{ - GError *error = NULL; - - g_debug ("GsmManager: Logout called"); - - if (!gsm_manager_logout (manager, logout_mode, &error)) { - g_dbus_method_invocation_take_error (invocation, error); - } else { - gsm_exported_manager_complete_logout (skeleton, invocation); - } - - return TRUE; -} - static gboolean gsm_manager_register_client (GsmExportedManager *skeleton, GDBusMethodInvocation *invocation, @@ -3729,7 +3862,7 @@ gsm_manager_register_client (GsmExportedManager *skeleton, GsmManager *manager) { char *new_startup_id; - char *sender; + const char *sender; GsmClient *client; GsmApp *app; GsmManagerPrivate *priv; @@ -3857,13 +3990,14 @@ gsm_manager_unregister_client (GsmExportedManager *skeleton, return TRUE; } -gboolean -gsm_manager_inhibit (GsmManager *manager, +static gboolean +gsm_manager_inhibit (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, const char *app_id, guint toplevel_xid, const char *reason, guint flags, - DBusGMethodInvocation *context) + GsmManager *manager) { GsmInhibitor *inhibitor; guint cookie; @@ -3885,9 +4019,8 @@ gsm_manager_inhibit (GsmManager *manager, GSM_MANAGER_ERROR_GENERAL, "Forced logout cannot be inhibited"); g_debug ("GsmManager: Unable to inhibit: %s", new_error->message); - dbus_g_method_return_error (context, new_error); - g_error_free (new_error); - return FALSE; + g_dbus_method_invocation_take_error (invocation, new_error); + return TRUE; } if (IS_STRING_EMPTY (app_id)) { @@ -3897,9 +4030,8 @@ gsm_manager_inhibit (GsmManager *manager, GSM_MANAGER_ERROR_GENERAL, "Application ID not specified"); g_debug ("GsmManager: Unable to inhibit: %s", new_error->message); - dbus_g_method_return_error (context, new_error); - g_error_free (new_error); - return FALSE; + g_dbus_method_invocation_take_error (invocation, new_error); + return TRUE; } if (IS_STRING_EMPTY (reason)) { @@ -3909,8 +4041,7 @@ gsm_manager_inhibit (GsmManager *manager, GSM_MANAGER_ERROR_GENERAL, "Reason not specified"); g_debug ("GsmManager: Unable to inhibit: %s", new_error->message); - dbus_g_method_return_error (context, new_error); - g_error_free (new_error); + g_dbus_method_invocation_take_error (invocation, new_error); return FALSE; } @@ -3921,8 +4052,7 @@ gsm_manager_inhibit (GsmManager *manager, GSM_MANAGER_ERROR_GENERAL, "Invalid inhibit flags"); g_debug ("GsmManager: Unable to inhibit: %s", new_error->message); - dbus_g_method_return_error (context, new_error); - g_error_free (new_error); + g_dbus_method_invocation_take_error (invocation, new_error); return FALSE; } @@ -3931,20 +4061,21 @@ gsm_manager_inhibit (GsmManager *manager, toplevel_xid, flags, reason, - dbus_g_method_get_sender (context), + g_dbus_method_invocation_get_sender (invocation), cookie); gsm_store_add (priv->inhibitors, gsm_inhibitor_peek_id (inhibitor), G_OBJECT (inhibitor)); g_object_unref (inhibitor); - dbus_g_method_return (context, cookie); + gsm_exported_manager_complete_inhibit (skeleton, invocation, cookie); return TRUE; } -gboolean -gsm_manager_uninhibit (GsmManager *manager, +static gboolean +gsm_manager_uninhibit (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, guint cookie, - DBusGMethodInvocation *context) + GsmManager *manager) { GsmInhibitor *inhibitor; GsmManagerPrivate *priv; @@ -3963,10 +4094,9 @@ gsm_manager_uninhibit (GsmManager *manager, new_error = g_error_new (GSM_MANAGER_ERROR, GSM_MANAGER_ERROR_GENERAL, "Unable to uninhibit: Invalid cookie"); - dbus_g_method_return_error (context, new_error); g_debug ("Unable to uninhibit: %s", new_error->message); - g_error_free (new_error); - return FALSE; + g_dbus_method_invocation_take_error (invocation, new_error); + return TRUE; } g_debug ("GsmManager: removing inhibitor %s %u reason '%s' %u connection %s", @@ -3978,18 +4108,19 @@ gsm_manager_uninhibit (GsmManager *manager, gsm_store_remove (priv->inhibitors, gsm_inhibitor_peek_id (inhibitor)); - dbus_g_method_return (context); + gsm_exported_manager_complete_uninhibit (skeleton, invocation); return TRUE; } -gboolean -gsm_manager_is_inhibited (GsmManager *manager, - guint flags, - gboolean *is_inhibited, - GError *error) +static gboolean +gsm_manager_is_inhibited (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + guint flags, + GsmManager *manager) { GsmInhibitor *inhibitor; + gboolean is_inhibited; GsmManagerPrivate *priv; g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); @@ -3997,19 +4128,20 @@ gsm_manager_is_inhibited (GsmManager *manager, priv = gsm_manager_get_instance_private (manager); if (priv->inhibitors == NULL || gsm_store_size (priv->inhibitors) == 0) { - *is_inhibited = FALSE; - return TRUE; - } - - inhibitor = (GsmInhibitor *) gsm_store_find (priv->inhibitors, - (GsmStoreFunc)inhibitor_has_flag, - GUINT_TO_POINTER (flags)); - if (inhibitor == NULL) { - *is_inhibited = FALSE; + is_inhibited = FALSE; } else { - *is_inhibited = TRUE; + inhibitor = (GsmInhibitor *) gsm_store_find (priv->inhibitors, + (GsmStoreFunc)inhibitor_has_flag, + GUINT_TO_POINTER (flags)); + if (inhibitor == NULL) { + is_inhibited = FALSE; + } else { + is_inhibited = TRUE; + } } + gsm_exported_manager_complete_is_inhibited (skeleton, invocation, is_inhibited); + return TRUE; } @@ -4023,83 +4155,48 @@ listify_store_ids (char *id, return FALSE; } -gboolean -gsm_manager_get_clients (GsmManager *manager, - GPtrArray **clients, - GError **error) -{ - GsmManagerPrivate *priv; - g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); - - if (clients == NULL) { - return FALSE; - } - - *clients = g_ptr_array_new (); - priv = gsm_manager_get_instance_private (manager); - gsm_store_foreach (priv->clients, (GsmStoreFunc)listify_store_ids, clients); - - return TRUE; -} - -gboolean -gsm_manager_get_inhibitors (GsmManager *manager, - GPtrArray **inhibitors, - GError **error) +static gboolean +gsm_manager_get_clients (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager) { + GPtrArray *clients; GsmManagerPrivate *priv; g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); - if (inhibitors == NULL) { - return FALSE; - } - - *inhibitors = g_ptr_array_new (); priv = gsm_manager_get_instance_private (manager); - gsm_store_foreach (priv->inhibitors, + clients = g_ptr_array_new_with_free_func (g_free); + gsm_store_foreach (priv->clients, (GsmStoreFunc) listify_store_ids, - inhibitors); + &clients); + g_ptr_array_add (clients, NULL); + + gsm_exported_manager_complete_get_clients (skeleton, invocation, + (const gchar * const *) clients->pdata); + g_ptr_array_unref (clients); return TRUE; } - static gboolean -_app_has_autostart_condition (const char *id, - GsmApp *app, - const char *condition) -{ - gboolean has; - gboolean disabled; - - has = gsm_app_has_autostart_condition (app, condition); - disabled = gsm_app_peek_is_disabled (app); - - return has && !disabled; -} - -gboolean -gsm_manager_is_autostart_condition_handled (GsmManager *manager, - const char *condition, - gboolean *handled, - GError **error) +gsm_manager_get_inhibitors (GsmExportedManager *skeleton, + GDBusMethodInvocation *invocation, + GsmManager *manager) { - GsmApp *app; GsmManagerPrivate *priv; - - g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); + GPtrArray *inhibitors; priv = gsm_manager_get_instance_private (manager); - app = (GsmApp *) gsm_store_find (priv->apps,( - GsmStoreFunc) _app_has_autostart_condition, - (char *)condition); + inhibitors = g_ptr_array_new_with_free_func (g_free); + gsm_store_foreach (priv->inhibitors, + (GsmStoreFunc) listify_store_ids, + &inhibitors); + g_ptr_array_add (inhibitors, NULL); - if (app != NULL) { - *handled = TRUE; - } else { - *handled = FALSE; - } + gsm_exported_manager_complete_get_inhibitors (skeleton, invocation, + (const gchar * const *) inhibitors->pdata); + g_ptr_array_unref (inhibitors); return TRUE; } @@ -4212,17 +4309,3 @@ gsm_manager_add_autostart_apps_from_dir (GsmManager *manager, return TRUE; } - -gboolean -gsm_manager_is_session_running (GsmManager *manager, - gboolean *running, - GError **error) -{ - GsmManagerPrivate *priv; - - g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); - - priv = gsm_manager_get_instance_private (manager); - *running = (priv->phase == GSM_MANAGER_PHASE_RUNNING); - return TRUE; -} diff --git a/mate-session/gsm-manager.h b/mate-session/gsm-manager.h index 06551b7..207833e 100644 --- a/mate-session/gsm-manager.h +++ b/mate-session/gsm-manager.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +19,6 @@ * */ - #ifndef __GSM_MANAGER_H #define __GSM_MANAGER_H @@ -112,8 +112,14 @@ gboolean gsm_manager_add_legacy_session_apps (GsmManager * void gsm_manager_start (GsmManager *manager); - /* exported methods */ +void _gsm_manager_set_renderer (GsmManager *manager, + const char *renderer); +gboolean gsm_manager_logout (GsmManager *manager, + guint logout_mode, + GError **error); +gboolean gsm_manager_set_phase (GsmManager *manager, + GsmManagerPhase phase); #if 0 gboolean gsm_manager_register_client (GsmManager *manager, @@ -150,9 +156,6 @@ gboolean gsm_manager_shutdown (GsmManager * gboolean gsm_manager_can_shutdown (GsmManager *manager, gboolean *shutdown_available, GError **error); -gboolean gsm_manager_logout (GsmManager *manager, - guint logout_mode, - GError **error); gboolean gsm_manager_setenv (GsmManager *manager, const char *variable, @@ -173,15 +176,11 @@ gboolean gsm_manager_is_autostart_condition_handled (GsmManager * const char *condition, gboolean *handled, GError **error); -gboolean gsm_manager_set_phase (GsmManager *manager, - GsmManagerPhase phase); gboolean gsm_manager_is_session_running (GsmManager *manager, gboolean *running, GError **error); -void _gsm_manager_set_renderer (GsmManager *manager, - const char *renderer); #endif G_END_DECLS diff --git a/mate-session/gsm-marshal.list b/mate-session/gsm-marshal.list new file mode 100644 index 0000000..f31a8b1 --- /dev/null +++ b/mate-session/gsm-marshal.list @@ -0,0 +1,3 @@ +BOOLEAN:POINTER +VOID:BOOLEAN,BOOLEAN,BOOLEAN,STRING +VOID:BOOLEAN,BOOLEAN,POINTER diff --git a/mate-session/gsm-presence.c b/mate-session/gsm-presence.c index 148519a..d948ec9 100644 --- a/mate-session/gsm-presence.c +++ b/mate-session/gsm-presence.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-presence.h b/mate-session/gsm-presence.h index 30adbea..7728f21 100644 --- a/mate-session/gsm-presence.h +++ b/mate-session/gsm-presence.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-session-save.c b/mate-session/gsm-session-save.c index 67d9945..4c88f08 100644 --- a/mate-session/gsm-session-save.c +++ b/mate-session/gsm-session-save.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * gsm-session-save.c * Copyright (C) 2008 Lucas Rocha. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-session-save.h b/mate-session/gsm-session-save.h index 4e0cf47..3d8b837 100644 --- a/mate-session/gsm-session-save.h +++ b/mate-session/gsm-session-save.h @@ -1,5 +1,6 @@ /* gsm-session-save.h * Copyright (C) 2008 Lucas Rocha. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-store.c b/mate-session/gsm-store.c index 67d6520..6a62805 100644 --- a/mate-session/gsm-store.c +++ b/mate-session/gsm-store.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007-2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +156,6 @@ gsm_store_lookup (GsmStore *store, return object; } - typedef struct { GsmStoreFunc func; diff --git a/mate-session/gsm-store.h b/mate-session/gsm-store.h index 94da2f7..fe1b1a5 100644 --- a/mate-session/gsm-store.h +++ b/mate-session/gsm-store.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007-2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +19,6 @@ * */ - #ifndef __GSM_STORE_H #define __GSM_STORE_H diff --git a/mate-session/gsm-systemd.c b/mate-session/gsm-systemd.c index 8a375c2..7f7dde1 100644 --- a/mate-session/gsm-systemd.c +++ b/mate-session/gsm-systemd.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Stefano Karapetsas <[email protected]> + * Copyright (C) 2013-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -244,7 +245,7 @@ gsm_systemd_ensure_sd_connection (GsmSystemd *manager, out: if (priv->is_connected != is_connected) { - priv->is_connected = is_connected; + priv->is_connected = (is_connected != FALSE); g_object_notify (G_OBJECT (manager), "is-connected"); } @@ -632,7 +633,6 @@ out: } } - void gsm_systemd_set_session_idle (GsmSystemd *manager, gboolean is_idle) @@ -1008,7 +1008,6 @@ gsm_systemd_get_current_session_type (GsmSystemd *manager) return session_class; } - GsmSystemd * gsm_get_systemd (void) { diff --git a/mate-session/gsm-systemd.h b/mate-session/gsm-systemd.h index 9522709..5ee663b 100644 --- a/mate-session/gsm-systemd.h +++ b/mate-session/gsm-systemd.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Stefano Karapetsas + * Copyright (C) 2013-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/gsm-util.c b/mate-session/gsm-util.c index a769d8c..a760fc3 100644 --- a/mate-session/gsm-util.c +++ b/mate-session/gsm-util.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * gsm-util.c * Copyright (C) 2008 Lucas Rocha. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -38,6 +39,33 @@ static gchar *_saved_session_dir = NULL; +gchar ** +gsm_get_screen_locker_command (void) +{ + const char *screen_locker_command[] = { + "mate-screensaver-command --lock", + "xscreensaver-command -lock", + NULL + }; + gchar **screen_locker_argv = NULL; + gsize i; + + for (i = 0; screen_locker_command[i] != NULL && screen_locker_argv == NULL; i++) { + gchar **argv; + char *path; + + argv = g_strsplit (screen_locker_command [i], " ", -1); + path = g_find_program_in_path (argv[0]); + if (path) + screen_locker_argv = g_strdupv (argv); + + g_free (path); + g_strfreev (argv); + } + + return screen_locker_argv; +} + char * gsm_util_find_desktop_file_for_app_name (const char *name, char **autostart_dirs) @@ -207,7 +235,6 @@ gsm_util_get_saved_session_dir (void) return _saved_session_dir; } - char ** gsm_util_get_autostart_dirs () { diff --git a/mate-session/gsm-util.h b/mate-session/gsm-util.h index dcec60e..fc76fef 100644 --- a/mate-session/gsm-util.h +++ b/mate-session/gsm-util.h @@ -1,5 +1,6 @@ /* gsm-util.h * Copyright (C) 2008 Lucas Rocha. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -29,6 +30,8 @@ extern "C" { #define IS_STRING_EMPTY(x) ((x)==NULL||(x)[0]=='\0') +gchar** gsm_get_screen_locker_command (void); + char * gsm_util_find_desktop_file_for_app_name (const char *app_name, char **dirs); diff --git a/mate-session/gsm-xsmp-client.c b/mate-session/gsm-xsmp-client.c index 1fcd44e..cae732a 100644 --- a/mate-session/gsm-xsmp-client.c +++ b/mate-session/gsm-xsmp-client.c @@ -2,6 +2,7 @@ * * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -214,7 +215,6 @@ gsm_xsmp_client_init (GsmXSMPClient *client) priv->next_save_yourself_allow_interact = FALSE; } - static void delete_property (GsmXSMPClient *client, const char *name) @@ -247,7 +247,6 @@ delete_property (GsmXSMPClient *client, SmFreeProperty (prop); } - static void debug_print_property (SmProp *prop) { @@ -279,7 +278,6 @@ debug_print_property (SmProp *prop) } } - static void set_properties_callback (SmsConn conn G_GNUC_UNUSED, SmPointer manager_data, @@ -441,7 +439,7 @@ do_save_yourself (GsmXSMPClient *client, g_debug ("GsmXSMPClient: queuing new SaveYourself for '%s'", priv->description); priv->next_save_yourself = save_type; - priv->next_save_yourself_allow_interact = allow_interact; + priv->next_save_yourself_allow_interact = (allow_interact != FALSE); } else { priv->current_save_yourself = save_type; /* make sure we don't have anything queued */ @@ -1105,7 +1103,6 @@ register_client_callback (SmsConn conn, priv->description, previous_id ? previous_id : "NULL"); - /* There are three cases: * 1. id is NULL - we'll use a new one * 2. id is known - we'll use known one @@ -1152,7 +1149,6 @@ register_client_callback (SmsConn conn, return TRUE; } - static void save_yourself_request_callback (SmsConn conn G_GNUC_UNUSED, SmPointer manager_data, diff --git a/mate-session/gsm-xsmp-client.h b/mate-session/gsm-xsmp-client.h index d080948..917cf91 100644 --- a/mate-session/gsm-xsmp-client.h +++ b/mate-session/gsm-xsmp-client.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007 Novell, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -40,7 +41,6 @@ struct _GsmXSMPClientClass gboolean (*logout_request) (GsmXSMPClient *client, gboolean prompt); - void (*saved_state) (GsmXSMPClient *client); void (*request_phase2) (GsmXSMPClient *client); diff --git a/mate-session/gsm-xsmp-server.c b/mate-session/gsm-xsmp-server.c index 1566aba..719d65c 100644 --- a/mate-session/gsm-xsmp-server.c +++ b/mate-session/gsm-xsmp-server.c @@ -3,6 +3,7 @@ * Copyright (C) 2007 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -509,9 +510,9 @@ update_iceauthority (GsmXsmpServer *server, } for (e = entries; e; e = e->next) { - IceAuthFileEntry *auth_entry = e->data; - IceWriteAuthFileEntry (fp, auth_entry); - IceFreeAuthFileEntry (auth_entry); + IceAuthFileEntry *auth_file_entry = e->data; + IceWriteAuthFileEntry (fp, auth_file_entry); + IceFreeAuthFileEntry (auth_file_entry); } g_slist_free (entries); @@ -528,7 +529,6 @@ update_iceauthority (GsmXsmpServer *server, return ok; } - static void setup_listener (GsmXsmpServer *server) { diff --git a/mate-session/gsm-xsmp-server.h b/mate-session/gsm-xsmp-server.h index 29f72db..2e1f934 100644 --- a/mate-session/gsm-xsmp-server.h +++ b/mate-session/gsm-xsmp-server.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +19,6 @@ * */ - #ifndef __GSM_XSMP_SERVER_H #define __GSM_XSMP_SERVER_H diff --git a/mate-session/main.c b/mate-session/main.c index 56795ac..68e3864 100644 --- a/mate-session/main.c +++ b/mate-session/main.c @@ -2,6 +2,7 @@ * * Copyright (C) 2006 Novell, Inc. * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,7 +22,6 @@ #include <config.h> -#include <libintl.h> #include <signal.h> #include <stdlib.h> #include <string.h> @@ -83,7 +83,6 @@ static gboolean failsafe = FALSE; static gboolean show_version = FALSE; static gboolean debug = FALSE; static gboolean disable_acceleration_check = FALSE; -static char *gl_renderer = NULL; static gboolean initialize_gsettings (void) @@ -575,7 +574,7 @@ static void set_overlay_scroll (void) } static gboolean -check_gl (GError **error) +check_gl (gchar **gl_renderer, GError **error) { int status; char *argv[] = { LIBEXECDIR "/mate-session-check-accelerated", NULL }; @@ -585,7 +584,7 @@ check_gl (GError **error) return TRUE; } - if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, &gl_renderer, NULL, + if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, gl_renderer, NULL, &status, error)) { return FALSE; } @@ -605,6 +604,7 @@ int main(int argc, char** argv) GSettings* accessibility_settings; MdmSignalHandler* signal_handler; static char** override_autostart_dirs = NULL; + char* gl_renderer = NULL; gboolean gl_failed = FALSE; static GOptionEntry entries[] = { @@ -622,9 +622,11 @@ int main(int argc, char** argv) gsm_util_init_error(TRUE, "%s", error->message); } +#ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ sa.sa_handler = SIG_IGN; sa.sa_flags = 0; @@ -668,7 +670,7 @@ int main(int argc, char** argv) g_debug ("hardware acceleration check is disabled"); } else { /* Check GL, if it doesn't work out then force software fallback */ - if (!check_gl (&error)) { + if (!check_gl (&gl_renderer, &error)) { gl_failed = TRUE; g_debug ("hardware acceleration check failed: %s", @@ -676,7 +678,7 @@ int main(int argc, char** argv) g_clear_error (&error); if (g_getenv ("LIBGL_ALWAYS_SOFTWARE") == NULL) { g_setenv ("LIBGL_ALWAYS_SOFTWARE", "1", TRUE); - if (!check_gl (&error)) { + if (!check_gl (&gl_renderer, &error)) { g_warning ("software acceleration check failed: %s", error? error->message : ""); g_clear_error (&error); diff --git a/mate-session/mdm-log.c b/mate-session/mdm-log.c index 021060d..7195d74 100644 --- a/mate-session/mdm-log.c +++ b/mate-session/mdm-log.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mate-session/mdm-log.h b/mate-session/mdm-log.h index 9e78449..eee6c29 100644 --- a/mate-session/mdm-log.h +++ b/mate-session/mdm-log.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mate-session/mdm-signal-handler.c b/mate-session/mdm-signal-handler.c index 56287b2..dd03087 100644 --- a/mate-session/mdm-signal-handler.c +++ b/mate-session/mdm-signal-handler.c @@ -2,6 +2,7 @@ * * Copyright (C) 2006 Red Hat, Inc. * Copyright (C) 2007 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -232,7 +233,6 @@ static gboolean crashlogger_get_backtrace(void) return success; } - static void mdm_signal_handler_backtrace(void) { struct stat s; diff --git a/mate-session/mdm-signal-handler.h b/mate-session/mdm-signal-handler.h index dd4dc04..6fca4f7 100644 --- a/mate-session/mdm-signal-handler.h +++ b/mate-session/mdm-signal-handler.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mate-session/mdm.c b/mate-session/mdm.c index 2e0e712..cef3755 100644 --- a/mate-session/mdm.c +++ b/mate-session/mdm.c @@ -4,6 +4,7 @@ * Copyright (C) 2005 Red Hat, Inc. * Copyright (C) 2002, 2003 George Lebl * Copyright (C) 2001 Queen of England, + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/mdm.h b/mate-session/mdm.h index 4eec264..5f7eed8 100644 --- a/mate-session/mdm.h +++ b/mate-session/mdm.h @@ -3,6 +3,7 @@ * Copyright (C) 2005 Red Hat, Inc. * Copyright (C) 2002, 2003 George Lebl * Copyright (C) 2001 Queen of England, + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/msm-gnome.c b/mate-session/msm-gnome.c index b43f1ad..ce47b72 100644 --- a/mate-session/msm-gnome.c +++ b/mate-session/msm-gnome.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2004-2005 Benedikt Meurer <[email protected]> * 2013 Stefano Karapetsas <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,6 @@ #define GNOME_KEYRING_DAEMON "gnome-keyring-daemon" - static gboolean gnome_compat_started = FALSE; static Window gnome_smproxy_window = None; @@ -90,8 +90,6 @@ gnome_keyring_daemon_startup (void) g_child_watch_add (pid, gnome_keyring_daemon_finished, NULL); } - - static void msm_compat_gnome_smproxy_startup (void) { @@ -128,7 +126,6 @@ msm_compat_gnome_smproxy_startup (void) gdk_x11_display_error_trap_pop_ignored (gdkdisplay); } - static void msm_compat_gnome_smproxy_shutdown (void) { @@ -146,7 +143,6 @@ msm_compat_gnome_smproxy_shutdown (void) gdk_x11_display_error_trap_pop_ignored (gdkdisplay); } - void msm_gnome_start (void) { @@ -181,7 +177,6 @@ msm_gnome_start (void) g_object_unref (settings); } - void msm_gnome_stop (void) { diff --git a/mate-session/msm-gnome.h b/mate-session/msm-gnome.h index e3c2e60..b658ba2 100644 --- a/mate-session/msm-gnome.h +++ b/mate-session/msm-gnome.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2004 Benedikt Meurer <[email protected]> * 2013 Stefano Karapetsas <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mate-session/test-client-dbus.c b/mate-session/test-client-dbus.c index ccb40b1..6b3afc5 100644 --- a/mate-session/test-client-dbus.c +++ b/mate-session/test-client-dbus.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/mate-session/test-inhibit.c b/mate-session/test-inhibit.c index 7207cb9..8c9f694 100644 --- a/mate-session/test-inhibit.c +++ b/mate-session/test-inhibit.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as |