reversed previous patch waiting for more feedback
authorAndrea Florio <andrea@opensuse.org>
Fri, 16 Jul 2010 23:11:23 +0000 (01:11 +0200)
committerAndrea Florio <andrea@opensuse.org>
Fri, 16 Jul 2010 23:11:23 +0000 (01:11 +0200)
lxsession-logout/lxsession-logout.c

index e524936..435216c 100644 (file)
@@ -25,7 +25,6 @@
 #include <glib/gi18n.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <signal.h>
@@ -74,7 +73,6 @@ typedef struct {
     int ltsp : 1;                      /* Shutdown and reboot is accomplished via LTSP */
 } HandlerContext;
 
-static gboolean lock_screen(void);
 static gboolean verify_running(char * display_manager, char * executable);
 static void logout_clicked(GtkButton * button, HandlerContext * handler_context);
 static void change_root_property(GtkWidget* w, const char* prop_name, const char* value);
@@ -87,52 +85,6 @@ static void cancel_clicked(GtkButton * button, gpointer user_data);
 static GtkPositionType get_banner_position(void);
 static GdkPixbuf * get_background_pixbuf(void);
 
-/* Try to lock the screen, return TRUE on success, FALSE if no suitable
- * screensaver was found or the screensaver command exited abnormally.
- */
-static gboolean lock_screen(void)
-{
-    gchar *dummy;
-    gint exit_status;
-
-    if ((dummy = g_find_program_in_path("xscreensaver-command")) != NULL)
-    {
-        g_spawn_command_line_sync("xscreensaver-command -lock",
-                NULL,
-                NULL,
-                &exit_status,
-                NULL);
-    }
-    else if ((dummy = g_find_program_in_path("gnome-screensaver-command")) !=
-            NULL)
-    {
-        g_spawn_command_line_sync("gnome-screensaver-command --lock",
-                NULL,
-                NULL,
-                &exit_status,
-                NULL);
-    }
-    else if ((dummy = g_find_program_in_path("xlock")) != NULL)
-    {
-        g_spawn_command_line_sync("xlock -mode blank",
-                NULL,
-                NULL,
-                &exit_status,
-                NULL);
-    }
-    else
-    {
-        return FALSE;
-    }
-
-    g_free(dummy);
-
-    if (WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == 0)
-        return TRUE;
-
-    return FALSE;
-}
-
 /* Verify that a program is running and that an executable is available. */
 static gboolean verify_running(char * display_manager, char * executable)
 {
@@ -253,8 +205,6 @@ static void suspend_clicked(GtkButton * button, HandlerContext * handler_context
     char * error_result = NULL;
     gtk_label_set_text(GTK_LABEL(handler_context->error_label), NULL);
 
-    lock_screen();
-
     if (handler_context->suspend_UPower)
         error_result = dbus_UPower_Suspend();
     else if (handler_context->suspend_HAL)
@@ -271,8 +221,6 @@ static void hibernate_clicked(GtkButton * button, HandlerContext * handler_conte
     char * error_result = NULL;
     gtk_label_set_text(GTK_LABEL(handler_context->error_label), NULL);
 
-    lock_screen();
-
     if (handler_context->hibernate_UPower)
         error_result = dbus_UPower_Hibernate();
     else if (handler_context->hibernate_HAL)
@@ -288,8 +236,6 @@ static void switch_user_clicked(GtkButton * button, HandlerContext * handler_con
 {
     gtk_label_set_text(GTK_LABEL(handler_context->error_label), NULL);
 
-    lock_screen();
-
     if (handler_context->switch_user_GDM)
         g_spawn_command_line_sync("gdmflexiserver --startnew", NULL, NULL, NULL, NULL);
     else if (handler_context->switch_user_KDM)