SHA256
1
0
forked from pool/lxsession

Accepting request 43147 from home:gberh:branches:X11:lxde

Copy from home:gberh:branches:X11:lxde/lxsession via accept of submit request 43147 revision 2.
Request was accepted with message:
OK

OBS-URL: https://build.opensuse.org/request/show/43147
OBS-URL: https://build.opensuse.org/package/show/X11:lxde/lxsession?expand=0&rev=32
This commit is contained in:
Guido Berhoerster 2010-07-17 11:04:41 +00:00 committed by Git OBS Bridge
parent 390562b73c
commit 4d55b88891
2 changed files with 33 additions and 37 deletions

View File

@ -1,6 +1,6 @@
diff -urN lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c lxsession-0.4.4/lxsession-logout/lxsession-logout.c diff -urN lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c lxsession-0.4.4/lxsession-logout/lxsession-logout.c
--- lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c 2010-03-31 18:28:50.000000000 +0200 --- lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c 2010-03-31 18:28:50.000000000 +0200
+++ lxsession-0.4.4/lxsession-logout/lxsession-logout.c 2010-07-14 00:10:28.000000000 +0200 +++ lxsession-0.4.4/lxsession-logout/lxsession-logout.c 2010-07-17 11:23:57.000000000 +0200
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <sys/types.h> #include <sys/types.h>
@ -17,7 +17,7 @@ diff -urN lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c lxsession-0.4
static gboolean verify_running(char * display_manager, char * executable); static gboolean verify_running(char * display_manager, char * executable);
static void logout_clicked(GtkButton * button, HandlerContext * handler_context); static void logout_clicked(GtkButton * button, HandlerContext * handler_context);
static void shutdown_clicked(GtkButton * button, HandlerContext * handler_context); static void shutdown_clicked(GtkButton * button, HandlerContext * handler_context);
@@ -83,6 +85,52 @@ @@ -83,6 +85,46 @@
static GtkPositionType get_banner_position(void); static GtkPositionType get_banner_position(void);
static GdkPixbuf * get_background_pixbuf(void); static GdkPixbuf * get_background_pixbuf(void);
@ -26,43 +26,37 @@ diff -urN lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c lxsession-0.4
+ */ + */
+static gboolean lock_screen(void) +static gboolean lock_screen(void)
+{ +{
+ gchar *dummy; + gint i;
+ gint argcp;
+ gchar **argvp;
+ gint exit_status; + gint exit_status;
+ gchar *locking_commands[] = {
+ "xscreensaver-command -lock",
+ "gnome-screensaver-command --lock",
+ "xlock -mode blank",
+ NULL
+ };
+ +
+ if ((dummy = g_find_program_in_path("xscreensaver-command")) != NULL) + for (i = 0; locking_commands[i] != NULL; ++i)
+ { + {
+ g_spawn_command_line_sync("xscreensaver-command -lock", + g_shell_parse_argv(locking_commands[i], &argcp, &argvp, NULL);
+ g_spawn_sync(NULL,
+ argvp,
+ NULL,
+ G_SPAWN_SEARCH_PATH|G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL,
+ NULL,
+ NULL, + NULL,
+ NULL, + NULL,
+ &exit_status, + &exit_status,
+ NULL); + NULL);
+ } + g_strfreev (argvp);
+ 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)
+ + {
+ if (WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == 0) + return TRUE;
+ return TRUE; + }
+ }
+ +
+ return FALSE; + return FALSE;
+} +}
@ -70,30 +64,27 @@ diff -urN lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c lxsession-0.4
/* Verify that a program is running and that an executable is available. */ /* Verify that a program is running and that an executable is available. */
static gboolean verify_running(char * display_manager, char * executable) static gboolean verify_running(char * display_manager, char * executable)
{ {
@@ -187,6 +235,8 @@ @@ -187,6 +229,7 @@
/* Handler for "clicked" signal on Suspend button. */ /* Handler for "clicked" signal on Suspend button. */
static void suspend_clicked(GtkButton * button, HandlerContext * handler_context) static void suspend_clicked(GtkButton * button, HandlerContext * handler_context)
{ {
+ lock_screen(); + lock_screen();
+
if (handler_context->suspend_DeviceKit) if (handler_context->suspend_DeviceKit)
dbus_DeviceKit_Suspend(); dbus_DeviceKit_Suspend();
else if (handler_context->suspend_HAL) else if (handler_context->suspend_HAL)
@@ -197,6 +247,8 @@ @@ -197,6 +240,7 @@
/* Handler for "clicked" signal on Hibernate button. */ /* Handler for "clicked" signal on Hibernate button. */
static void hibernate_clicked(GtkButton * button, HandlerContext * handler_context) static void hibernate_clicked(GtkButton * button, HandlerContext * handler_context)
{ {
+ lock_screen(); + lock_screen();
+
if (handler_context->hibernate_DeviceKit) if (handler_context->hibernate_DeviceKit)
dbus_DeviceKit_Hibernate(); dbus_DeviceKit_Hibernate();
else if (handler_context->hibernate_HAL) else if (handler_context->hibernate_HAL)
@@ -207,6 +259,8 @@ @@ -207,6 +251,7 @@
/* Handler for "clicked" signal on Switch User button. */ /* Handler for "clicked" signal on Switch User button. */
static void switch_user_clicked(GtkButton * button, HandlerContext * handler_context) static void switch_user_clicked(GtkButton * button, HandlerContext * handler_context)
{ {
+ lock_screen(); + lock_screen();
+
if (handler_context->switch_user_GDM) if (handler_context->switch_user_GDM)
g_spawn_command_line_sync("gdmflexiserver --startnew", NULL, NULL, NULL, NULL); g_spawn_command_line_sync("gdmflexiserver --startnew", NULL, NULL, NULL, NULL);
else if (handler_context->switch_user_KDM) else if (handler_context->switch_user_KDM)

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Jul 17 09:51:25 UTC 2010 - guido+opensuse.org@berhoerster.name
- refine patch for bnc#622083
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Jul 17 08:21:07 UTC 2010 - andrea@opensuse.org Sat Jul 17 08:21:07 UTC 2010 - andrea@opensuse.org