[Xfce4-commits] [apps/xfce4-screensaver] 01/01: Enable global lock switch
noreply at xfce.org
noreply at xfce.org
Mon Nov 19 12:18:18 CET 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit d631d50f31c3dea07b3c5f31e6c0901a0a817d0a
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Mon Nov 19 06:18:12 2018 -0500
Enable global lock switch
---
src/gs-manager.c | 50 +++++++++++++++++++++++--
src/gs-manager.h | 6 ++-
src/gs-monitor.c | 3 ++
src/gs-monitor.h | 2 +
src/gs-prefs.c | 27 +++++++++++---
src/gs-prefs.h | 19 +++++++---
src/gs-window-x11.c | 32 +++++++++++++++-
src/gs-window.h | 5 ++-
src/test-window.c | 4 +-
src/xfce4-screensaver-preferences.c | 72 +++++++++++++++++++++++++++++++++---
src/xfce4-screensaver-preferences.ui | 3 +-
11 files changed, 198 insertions(+), 25 deletions(-)
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 4c5fb77..c8b52e3 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -56,6 +56,7 @@ struct GSManagerPrivate {
glong logout_timeout;
guint lock_enabled : 1;
+ guint lock_with_saver_enabled : 1;
guint logout_enabled : 1;
guint keyboard_enabled : 1;
guint user_switch_enabled : 1;
@@ -97,6 +98,7 @@ enum {
enum {
PROP_0,
PROP_LOCK_ENABLED,
+ PROP_LOCK_WITH_SAVER_ENABLED,
PROP_LOGOUT_ENABLED,
PROP_USER_SWITCH_ENABLED,
PROP_KEYBOARD_ENABLED,
@@ -457,6 +459,30 @@ gs_manager_set_lock_enabled (GSManager *manager,
}
void
+gs_manager_get_lock_with_saver_enabled (GSManager *manager,
+ gboolean *lock_with_saver_enabled) {
+ if (lock_with_saver_enabled != NULL) {
+ *lock_with_saver_enabled = FALSE;
+ }
+
+ g_return_if_fail (GS_IS_MANAGER (manager));
+
+ if (lock_with_saver_enabled != NULL) {
+ *lock_with_saver_enabled = manager->priv->lock_with_saver_enabled;
+ }
+}
+
+void
+gs_manager_set_lock_with_saver_enabled (GSManager *manager,
+ gboolean lock_with_saver_enabled) {
+ g_return_if_fail (GS_IS_MANAGER (manager));
+
+ if (manager->priv->lock_with_saver_enabled != lock_with_saver_enabled) {
+ manager->priv->lock_with_saver_enabled = lock_with_saver_enabled;
+ }
+}
+
+void
gs_manager_set_logout_enabled (GSManager *manager,
gboolean logout_enabled) {
g_return_if_fail (GS_IS_MANAGER (manager));
@@ -503,7 +529,9 @@ gs_manager_set_user_switch_enabled (GSManager *manager,
static gboolean
activate_lock_timeout (GSManager *manager) {
- if (manager->priv->lock_enabled) {
+ if (manager->priv->lock_enabled &&
+ manager->priv->lock_with_saver_enabled)
+ {
gs_manager_set_lock_active (manager, TRUE);
}
@@ -716,6 +744,9 @@ gs_manager_set_property (GObject *object,
case PROP_LOCK_ENABLED:
gs_manager_set_lock_enabled (self, g_value_get_boolean (value));
break;
+ case PROP_LOCK_WITH_SAVER_ENABLED:
+ gs_manager_set_lock_with_saver_enabled (self, g_value_get_boolean (value));
+ break;
case PROP_LOCK_TIMEOUT:
gs_manager_set_lock_timeout (self, g_value_get_long (value));
break;
@@ -765,6 +796,9 @@ gs_manager_get_property (GObject *object,
case PROP_LOCK_ENABLED:
g_value_set_boolean (value, self->priv->lock_enabled);
break;
+ case PROP_LOCK_WITH_SAVER_ENABLED:
+ g_value_set_boolean (value, self->priv->lock_with_saver_enabled);
+ break;
case PROP_LOCK_TIMEOUT:
g_value_set_long (value, self->priv->lock_timeout);
break;
@@ -865,6 +899,13 @@ gs_manager_class_init (GSManagerClass *klass) {
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
+ PROP_LOCK_WITH_SAVER_ENABLED,
+ g_param_spec_boolean ("lock-with-saver-enabled",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
PROP_LOCK_TIMEOUT,
g_param_spec_long ("lock-timeout",
NULL,
@@ -1372,7 +1413,9 @@ gs_manager_create_window_for_monitor (GSManager *manager,
gs_debug ("Creating a window [%d,%d] (%dx%d)",
rect.x, rect.y, rect.width, rect.height);
- window = gs_window_new (monitor, manager->priv->lock_enabled);
+ window = gs_window_new (monitor,
+ manager->priv->lock_enabled,
+ manager->priv->lock_with_saver_enabled);
gs_window_set_user_switch_enabled (window, manager->priv->user_switch_enabled);
gs_window_set_logout_enabled (window, manager->priv->logout_enabled);
@@ -1403,7 +1446,7 @@ on_display_monitor_added (GdkDisplay *display,
gs_debug ("Monitor added on display %s, now there are %d",
gdk_display_get_name (display), n_monitors);
-
+
if (n_monitors == 1) {
/* Tidy up from lid-close or other headless event once we have a new monitor.
* See https://gitlab.gnome.org/GNOME/gtk/issues/1466
@@ -1550,6 +1593,7 @@ gs_manager_finalize (GObject *object) {
manager->priv->active = FALSE;
manager->priv->activate_time = 0;
manager->priv->lock_enabled = FALSE;
+ manager->priv->lock_with_saver_enabled = FALSE;
g_object_unref (manager->priv->fade);
g_object_unref (manager->priv->grab);
diff --git a/src/gs-manager.h b/src/gs-manager.h
index ff8ec38..9e68644 100644
--- a/src/gs-manager.h
+++ b/src/gs-manager.h
@@ -80,6 +80,10 @@ void gs_manager_get_lock_enabled (GSManager *manager,
gboolean *lock_enabled);
void gs_manager_set_lock_enabled (GSManager *manager,
gboolean lock_enabled);
+void gs_manager_get_lock_with_saver_enabled (GSManager *manager,
+ gboolean *lock_with_saver_enabled);
+void gs_manager_set_lock_with_saver_enabled (GSManager *manager,
+ gboolean lock_with_saver_enabled);
void gs_manager_set_lock_timeout (GSManager *manager,
glong lock_timeout);
void gs_manager_set_logout_enabled (GSManager *manager,
@@ -91,7 +95,7 @@ void gs_manager_set_logout_timeout (GSManager *manager,
void gs_manager_set_logout_command (GSManager *manager,
const char *command);
void gs_manager_set_throttled (GSManager *manager,
- gboolean lock_enabled);
+ gboolean lock_with_saver_enabled);
void gs_manager_set_cycle_timeout (GSManager *manager,
glong cycle_timeout);
void gs_manager_set_themes (GSManager *manager,
diff --git a/src/gs-monitor.c b/src/gs-monitor.c
index f304ded..ab2f09e 100644
--- a/src/gs-monitor.c
+++ b/src/gs-monitor.c
@@ -194,12 +194,15 @@ static void listener_simulate_user_activity_cb(GSListener* listener, GSMonitor*
static void _gs_monitor_update_from_prefs(GSMonitor* monitor, GSPrefs* prefs) {
gboolean lock_enabled;
+ gboolean lock_with_saver_enabled;
gboolean user_switch_enabled;
lock_enabled = monitor->priv->prefs->lock_enabled;
+ lock_with_saver_enabled = monitor->priv->prefs->lock_with_saver_enabled;
user_switch_enabled = monitor->priv->prefs->user_switch_enabled;
gs_manager_set_lock_enabled(monitor->priv->manager, lock_enabled);
+ gs_manager_set_lock_with_saver_enabled(monitor->priv->manager, lock_with_saver_enabled);
gs_manager_set_lock_timeout(monitor->priv->manager, monitor->priv->prefs->lock_timeout);
gs_manager_set_logout_enabled(monitor->priv->manager, monitor->priv->prefs->logout_enabled);
gs_manager_set_user_switch_enabled(monitor->priv->manager, user_switch_enabled);
diff --git a/src/gs-monitor.h b/src/gs-monitor.h
index 7042423..6cbe11e 100644
--- a/src/gs-monitor.h
+++ b/src/gs-monitor.h
@@ -54,6 +54,8 @@ gboolean gs_monitor_start (GSMonitor *monitor,
GError **error);
void gs_monitor_set_lock_enabled (GSMonitor *monitor,
gboolean lock_enabled);
+void gs_monitor_set_lock_with_saver_enabled (GSMonitor *monitor,
+ gboolean lock_with_saver_enabled);
G_END_DECLS
#endif /* SRC_GS_MONITOR_H_ */
diff --git a/src/gs-prefs.c b/src/gs-prefs.c
index 20aa91f..ed5c105 100644
--- a/src/gs-prefs.c
+++ b/src/gs-prefs.c
@@ -179,6 +179,12 @@ _gs_prefs_set_lock_enabled (GSPrefs *prefs,
}
static void
+_gs_prefs_set_lock_with_saver_enabled (GSPrefs *prefs,
+ gboolean value) {
+ prefs->lock_with_saver_enabled = value;
+}
+
+static void
_gs_prefs_set_keyboard_enabled (GSPrefs *prefs,
gboolean value) {
prefs->keyboard_enabled = value;
@@ -260,14 +266,19 @@ gs_prefs_load_from_settings (GSPrefs *prefs) {
DEFAULT_KEY_LOCK_ENABLED);
_gs_prefs_set_lock_enabled (prefs, bvalue);
+ bvalue = xfconf_channel_get_bool (prefs->priv->channel,
+ KEY_LOCK_WITH_SAVER_ENABLED,
+ DEFAULT_KEY_LOCK_WITH_SAVER_ENABLED);
+ _gs_prefs_set_lock_with_saver_enabled (prefs, bvalue);
+
value = xfconf_channel_get_int (prefs->priv->channel,
KEY_IDLE_DELAY,
DEFAULT_KEY_IDLE_DELAY);
_gs_prefs_set_timeout (prefs, value);
value = xfconf_channel_get_int (prefs->priv->channel,
- KEY_LOCK_DELAY,
- DEFAULT_KEY_LOCK_DELAY);
+ KEY_LOCK_WITH_SAVER_DELAY,
+ DEFAULT_KEY_LOCK_WITH_SAVER_DELAY);
_gs_prefs_set_lock_timeout (prefs, value);
value = xfconf_channel_get_int (prefs->priv->channel,
@@ -349,10 +360,10 @@ key_changed_cb (XfconfChannel *channel,
delay = xfconf_channel_get_int (channel, property, DEFAULT_KEY_IDLE_DELAY);
_gs_prefs_set_timeout (prefs, delay);
- } else if (strcmp (property, KEY_LOCK_DELAY) == 0) {
+ } else if (strcmp (property, KEY_LOCK_WITH_SAVER_DELAY) == 0) {
int delay;
- delay = xfconf_channel_get_int (channel, property, DEFAULT_KEY_LOCK_DELAY);
+ delay = xfconf_channel_get_int (channel, property, DEFAULT_KEY_LOCK_WITH_SAVER_DELAY);
_gs_prefs_set_lock_timeout (prefs, delay);
} else if (strcmp (property, KEY_IDLE_ACTIVATION_ENABLED) == 0) {
gboolean enabled;
@@ -364,6 +375,11 @@ key_changed_cb (XfconfChannel *channel,
enabled = xfconf_channel_get_bool (channel, property, DEFAULT_KEY_LOCK_ENABLED);
_gs_prefs_set_lock_enabled (prefs, enabled);
+ } else if (strcmp (property, KEY_LOCK_WITH_SAVER_ENABLED) == 0) {
+ gboolean enabled;
+
+ enabled = xfconf_channel_get_bool (channel, property, DEFAULT_KEY_LOCK_WITH_SAVER_ENABLED);
+ _gs_prefs_set_lock_with_saver_enabled (prefs, enabled);
} else if (strcmp (property, KEY_CYCLE_DELAY) == 0) {
int delay;
@@ -420,8 +436,9 @@ gs_prefs_init (GSPrefs *prefs) {
G_CALLBACK (key_changed_cb),
prefs);
- prefs->idle_activation_enabled = TRUE;
prefs->lock_enabled = TRUE;
+ prefs->idle_activation_enabled = TRUE;
+ prefs->lock_with_saver_enabled = TRUE;
prefs->logout_enabled = FALSE;
prefs->user_switch_enabled = FALSE;
diff --git a/src/gs-prefs.h b/src/gs-prefs.h
index 6683d55..863b6e9 100644
--- a/src/gs-prefs.h
+++ b/src/gs-prefs.h
@@ -77,18 +77,25 @@ G_BEGIN_DECLS
#define DEFAULT_KEY_CYCLE_DELAY 10
/**
+ * Enable locking
+ * Set this to TRUE to globally enable locking.
+ */
+#define KEY_LOCK_ENABLED "/lock/enabled"
+#define DEFAULT_KEY_LOCK_ENABLED TRUE
+
+/**
* Lock on activation
* Set this to TRUE to lock the screen when the screensaver goes active.
*/
-#define KEY_LOCK_ENABLED "/lock/saver-activation/enabled"
-#define DEFAULT_KEY_LOCK_ENABLED TRUE
+#define KEY_LOCK_WITH_SAVER_ENABLED "/lock/saver-activation/enabled"
+#define DEFAULT_KEY_LOCK_WITH_SAVER_ENABLED TRUE
/**
* Time before locking
* The number of minutes after screensaver activation before locking the screen.
*/
-#define KEY_LOCK_DELAY "/lock/saver-activation/delay"
-#define DEFAULT_KEY_LOCK_DELAY 0
+#define KEY_LOCK_WITH_SAVER_DELAY "/lock/saver-activation/delay"
+#define DEFAULT_KEY_LOCK_WITH_SAVER_DELAY 0
/**
* Allow embedding a keyboard into the window
@@ -163,8 +170,10 @@ typedef struct
GSPrefsPrivate *priv;
+ guint lock_enabled : 1; /* global lock switch */
+
guint idle_activation_enabled : 1; /* whether to activate when idle */
- guint lock_enabled : 1; /* whether to lock when active */
+ guint lock_with_saver_enabled : 1; /* whether to lock when active */
guint logout_enabled : 1; /* Whether to offer the logout option */
guint user_switch_enabled : 1; /* Whether to offer the user switch option */
guint keyboard_enabled : 1; /* Whether to try to embed a keyboard */
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 4112e8b..e7cf116 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -66,6 +66,7 @@ struct GSWindowPrivate {
guint dialog_up : 1;
guint lock_enabled : 1;
+ guint lock_with_saver_enabled : 1;
guint user_switch_enabled : 1;
guint logout_enabled : 1;
guint keyboard_enabled : 1;
@@ -128,6 +129,7 @@ enum {
PROP_OBSCURED,
PROP_DIALOG_UP,
PROP_LOCK_ENABLED,
+ PROP_LOCK_WITH_SAVER_ENABLED,
PROP_LOGOUT_ENABLED,
PROP_KEYBOARD_ENABLED,
PROP_KEYBOARD_COMMAND,
@@ -1677,6 +1679,19 @@ gs_window_set_lock_enabled (GSWindow *window,
g_object_notify (G_OBJECT (window), "lock-enabled");
}
+void
+gs_window_set_lock_with_saver_enabled (GSWindow *window,
+ gboolean lock_with_saver_enabled) {
+ g_return_if_fail (GS_IS_WINDOW (window));
+
+ if (window->priv->lock_with_saver_enabled == lock_with_saver_enabled) {
+ return;
+ }
+
+ window->priv->lock_with_saver_enabled = lock_with_saver_enabled;
+ g_object_notify (G_OBJECT (window), "lock-with-saver-enabled");
+}
+
GdkDisplay *
gs_window_get_display (GSWindow *window) {
g_return_val_if_fail (GS_IS_WINDOW (window), NULL);
@@ -1793,6 +1808,9 @@ gs_window_set_property (GObject *object,
case PROP_LOCK_ENABLED:
gs_window_set_lock_enabled (self, g_value_get_boolean (value));
break;
+ case PROP_LOCK_WITH_SAVER_ENABLED:
+ gs_window_set_lock_with_saver_enabled (self, g_value_get_boolean (value));
+ break;
case PROP_KEYBOARD_ENABLED:
gs_window_set_keyboard_enabled (self, g_value_get_boolean (value));
break;
@@ -1833,6 +1851,9 @@ gs_window_get_property (GObject *object,
case PROP_LOCK_ENABLED:
g_value_set_boolean (value, self->priv->lock_enabled);
break;
+ case PROP_LOCK_WITH_SAVER_ENABLED:
+ g_value_set_boolean (value, self->priv->lock_with_saver_enabled);
+ break;
case PROP_KEYBOARD_ENABLED:
g_value_set_boolean (value, self->priv->keyboard_enabled);
break;
@@ -2174,6 +2195,13 @@ gs_window_class_init (GSWindowClass *klass) {
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
+ PROP_LOCK_WITH_SAVER_ENABLED,
+ g_param_spec_boolean ("lock-with-saver-enabled",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
PROP_LOGOUT_ENABLED,
g_param_spec_boolean ("logout-enabled",
NULL,
@@ -2345,7 +2373,8 @@ gs_window_finalize (GObject *object) {
GSWindow *
gs_window_new (GdkMonitor *monitor,
- gboolean lock_enabled) {
+ gboolean lock_enabled,
+ gboolean lock_with_saver_enabled) {
GObject *result;
GdkDisplay *display = gdk_monitor_get_display (monitor);
GdkScreen *screen = gdk_display_get_default_screen (display);
@@ -2355,6 +2384,7 @@ gs_window_new (GdkMonitor *monitor,
"screen", screen,
"monitor", monitor,
"lock-enabled", lock_enabled,
+ "lock-with-saver-enabled", lock_with_saver_enabled,
"app-paintable", TRUE,
NULL);
diff --git a/src/gs-window.h b/src/gs-window.h
index d14158b..f3aa6ba 100644
--- a/src/gs-window.h
+++ b/src/gs-window.h
@@ -69,6 +69,8 @@ void gs_window_set_background_surface (GSWindow *window,
cairo_surface_t *surface);
void gs_window_set_lock_enabled (GSWindow *window,
gboolean lock_enabled);
+void gs_window_set_lock_with_saver_enabled (GSWindow *window,
+ gboolean lock_with_saver_enabled);
void gs_window_set_logout_enabled (GSWindow *window,
gboolean logout_enabled);
void gs_window_set_keyboard_enabled (GSWindow *window,
@@ -96,7 +98,8 @@ void gs_window_request_unlock (GSWindow *window);
void gs_window_cancel_unlock_request (GSWindow *window);
GSWindow * gs_window_new (GdkMonitor *monitor,
- gboolean lock_enabled);
+ gboolean lock_enabled,
+ gboolean lock_with_saver_enabled);
void gs_window_show (GSWindow *window);
void gs_window_destroy (GSWindow *window);
GdkWindow * gs_window_get_gdk_window (GSWindow *window);
diff --git a/src/test-window.c b/src/test-window.c
index c5e7695..3947ab2 100644
--- a/src/test-window.c
+++ b/src/test-window.c
@@ -113,16 +113,18 @@ static void
test_window (void) {
GSWindow *window;
gboolean lock_active;
+ gboolean lock_with_saver_active;
gboolean user_switch_enabled;
GdkDisplay *display;
GdkMonitor *monitor;
lock_active = TRUE;
+ lock_with_saver_active = TRUE;
user_switch_enabled = TRUE;
display = gdk_display_get_default ();
monitor = gdk_display_get_primary_monitor (display);
- window = gs_window_new (monitor, lock_active);
+ window = gs_window_new (monitor, lock_active, lock_with_saver_active);
gs_window_set_user_switch_enabled (window, user_switch_enabled);
diff --git a/src/xfce4-screensaver-preferences.c b/src/xfce4-screensaver-preferences.c
index a3cba5b..5e44472 100644
--- a/src/xfce4-screensaver-preferences.c
+++ b/src/xfce4-screensaver-preferences.c
@@ -113,10 +113,10 @@ config_get_lock_delay (gboolean *is_writable) {
if (is_writable) {
*is_writable = !xfconf_channel_is_property_locked (screensaver_channel,
- KEY_LOCK_DELAY);
+ KEY_LOCK_WITH_SAVER_DELAY);
}
- delay = xfconf_channel_get_int (screensaver_channel, KEY_LOCK_DELAY, DEFAULT_KEY_LOCK_DELAY);
+ delay = xfconf_channel_get_int (screensaver_channel, KEY_LOCK_WITH_SAVER_DELAY, DEFAULT_KEY_LOCK_WITH_SAVER_DELAY);
if (delay < 0) {
delay = 0;
@@ -127,7 +127,7 @@ config_get_lock_delay (gboolean *is_writable) {
static void
config_set_lock_delay (gint32 timeout) {
- xfconf_channel_set_int (screensaver_channel, KEY_LOCK_DELAY, timeout);
+ xfconf_channel_set_int (screensaver_channel, KEY_LOCK_WITH_SAVER_DELAY, timeout);
}
static gint32
@@ -339,6 +339,27 @@ config_set_lock_enabled (gboolean lock) {
}
static gboolean
+config_get_lock_with_saver_enabled (gboolean *is_writable) {
+ gboolean lock;
+
+ if (is_writable) {
+ *is_writable = !xfconf_channel_is_property_locked (screensaver_channel,
+ KEY_LOCK_WITH_SAVER_ENABLED);
+ }
+
+ lock = xfconf_channel_get_bool (screensaver_channel,
+ KEY_LOCK_WITH_SAVER_ENABLED,
+ DEFAULT_KEY_LOCK_WITH_SAVER_ENABLED);
+
+ return lock;
+}
+
+static void
+config_set_lock_with_saver_enabled (gboolean lock) {
+ xfconf_channel_set_bool (screensaver_channel, KEY_LOCK_WITH_SAVER_ENABLED, lock);
+}
+
+static gboolean
config_get_keyboard_enabled (gboolean *is_writable) {
gboolean enabled;
@@ -1072,6 +1093,16 @@ lock_toggled_cb (GtkSwitch *widget, gpointer user_data) {
config_set_lock_enabled (gtk_switch_get_active (widget));
+ writable = gtk_switch_get_active (widget);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "lock_grid")), writable);
+}
+
+static void
+lock_with_saver_toggled_cb (GtkSwitch *widget, gpointer user_data) {
+ gboolean writable;
+
+ config_set_lock_with_saver_enabled (gtk_switch_get_active (widget));
+
writable = lock_delay_writable && gtk_switch_get_active (widget);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "lock_saver_activation_delay_label_left")), writable);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "lock_saver_activation_delay")), writable);
@@ -1133,6 +1164,23 @@ ui_set_lock_enabled (gboolean enabled) {
gboolean active;
gboolean writable;
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "lock_enabled"));
+
+ active = gtk_switch_get_active (GTK_SWITCH (widget));
+ if (active != enabled) {
+ gtk_switch_set_active (GTK_SWITCH (widget), enabled);
+ }
+
+ writable = enabled;
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "lock_grid")), writable);
+}
+
+static void
+ui_set_lock_with_saver_enabled (gboolean enabled) {
+ GtkWidget *widget;
+ gboolean active;
+ gboolean writable;
+
widget = GTK_WIDGET (gtk_builder_get_object (builder, "lock_saver_activation_enabled"));
active = gtk_switch_get_active (GTK_SWITCH (widget));
@@ -1295,9 +1343,9 @@ key_changed_cb (XfconfChannel *channel, const gchar *key, gpointer data) {
int delay;
delay = xfconf_channel_get_int (channel, key, DEFAULT_KEY_IDLE_DELAY);
ui_set_idle_delay (delay);
- } else if (strcmp (key, KEY_LOCK_DELAY) == 0) {
+ } else if (strcmp (key, KEY_LOCK_WITH_SAVER_DELAY) == 0) {
int delay;
- delay = xfconf_channel_get_int (channel, key, DEFAULT_KEY_LOCK_DELAY);
+ delay = xfconf_channel_get_int (channel, key, DEFAULT_KEY_LOCK_WITH_SAVER_DELAY);
ui_set_lock_delay (delay);
} else if (strcmp (key, KEY_IDLE_ACTIVATION_ENABLED) == 0) {
gboolean enabled;
@@ -1307,6 +1355,10 @@ key_changed_cb (XfconfChannel *channel, const gchar *key, gpointer data) {
gboolean enabled;
enabled = xfconf_channel_get_bool (channel, key, DEFAULT_KEY_LOCK_ENABLED);
ui_set_lock_enabled (enabled);
+ } else if (strcmp (key, KEY_LOCK_WITH_SAVER_ENABLED) == 0) {
+ gboolean enabled;
+ enabled = xfconf_channel_get_bool (channel, key, DEFAULT_KEY_LOCK_WITH_SAVER_ENABLED);
+ ui_set_lock_with_saver_enabled (enabled);
} else if (strcmp (key, KEY_CYCLE_DELAY) == 0) {
int delay;
delay = xfconf_channel_get_int (channel, key, DEFAULT_KEY_CYCLE_DELAY);
@@ -1809,13 +1861,21 @@ configure_capplet (void) {
G_CALLBACK (idle_activation_toggled_cb), NULL);
/* Lock enabled */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "lock_saver_activation_enabled"));
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "lock_enabled"));
enabled = config_get_lock_enabled (&is_writable);
ui_set_lock_enabled (enabled);
set_widget_writable (widget, is_writable);
g_signal_connect (widget, "notify::active",
G_CALLBACK (lock_toggled_cb), NULL);
+ /* Lock with saver enabled */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "lock_saver_activation_enabled"));
+ enabled = config_get_lock_with_saver_enabled (&is_writable);
+ ui_set_lock_with_saver_enabled (enabled);
+ set_widget_writable (widget, is_writable);
+ g_signal_connect (widget, "notify::active",
+ G_CALLBACK (lock_with_saver_toggled_cb), NULL);
+
/* Cycle delay */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "saver_themes_cycle_delay"));
delay = config_get_cycle_delay (&is_writable);
diff --git a/src/xfce4-screensaver-preferences.ui b/src/xfce4-screensaver-preferences.ui
index 2b89110..80c32c0 100644
--- a/src/xfce4-screensaver-preferences.ui
+++ b/src/xfce4-screensaver-preferences.ui
@@ -821,9 +821,8 @@ Simon Steinbeiß
</packing>
</child>
<child>
- <object class="GtkSwitch" id="lock_enable">
+ <object class="GtkSwitch" id="lock_enabled">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list