diff --git a/panels/lock/cc-lock-panel.c b/panels/lock/cc-lock-panel.c index 86800e871bfed350292f8161733e5856ee0ae986..f2907f0413bf67f1d8e179e759fa69479ba106bf 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 #include #include @@ -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 f32dde1115cd5524c826973ad2246999823a2ea6..3fdf537d339edb14513a0dc4a5e1fddbd6cc485a 100644 --- a/panels/lock/cc-lock-panel.ui +++ b/panels/lock/cc-lock-panel.ui @@ -60,7 +60,7 @@ - + true Automatic Screen _Lock automatic_screen_lock_switch @@ -77,7 +77,7 @@ - + true Automatic _Screen Lock Delay Period after the screen blanks when the screen is automatically locked. diff --git a/panels/lock/meson.build b/panels/lock/meson.build index 0661af4fa0eb23c41136fa7f4efb4b0933a32fd7..10ab3aca2e446d0223dee0291d14ff7402965045 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 )