gnome-power-manager-07-screensaver.diff revision 12400
--- data/gpm-prefs.glade.orig 2008-02-04 10:15:41.232379000 +0800
+++ data/gpm-prefs.glade 2008-02-04 16:22:55.133775000 +0800
@@ -1784,6 +1784,25 @@
</child>
<child>
+ <widget class="GtkCheckButton" id="checkbutton_screen_lock">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Lock screen when computer is restored from blank screen, suspend or hibernate</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkCheckButton" id="checkbutton_general_ambient">
<property name="visible">True</property>
<property name="can_focus">True</property>
--- data/gnome-power-manager.schemas.in.orig 2008-02-04 10:12:40.941327000 +0800
+++ data/gnome-power-manager.schemas.in 2008-02-04 10:24:07.361341000 +0800
@@ -929,6 +929,18 @@
</schema>
<schema>
+ <applyto>/apps/gnome-power-manager/ui/enable_screen_lock</applyto>
+ <owner>gnome-power-manager</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>If screen lock should be used</short>
+ <long>If screen lock should be used when lid is closed, or system performs a suspend or hibernate action.</long>
+ </locale>
+ </schema>
+
+ <schema>
<applyto>/apps/gnome-power-manager/ui/show_actions_in_menu</applyto>
<owner>gnome-power-manager</owner>
--- src/gpm-screensaver.c.orig 2008-02-05 13:29:47.692582000 +0800
+++ src/gpm-screensaver.c 2008-02-05 13:31:01.580705000 +0800
@@ -29,6 +29,9 @@
#include "gpm-conf.h"
#include "gpm-screensaver.h"
#include "gpm-debug.h"
+#ifdef SOLARIS
+#include <gdk/gdk.h>
+#endif
#include <libdbus-proxy.h>
static void gpm_screensaver_class_init (GpmScreensaverClass *klass);
@@ -239,6 +243,26 @@
guint sleepcount = 0;
DBusGProxy *proxy;
+#ifdef SOLARIS
+ GError *error = NULL;
+ char *command;
+ GdkScreen *screen;
+
+ command = g_strdup ("/usr/X11/bin/xscreensaver-command -lock");
+ screen = gdk_screen_get_default ();
+ gpm_debug ("Doing xscreensaver lock!");
+ if (! gdk_spawn_command_line_on_screen (screen, command, &error)) {
+ g_warning ("Cannot lock screen: %s", error->message);
+ g_error_free (error);
+ }
+ g_free (command);
+
+ for (; sleepcount < 20; sleepcount ++) {
+ /* Sleep for 1/10s */
+ g_usleep (1000 * 100);
+ }
+ gpm_debug ("Screen locking is sucessful!, sleepcount = %d", sleepcount);
+#else
g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
proxy = dbus_proxy_get_proxy (screensaver->priv->gproxy);
@@ -265,6 +289,7 @@
break;
}
}
+#endif
return TRUE;
}
--- src/gpm-prefs-core.c.org 2008-02-05 13:56:31.775812000 +0800
+++ src/gpm-prefs-core.c 2008-02-05 13:52:48.084206000 +0800
@@ -890,6 +890,10 @@
gpm_prefs_setup_checkbox (prefs, "checkbutton_notification_sound",
GPM_CONF_UI_ENABLE_BEEPING);
+ /* set up the screen locking checkbox */
+ gpm_prefs_setup_checkbox (prefs, "checkbutton_screen_lock",
+ GPM_CONF_UI_ENABLE_SCREEN_LOCK);
+
if (prefs->priv->has_batteries == TRUE) {
/* there's no use case for displaying this option */
gtk_widget_hide_all (radiobutton_icon_never);
--- src/gpm-control.c.orig 2007-07-27 07:28:18.000000000 +0800
+++ src/gpm-control.c 2008-02-13 13:06:29.259536000 +0800
@@ -377,6 +377,10 @@
{
gboolean do_lock;
gboolean use_ss_setting;
+#ifdef SOLARIS
+ gpm_conf_get_bool (control->priv->conf, GPM_CONF_UI_ENABLE_SCREEN_LOCK, &do_lock);
+ gpm_debug ("Using custom locking settings (%i)", do_lock);
+#else
/* This allows us to over-ride the custom lock settings set in gconf
with a system default set in gnome-screensaver.
See bug #331164 for all the juicy details. :-) */
@@ -388,6 +392,7 @@
gpm_conf_get_bool (control->priv->conf, policy, &do_lock);
gpm_debug ("Using custom locking settings (%i)", do_lock);
}
+#endif
return do_lock;
}
--- src/gpm-conf.h.orig 2008-02-18 16:47:20.806807000 +0800
+++ src/gpm-conf.h 2008-02-18 16:48:11.849112000 +0800
@@ -148,6 +148,7 @@
#define GPM_CONF_UI_SHOW_ACTIONS_IN_MENU GPM_CONF_DIR "/ui/show_actions_in_menu"
#define GPM_CONF_UI_ENABLE_BEEPING GPM_CONF_DIR "/ui/enable_sound"
#define GPM_CONF_UI_SHOW_CONTEXT_MENU GPM_CONF_DIR "/ui/show_context_menu"
+#define GPM_CONF_UI_ENABLE_SCREEN_LOCK GPM_CONF_DIR "/ui/enable_screen_lock"
/* we use the gnome-session key now */
#define GPM_CONF_SESSION_REQUEST_SAVE "/apps/gnome-session/options/auto_save_session"