[gnome-control-center/mwleeds/disable-lock-autologin] panels: lock: Disable lock screen when autologin is enabled
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/mwleeds/disable-lock-autologin] panels: lock: Disable lock screen when autologin is enabled
- Date: Wed, 26 Aug 2020 22:36:01 +0000 (UTC)
commit a4190caa85842de9af9880729c41b07945265cf2
Author: Umang Jain <umang endlessm com>
Date: Fri Feb 28 17:23:09 2020 +0530
panels: lock: Disable lock screen when autologin is enabled
Note 2020-08-26: This patch has been in Endless OS since 2014; proposing
it upstream. Presumably if you have autologin enabled you're not
depending on your account password to keep your computer secure.
panels/lock/cc-lock-panel.c | 42 ++++++++++++++++++++++++++++++++----------
panels/lock/cc-lock-panel.ui | 4 ++--
panels/lock/meson.build | 6 +++++-
3 files changed, 39 insertions(+), 13 deletions(-)
---
diff --git a/panels/lock/cc-lock-panel.c b/panels/lock/cc-lock-panel.c
index 86800e871..f2907f041 100644
--- a/panels/lock/cc-lock-panel.c
+++ b/panels/lock/cc-lock-panel.c
@@ -24,6 +24,7 @@
#include "cc-lock-resources.h"
#include "cc-util.h"
+#include <act/act.h>
#include <gio/gdesktopappinfo.h>
#include <glib/gi18n.h>
@@ -46,6 +47,9 @@ struct _CcLockPanel
GtkSwitch *usb_protection_switch;
GDBusProxy *usb_proxy;
GtkListBoxRow *usb_protection_row;
+
+ GtkWidget *automatic_screen_lock_delay_row;
+ GtkWidget *automatic_screen_lock_row;
};
CC_PANEL_REGISTER (CcLockPanel, cc_lock_panel)
@@ -270,6 +274,8 @@ cc_lock_panel_class_init (CcLockPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcLockPanel, show_notifications_switch);
gtk_widget_class_bind_template_child (widget_class, CcLockPanel, usb_protection_switch);
gtk_widget_class_bind_template_child (widget_class, CcLockPanel, usb_protection_row);
+ gtk_widget_class_bind_template_child (widget_class, CcLockPanel, automatic_screen_lock_row);
+ gtk_widget_class_bind_template_child (widget_class, CcLockPanel, automatic_screen_lock_delay_row);
gtk_widget_class_bind_template_callback (widget_class, on_blank_screen_delay_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, on_lock_combo_changed_cb);
@@ -279,6 +285,9 @@ static void
cc_lock_panel_init (CcLockPanel *self)
{
guint value;
+ ActUserManager *um;
+ ActUser *user;
+ gboolean automatic_login;
g_resources_register (cc_lock_get_resource ());
@@ -295,17 +304,30 @@ cc_lock_panel_init (CcLockPanel *self)
self->notification_settings = g_settings_new ("org.gnome.desktop.notifications");
self->session_settings = g_settings_new ("org.gnome.desktop.session");
- g_settings_bind (self->lock_settings,
- "lock-enabled",
- self->automatic_screen_lock_switch,
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ um = act_user_manager_get_default ();
+ user = act_user_manager_get_user_by_id (um, getuid ());
+ automatic_login = act_user_get_automatic_login (user);
- g_settings_bind (self->lock_settings,
- "lock-enabled",
- self->lock_after_combo,
- "sensitive",
- G_SETTINGS_BIND_GET);
+ if (automatic_login)
+ {
+ gtk_switch_set_active (self->automatic_screen_lock_switch, FALSE);
+ gtk_widget_set_sensitive (self->automatic_screen_lock_row, FALSE);
+ gtk_widget_set_sensitive (self->automatic_screen_lock_delay_row, FALSE);
+ }
+ else
+ {
+ g_settings_bind (self->lock_settings,
+ "lock-enabled",
+ self->automatic_screen_lock_switch,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_settings_bind (self->lock_settings,
+ "lock-enabled",
+ self->lock_after_combo,
+ "sensitive",
+ G_SETTINGS_BIND_GET);
+ }
set_lock_value_for_combo (self->lock_after_combo, self);
diff --git a/panels/lock/cc-lock-panel.ui b/panels/lock/cc-lock-panel.ui
index f32dde111..3fdf537d3 100644
--- a/panels/lock/cc-lock-panel.ui
+++ b/panels/lock/cc-lock-panel.ui
@@ -60,7 +60,7 @@
<!-- Automatic Screen Lock row -->
<child>
- <object class="HdyActionRow">
+ <object class="HdyActionRow" id="automatic_screen_lock_row">
<property name="visible">true</property>
<property name="title" translatable="yes">Automatic Screen _Lock</property>
<property name="activatable-widget">automatic_screen_lock_switch</property>
@@ -77,7 +77,7 @@
<!-- Automatic Screen Lock Delay row -->
<child>
- <object class="HdyActionRow">
+ <object class="HdyActionRow" id="automatic_screen_lock_delay_row">
<property name="visible">true</property>
<property name="title" translatable="yes">Automatic _Screen Lock Delay</property>
<property name="subtitle" translatable="yes">Period after the screen blanks when the
screen is automatically locked.</property>
diff --git a/panels/lock/meson.build b/panels/lock/meson.build
index 0661af4fa..10ab3aca2 100644
--- a/panels/lock/meson.build
+++ b/panels/lock/meson.build
@@ -29,12 +29,16 @@ sources += gnome.compile_resources(
export: true
)
+deps = common_deps + [
+ accounts_dep,
+]
+
cflags += '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
panels_libs += static_library(
cappletname,
sources: sources,
include_directories: [top_inc, common_inc],
- dependencies: common_deps,
+ dependencies: deps,
c_args: cflags
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]