summaryrefslogtreecommitdiff
path: root/mate-session
diff options
context:
space:
mode:
Diffstat (limited to 'mate-session')
-rw-r--r--mate-session/gsm-autostart-app.c10
-rw-r--r--mate-session/gsm-autostart-app.h1
-rw-r--r--mate-session/gsm-inhibit-dialog.c24
-rw-r--r--mate-session/gsm-manager.c37
-rw-r--r--mate-session/gsm-util.c27
-rw-r--r--mate-session/gsm-util.h2
6 files changed, 72 insertions, 29 deletions
diff --git a/mate-session/gsm-autostart-app.c b/mate-session/gsm-autostart-app.c
index 8c90759..deaa05d 100644
--- a/mate-session/gsm-autostart-app.c
+++ b/mate-session/gsm-autostart-app.c
@@ -114,16 +114,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)) {
diff --git a/mate-session/gsm-autostart-app.h b/mate-session/gsm-autostart-app.h
index 48b2c48..08237c4 100644
--- a/mate-session/gsm-autostart-app.h
+++ b/mate-session/gsm-autostart-app.h
@@ -42,7 +42,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-inhibit-dialog.c b/mate-session/gsm-inhibit-dialog.c
index a4e86e8..89f46e0 100644
--- a/mate-session/gsm-inhibit-dialog.c
+++ b/mate-session/gsm-inhibit-dialog.c
@@ -91,13 +91,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
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index 9b0200f..260836a 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -1224,21 +1224,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
diff --git a/mate-session/gsm-util.c b/mate-session/gsm-util.c
index a769d8c..76bf9cd 100644
--- a/mate-session/gsm-util.c
+++ b/mate-session/gsm-util.c
@@ -38,6 +38,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)
diff --git a/mate-session/gsm-util.h b/mate-session/gsm-util.h
index dcec60e..d1c3c5c 100644
--- a/mate-session/gsm-util.h
+++ b/mate-session/gsm-util.h
@@ -29,6 +29,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);