[gnome-control-center/wip/privacy] privacy: implement name & visibility
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/privacy] privacy: implement name & visibility
- Date: Sun, 18 Nov 2012 05:51:35 +0000 (UTC)
commit ca1c4f411bbfa6a682aa0e0b2bfe9b80e779cda6
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Nov 18 00:44:35 2012 -0500
privacy: implement name & visibility
Control whether the users full name is shown permanently on screen.
panels/privacy/cc-privacy-panel.c | 100 ++++++++++++++++++++++-
panels/privacy/privacy.ui | 167 ++++++++++++++++++++++++++++++++++++-
2 files changed, 263 insertions(+), 4 deletions(-)
---
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index 63ccacf..2ae3969 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -36,6 +36,8 @@ struct _CcPrivacyPanelPrivate
GSettings *lockdown_settings;
GSettings *lock_settings;
+ GSettings *shell_settings;
+ GSettings *privacy_settings;
};
static void
@@ -88,6 +90,33 @@ get_on_off_label (GSettings *settings,
return w;
}
+static gboolean
+visible_label_mapping_get (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ g_value_set_string (value, g_variant_get_boolean (variant) ? _("Hidden") : _("Visible"));
+
+ return TRUE;
+}
+
+static GtkWidget *
+get_visible_label (GSettings *settings,
+ const gchar *key)
+{
+ GtkWidget *w;
+
+ w = gtk_label_new ("");
+ g_settings_bind_with_mapping (settings, key,
+ w, "label",
+ G_SETTINGS_BIND_GET,
+ visible_label_mapping_get,
+ NULL,
+ NULL,
+ NULL);
+ return w;
+}
+
static void
add_row (CcPrivacyPanel *self,
const gchar *label,
@@ -180,7 +209,6 @@ add_screen_lock (CcPrivacyPanel *self)
GtkWidget *w;
GtkWidget *dialog;
- self->priv->lock_settings = g_settings_new ("org.gnome.desktop.screensaver");
w = get_on_off_label (self->priv->lock_settings, "lock-enabled");
add_row (self, _("Screen Lock"), "screen_lock_dialog", w);
@@ -215,6 +243,67 @@ add_screen_lock (CcPrivacyPanel *self)
}
static void
+stealth_mode_changed (GSettings *settings,
+ const gchar *key,
+ gpointer data)
+{
+ CcPrivacyPanel *self = data;
+ gboolean stealth_mode;
+ GtkWidget *w;
+
+ stealth_mode = g_settings_get_boolean (settings, "stealth-mode");
+
+ if (stealth_mode)
+ {
+ g_settings_set_boolean (self->priv->lock_settings, "show-full-name", FALSE);
+ g_settings_set_boolean (self->priv->shell_settings, "show-full-name", FALSE);
+ }
+
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "full_name_top_bar"));
+ gtk_widget_set_sensitive (w, !stealth_mode);
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "full_name_lock_screen"));
+ gtk_widget_set_sensitive (w, !stealth_mode);
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "full_name_top_bar_label"));
+ gtk_widget_set_sensitive (w, !stealth_mode);
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "full_name_lock_screen_label"));
+ gtk_widget_set_sensitive (w, !stealth_mode);
+}
+
+static void
+add_name_visibility (CcPrivacyPanel *self)
+{
+ GtkWidget *w;
+ GtkWidget *dialog;
+
+ w = get_visible_label (self->priv->privacy_settings, "stealth-mode");
+ add_row (self, _("Name & Visibility"), "name_dialog", w);
+
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "name_done"));
+ dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "name_dialog"));
+ g_signal_connect_swapped (w, "clicked",
+ G_CALLBACK (gtk_widget_hide), dialog);
+
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "stealth_mode"));
+ g_settings_bind (self->priv->privacy_settings, "stealth-mode",
+ w, "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "full_name_top_bar"));
+ g_settings_bind (self->priv->shell_settings, "show-full-name",
+ w, "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "full_name_lock_screen"));
+ g_settings_bind (self->priv->lock_settings, "show-full-name",
+ w, "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_signal_connect (self->priv->privacy_settings, "changed::stealth-mode",
+ G_CALLBACK (stealth_mode_changed), self);
+
+}
+
+static void
cc_privacy_panel_finalize (GObject *object)
{
CcPrivacyPanelPrivate *priv = CC_PRIVACY_PANEL (object)->priv;
@@ -222,6 +311,8 @@ cc_privacy_panel_finalize (GObject *object)
g_clear_object (&priv->builder);
g_clear_object (&priv->lockdown_settings);
g_clear_object (&priv->lock_settings);
+ g_clear_object (&priv->shell_settings);
+ g_clear_object (&priv->privacy_settings);
G_OBJECT_CLASS (cc_privacy_panel_parent_class)->finalize (object);
}
@@ -299,9 +390,14 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
update_separator_func,
NULL, NULL);
+ self->priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
+ self->priv->lock_settings = g_settings_new ("org.gnome.desktop.screensaver");
+ self->priv->shell_settings = g_settings_new ("org.gnome.shell");
+ self->priv->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
+
add_screen_lock (self);
+ add_name_visibility (self);
- self->priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
g_signal_connect (self->priv->lockdown_settings, "changed",
G_CALLBACK (on_lockdown_settings_changed), self);
update_lock_screen_sensitivity (self);
diff --git a/panels/privacy/privacy.ui b/panels/privacy/privacy.ui
index 8cbd17c..1e6e796 100644
--- a/panels/privacy/privacy.ui
+++ b/panels/privacy/privacy.ui
@@ -43,11 +43,172 @@
</row>
</data>
</object>
- <object class="GtkDialog" id="screen_lock_dialog">
+ <object class="GtkDialog" id="name_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
+ <property name="title" translatable="yes">Name & Visibility</property>
<property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox2">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area2">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="name_done">
+ <property name="label" translatable="yes">_Done</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">12</property>
+ <property name="label" translatable="yes">Control how you appear on the screen and the network.</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">12</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="full_name_top_bar_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Display _full name in top bar</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">full_name_top_bar</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="full_name_top_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="full_name_lock_screen_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Display full name in _lock screen</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">full_name_lock_screen</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="full_name_lock_screen">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Stealth mode</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">stealth_mode</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="stealth_mode">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">name_done</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="screen_lock_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
<property name="title" translatable="yes">Screen Lock</property>
+ <property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -107,6 +268,9 @@
<property name="label" translatable="yes">Automatic Screen _Lock</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">automatic_screen_lock</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
<packing>
<property name="left_attach">0</property>
@@ -151,7 +315,6 @@
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="valign">center</property>
- <property name="model">lock_after_model</property>
</object>
<packing>
<property name="left_attach">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]