summaryrefslogtreecommitdiffstats
path: root/panels/screen
diff options
context:
space:
mode:
Diffstat (limited to 'panels/screen')
-rw-r--r--panels/screen/cc-screen-panel.c387
-rw-r--r--panels/screen/cc-screen-panel.h55
-rw-r--r--panels/screen/cc-screen-panel.ui129
-rw-r--r--panels/screen/gnome-screen-panel.desktop.in.in19
-rw-r--r--panels/screen/icons/meson.build4
-rw-r--r--panels/screen/icons/scalable/org.gnome.Settings-screen-symbolic.svg4
-rw-r--r--panels/screen/meson.build46
-rw-r--r--panels/screen/screen.gresource.xml6
8 files changed, 650 insertions, 0 deletions
diff --git a/panels/screen/cc-screen-panel.c b/panels/screen/cc-screen-panel.c
new file mode 100644
index 0000000..05bd11d
--- /dev/null
+++ b/panels/screen/cc-screen-panel.c
@@ -0,0 +1,387 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2018 Red Hat, Inc
+ * Copyright (C) 2020 Collabora Ltd.
+ * Copyright (C) 2021-2022 Canonical Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "cc-screen-panel.h"
+#include "cc-screen-panel-enums.h"
+#include "cc-screen-resources.h"
+#include "cc-util.h"
+
+#include "panels/display/cc-display-config-manager-dbus.h"
+
+#include <adwaita.h>
+
+#include <gio/gdesktopappinfo.h>
+#include <glib/gi18n.h>
+
+struct _CcScreenPanel
+{
+ CcPanel parent_instance;
+
+ CcDisplayConfigManager *display_config_manager;
+
+ GSettings *lock_settings;
+ GSettings *notification_settings;
+ GSettings *privacy_settings;
+ GSettings *session_settings;
+
+ GCancellable *cancellable;
+
+ AdwComboRow *blank_screen_row;
+ AdwComboRow *lock_after_row;
+ AdwPreferencesGroup *screen_privacy_group;
+ GDBusProxy *usb_proxy;
+ GtkListBoxRow *usb_protection_row;
+ GtkSwitch *automatic_screen_lock_switch;
+ GtkSwitch *privacy_screen_switch;
+ GtkSwitch *show_notifications_switch;
+ GtkSwitch *usb_protection_switch;
+};
+
+CC_PANEL_REGISTER (CcScreenPanel, cc_screen_panel)
+
+static char *
+lock_after_name_cb (AdwEnumListItem *item,
+ gpointer user_data)
+{
+
+ switch (adw_enum_list_item_get_value (item))
+ {
+ case CC_SCREEN_PANEL_LOCK_AFTER_SCREEN_OFF:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup(C_("lock_screen", "Screen Turns Off"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_30_SEC:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "30 seconds"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_1_MIN:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "1 minute"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_2_MIN:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "2 minutes"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_3_MIN:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "3 minutes"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_5_MIN:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "5 minutes"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_30_MIN:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "30 minutes"));
+ case CC_SCREEN_PANEL_LOCK_AFTER_1_HR:
+ /* Translators: Option for "Lock screen after blank" in "Screen Lock" panel */
+ return g_strdup (C_("lock_screen", "1 hour"));
+ default:
+ return NULL;
+ }
+}
+
+static void
+on_lock_combo_changed_cb (AdwComboRow *combo_row,
+ GParamSpec *pspec,
+ CcScreenPanel *self)
+{
+ AdwEnumListItem *item;
+ CcScreenPanelLockAfter delay;
+
+ item = ADW_ENUM_LIST_ITEM (adw_combo_row_get_selected_item (combo_row));
+ delay = adw_enum_list_item_get_value (item);
+
+ g_settings_set (self->lock_settings, "lock-delay", "u", delay);
+}
+
+static void
+set_lock_value_for_combo (AdwComboRow *combo_row,
+ CcScreenPanel *self)
+{
+ AdwEnumListModel *model;
+ guint value;
+
+ model = ADW_ENUM_LIST_MODEL (adw_combo_row_get_model (combo_row));
+
+ g_settings_get (self->lock_settings, "lock-delay", "u", &value);
+ adw_combo_row_set_selected (combo_row,
+ adw_enum_list_model_find_position (model, value));
+}
+
+static char *
+screen_delay_name_cb (AdwEnumListItem *item,
+ gpointer user_data)
+{
+
+ switch (adw_enum_list_item_get_value (item))
+ {
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_1_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "1 minute"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_2_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "2 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_3_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "3 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_4_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "4 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_5_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "5 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_8_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "8 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_10_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "10 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_12_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "12 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_15_MIN:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "15 minutes"));
+ case CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_NEVER:
+ /* Translators: Option for "Blank screen" in "Screen Lock" panel */
+ return g_strdup (C_("blank_screen", "Never"));
+ default:
+ return NULL;
+ }
+}
+
+static void
+set_blank_screen_delay_value (CcScreenPanel *self,
+ gint value)
+{
+ AdwEnumListModel *model;
+
+ model = ADW_ENUM_LIST_MODEL (adw_combo_row_get_model (self->blank_screen_row));
+
+ adw_combo_row_set_selected (self->blank_screen_row,
+ adw_enum_list_model_find_position (model, value));
+}
+
+static void
+on_blank_screen_delay_changed_cb (AdwComboRow *combo_row,
+ GParamSpec *pspec,
+ CcScreenPanel *self)
+{
+ AdwEnumListItem *item;
+ CcScreenPanelBlankScreenDelay delay;
+
+ item = ADW_ENUM_LIST_ITEM (adw_combo_row_get_selected_item (combo_row));
+ delay = adw_enum_list_item_get_value (item);
+
+ g_settings_set_uint (self->session_settings, "idle-delay", delay);
+}
+
+static void
+on_usb_protection_properties_changed_cb (GDBusProxy *usb_proxy,
+ GVariant *changed_properties,
+ GStrv invalidated_properties,
+ CcScreenPanel *self)
+{
+ gboolean available = FALSE;
+
+ if (self->usb_proxy)
+ {
+ g_autoptr(GVariant) variant = NULL;
+
+ variant = g_dbus_proxy_get_cached_property (self->usb_proxy, "Available");
+ if (variant != NULL)
+ available = g_variant_get_boolean (variant);
+ }
+
+ /* Show the USB protection row only if the required daemon is up and running */
+ gtk_widget_set_visible (GTK_WIDGET (self->usb_protection_row), available);
+}
+
+static void
+on_usb_protection_param_ready (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ g_autoptr(GError) error = NULL;
+ CcScreenPanel *self;
+ GDBusProxy *proxy;
+
+ self = user_data;
+ proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (error)
+ {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ g_warning ("Failed to connect to SettingsDaemon.UsbProtection: %s",
+ error->message);
+ }
+
+ gtk_widget_hide (GTK_WIDGET (self->usb_protection_row));
+ return;
+ }
+ self->usb_proxy = proxy;
+
+ g_signal_connect_object (self->usb_proxy,
+ "g-properties-changed",
+ G_CALLBACK (on_usb_protection_properties_changed_cb),
+ self,
+ 0);
+ on_usb_protection_properties_changed_cb (self->usb_proxy, NULL, NULL, self);
+}
+
+static void
+cc_screen_panel_finalize (GObject *object)
+{
+ CcScreenPanel *self = CC_SCREEN_PANEL (object);
+
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
+ g_clear_object (&self->display_config_manager);
+ g_clear_object (&self->lock_settings);
+ g_clear_object (&self->notification_settings);
+ g_clear_object (&self->session_settings);
+ g_clear_object (&self->usb_proxy);
+
+ G_OBJECT_CLASS (cc_screen_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_screen_panel_class_init (CcScreenPanelClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ oclass->finalize = cc_screen_panel_finalize;
+
+ g_type_ensure (CC_TYPE_SCREEN_PANEL_LOCK_AFTER);
+ g_type_ensure (CC_TYPE_SCREEN_PANEL_BLANK_SCREEN_DELAY);
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/screen/cc-screen-panel.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, automatic_screen_lock_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, blank_screen_row);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, lock_after_row);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, privacy_screen_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, screen_privacy_group);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, show_notifications_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, usb_protection_row);
+ gtk_widget_class_bind_template_child (widget_class, CcScreenPanel, usb_protection_switch);
+
+ gtk_widget_class_bind_template_callback (widget_class, lock_after_name_cb);
+ 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);
+ gtk_widget_class_bind_template_callback (widget_class, screen_delay_name_cb);
+}
+
+static void
+update_display_config (CcScreenPanel *self)
+{
+ g_autoptr (CcDisplayConfig) config = NULL;
+ gboolean any_privacy_screen = FALSE;
+ gboolean any_configurable_privacy_screen = FALSE;
+ GList *monitors;
+ GList *l;
+
+ config = cc_display_config_manager_get_current (self->display_config_manager);
+ monitors = config ? cc_display_config_get_monitors (config) : NULL;
+
+ for (l = monitors; l; l = l->next)
+ {
+ CcDisplayMonitor *monitor = CC_DISPLAY_MONITOR (l->data);
+ CcDisplayMonitorPrivacy privacy = cc_display_monitor_get_privacy (monitor);
+
+ if (privacy != CC_DISPLAY_MONITOR_PRIVACY_UNSUPPORTED)
+ {
+ any_privacy_screen = TRUE;
+
+ if (!(privacy & CC_DISPLAY_MONITOR_PRIVACY_LOCKED))
+ any_configurable_privacy_screen = TRUE;
+ }
+ }
+
+ gtk_widget_set_visible (GTK_WIDGET (self->screen_privacy_group),
+ any_privacy_screen);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->privacy_screen_switch),
+ any_configurable_privacy_screen);
+}
+
+static void
+cc_screen_panel_init (CcScreenPanel *self)
+{
+ guint value;
+
+ g_resources_register (cc_screen_get_resource ());
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ self->cancellable = g_cancellable_new ();
+
+ self->lock_settings = g_settings_new ("org.gnome.desktop.screensaver");
+ self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
+ 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);
+
+ g_settings_bind (self->lock_settings,
+ "lock-enabled",
+ self->lock_after_row,
+ "sensitive",
+ G_SETTINGS_BIND_GET);
+
+ set_lock_value_for_combo (self->lock_after_row, self);
+
+ g_settings_bind (self->notification_settings,
+ "show-in-lock-screen",
+ self->show_notifications_switch,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ value = g_settings_get_uint (self->session_settings, "idle-delay");
+ set_blank_screen_delay_value (self, value);
+
+ g_settings_bind (self->privacy_settings,
+ "usb-protection",
+ self->usb_protection_switch,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ self->display_config_manager = cc_display_config_manager_dbus_new ();
+ g_signal_connect_object (self->display_config_manager, "changed",
+ G_CALLBACK (update_display_config), self,
+ G_CONNECT_SWAPPED);
+
+ update_display_config (self);
+ g_settings_bind (self->privacy_settings,
+ "privacy-screen",
+ self->privacy_screen_switch,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.gnome.SettingsDaemon.UsbProtection",
+ "/org/gnome/SettingsDaemon/UsbProtection",
+ "org.gnome.SettingsDaemon.UsbProtection",
+ self->cancellable,
+ on_usb_protection_param_ready,
+ self);
+}
diff --git a/panels/screen/cc-screen-panel.h b/panels/screen/cc-screen-panel.h
new file mode 100644
index 0000000..c1917f9
--- /dev/null
+++ b/panels/screen/cc-screen-panel.h
@@ -0,0 +1,55 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2018 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Matthias Clasen <mclasen@redhat.com>
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_LOCK_PANEL (cc_screen_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcScreenPanel, cc_screen_panel, CC, SCREEN_PANEL, CcPanel)
+
+typedef enum {
+ CC_SCREEN_PANEL_LOCK_AFTER_SCREEN_OFF = 0,
+ CC_SCREEN_PANEL_LOCK_AFTER_30_SEC = 30,
+ CC_SCREEN_PANEL_LOCK_AFTER_1_MIN = 60,
+ CC_SCREEN_PANEL_LOCK_AFTER_2_MIN = 120,
+ CC_SCREEN_PANEL_LOCK_AFTER_3_MIN = 180,
+ CC_SCREEN_PANEL_LOCK_AFTER_5_MIN = 300,
+ CC_SCREEN_PANEL_LOCK_AFTER_30_MIN = 1800,
+ CC_SCREEN_PANEL_LOCK_AFTER_1_HR = 3600,
+} CcScreenPanelLockAfter;
+
+typedef enum {
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_1_MIN = 60,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_2_MIN = 120,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_3_MIN = 180,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_4_MIN = 240,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_5_MIN = 300,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_8_MIN = 480,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_10_MIN = 600,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_12_MIN = 720,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_15_MIN = 900,
+ CC_SCREEN_PANEL_BLANK_SCREEN_DELAY_NEVER = 0,
+} CcScreenPanelBlankScreenDelay;
+
+
+G_END_DECLS
diff --git a/panels/screen/cc-screen-panel.ui b/panels/screen/cc-screen-panel.ui
new file mode 100644
index 0000000..2d58729
--- /dev/null
+++ b/panels/screen/cc-screen-panel.ui
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="CcScreenPanel" parent="CcPanel">
+ <child type="content">
+ <object class="AdwPreferencesPage">
+ <child>
+ <object class="AdwPreferencesGroup">
+ <property name="title" translatable="yes">Screen Lock</property>
+ <property name="description" translatable="yes">Automatically locking the screen prevents others from accessing the computer while you're away.</property>
+
+ <!-- Blank Screen Delay row -->
+ <child>
+ <object class="AdwComboRow" id="blank_screen_row">
+ <property name="title" translatable="yes">Blank Screen Delay</property>
+ <property name="subtitle" translatable="yes">Period of inactivity after which the screen will go blank.</property>
+ <property name="subtitle-lines">2</property>
+ <property name="use-underline">true</property>
+ <signal name="notify::selected-item" handler="on_blank_screen_delay_changed_cb"/>
+ <property name="model">
+ <object class="AdwEnumListModel">
+ <property name="enum-type">CcScreenPanelBlankScreenDelay</property>
+ </object>
+ </property>
+ <property name="expression">
+ <closure type="gchararray" function="screen_delay_name_cb"/>
+ </property>
+ </object>
+ </child>
+
+ <!-- Automatic Screen Lock row -->
+ <child>
+ <object class="AdwActionRow">
+ <property name="title" translatable="yes">Automatic Screen _Lock</property>
+ <property name="activatable-widget">automatic_screen_lock_switch</property>
+ <property name="use-underline">true</property>
+ <child>
+ <object class="GtkSwitch" id="automatic_screen_lock_switch">
+ <property name="valign">center</property>
+ <accessibility>
+ <property name="label" translatable="yes">Enabled</property>
+ </accessibility>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ <!-- Automatic Screen Lock Delay row -->
+ <child>
+ <object class="AdwComboRow" id="lock_after_row">
+ <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>
+ <property name="subtitle-lines">2</property>
+ <property name="use-underline">true</property>
+ <signal name="notify::selected-item" handler="on_lock_combo_changed_cb"/>
+ <property name="model">
+ <object class="AdwEnumListModel">
+ <property name="enum-type">CcScreenPanelLockAfter</property>
+ </object>
+ </property>
+ <property name="expression">
+ <closure type="gchararray" function="lock_after_name_cb"/>
+ </property>
+ </object>
+ </child>
+
+ <!-- Show Notifications row -->
+ <child>
+ <object class="AdwActionRow">
+ <property name="title" translatable="yes" comments="Translators: Whether to show notifications on the lock screen">_Lock Screen Notifications</property>
+ <property name="activatable-widget">show_notifications_switch</property>
+ <property name="use-underline">true</property>
+ <child>
+ <object class="GtkSwitch" id="show_notifications_switch">
+ <property name="valign">center</property>
+ <accessibility>
+ <property name="label" translatable="yes">Enabled</property>
+ </accessibility>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ <!-- USB protection row -->
+ <child>
+ <object class="AdwActionRow" id="usb_protection_row">
+ <property name="visible">false</property>
+ <property name="title" translatable="yes">Forbid new _USB devices</property>
+ <property name="subtitle" translatable="yes">Prevent new USB devices from interacting with the system when the screen is locked.</property>
+ <property name="subtitle-lines">2</property>
+ <property name="activatable-widget">usb_protection_switch</property>
+ <property name="use-underline">true</property>
+ <child>
+ <object class="GtkSwitch" id="usb_protection_switch">
+ <property name="valign">center</property>
+ <accessibility>
+ <property name="label" translatable="yes">Enabled</property>
+ </accessibility>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ </object>
+ </child>
+
+ <child>
+ <object class="AdwPreferencesGroup" id="screen_privacy_group">
+ <property name="title" translatable="yes">Screen Privacy</property>
+
+ <!-- Privacy Screen row -->
+ <child>
+ <object class="AdwActionRow">
+ <property name="title" translatable="yes">Restrict Viewing Angle</property>
+ <property name="activatable-widget">privacy_screen_switch</property>
+ <property name="use-underline">true</property>
+ <child>
+ <object class="GtkSwitch" id="privacy_screen_switch">
+ <property name="valign">center</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/panels/screen/gnome-screen-panel.desktop.in.in b/panels/screen/gnome-screen-panel.desktop.in.in
new file mode 100644
index 0000000..e095264
--- /dev/null
+++ b/panels/screen/gnome-screen-panel.desktop.in.in
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Name=Screen
+Comment=Screen Settings
+Exec=gnome-control-center screen
+# FIXME
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=org.gnome.Settings-screen-symbolic
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-PrivacySettings;
+OnlyShowIn=GNOME;Unity;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-control-center
+X-GNOME-Bugzilla-Component=screen
+X-GNOME-Bugzilla-Version=@VERSION@
+# Translators: Search terms to find the Screen panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
+Keywords=screen;lock;private;privacy;
diff --git a/panels/screen/icons/meson.build b/panels/screen/icons/meson.build
new file mode 100644
index 0000000..f0e4593
--- /dev/null
+++ b/panels/screen/icons/meson.build
@@ -0,0 +1,4 @@
+install_data(
+ 'scalable/org.gnome.Settings-screen-symbolic.svg',
+ install_dir: join_paths(control_center_icondir, 'hicolor', 'scalable', 'apps')
+)
diff --git a/panels/screen/icons/scalable/org.gnome.Settings-screen-symbolic.svg b/panels/screen/icons/scalable/org.gnome.Settings-screen-symbolic.svg
new file mode 100644
index 0000000..b27a2bc
--- /dev/null
+++ b/panels/screen/icons/scalable/org.gnome.Settings-screen-symbolic.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
+ <path d="m 3 0 c -1.660156 0 -3 1.339844 -3 3 v 7 c 0 1.660156 1.339844 3 3 3 h 10 c 1.660156 0 3 -1.339844 3 -3 v -7 c 0 -1.660156 -1.339844 -3 -3 -3 z m 0 2 h 10 c 0.554688 0 1 0.445312 1 1 v 7 c 0 0.554688 -0.445312 1 -1 1 h -10 c -0.554688 0 -1 -0.445312 -1 -1 v -7 c 0 -0.554688 0.445312 -1 1 -1 z m 2 12 c -1.105469 0 -2 0.894531 -2 2 h 10 c 0 -1.105469 -0.894531 -2 -2 -2 z m 0 0" fill="#2e3436"/>
+</svg>
diff --git a/panels/screen/meson.build b/panels/screen/meson.build
new file mode 100644
index 0000000..48482b8
--- /dev/null
+++ b/panels/screen/meson.build
@@ -0,0 +1,46 @@
+panels_list += cappletname
+desktop = 'gnome-@0@-panel.desktop'.format(cappletname)
+
+desktop_in = configure_file(
+ input: desktop + '.in.in',
+ output: desktop + '.in',
+ configuration: desktop_conf
+)
+
+i18n.merge_file(
+ type: 'desktop',
+ input: desktop_in,
+ output: desktop,
+ po_dir: po_dir,
+ install: true,
+ install_dir: control_center_desktopdir
+)
+
+sources = files('cc-screen-panel.c')
+
+resource_data = files('cc-screen-panel.ui')
+
+sources += gnome.mkenums_simple(
+ 'cc-screen-panel-enums',
+ sources: ['cc-screen-panel.h'],
+)
+
+sources += gnome.compile_resources(
+ 'cc-' + cappletname + '-resources',
+ cappletname + '.gresource.xml',
+ c_name: 'cc_' + cappletname,
+ dependencies: resource_data,
+ export: true
+)
+
+cflags += '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
+
+panels_libs += static_library(
+ cappletname,
+ sources: sources,
+ include_directories: [top_inc, common_inc],
+ dependencies: common_deps,
+ c_args: cflags
+)
+
+subdir('icons')
diff --git a/panels/screen/screen.gresource.xml b/panels/screen/screen.gresource.xml
new file mode 100644
index 0000000..9d1500f
--- /dev/null
+++ b/panels/screen/screen.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/screen">
+ <file preprocess="xml-stripblanks">cc-screen-panel.ui</file>
+ </gresource>
+</gresources>