[gnome-control-center] privacy: Add option to control GNOME Software usage stats



commit dcb22fc333e5155a9f2fe8a8373267598343bc58
Author: Richard Hughes <richard hughsie com>
Date:   Tue Feb 4 16:42:57 2014 +0000

    privacy: Add option to control GNOME Software usage stats
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=723619

 panels/privacy/cc-privacy-panel.c |   27 ++++++++
 panels/privacy/privacy.ui         |  132 +++++++++++++++++++++++++++++++++++++
 2 files changed, 159 insertions(+), 0 deletions(-)
---
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index c830e76..258c756 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -33,6 +33,7 @@ CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
 #define REMOVE_OLD_TRASH_FILES "remove-old-trash-files"
 #define REMOVE_OLD_TEMP_FILES "remove-old-temp-files"
 #define OLD_FILES_AGE "old-files-age"
+#define SEND_SOFTWARE_USAGE_STATS "send-software-usage-stats"
 
 struct _CcPrivacyPanelPrivate
 {
@@ -40,6 +41,7 @@ struct _CcPrivacyPanelPrivate
   GtkWidget  *recent_dialog;
   GtkWidget  *screen_lock_dialog;
   GtkWidget  *trash_dialog;
+  GtkWidget  *software_dialog;
   GtkWidget  *list_box;
 
   GSettings  *lockdown_settings;
@@ -567,6 +569,28 @@ add_trash_temp (CcPrivacyPanel *self)
 }
 
 static void
+add_software (CcPrivacyPanel *self)
+{
+  GtkWidget *w;
+  GtkWidget *dialog;
+
+  w = get_on_off_label (self->priv->privacy_settings, SEND_SOFTWARE_USAGE_STATS);
+  add_row (self, _("Software Usage"), "software_dialog", w);
+
+  w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "software_done"));
+  dialog = self->priv->software_dialog;
+  g_signal_connect_swapped (w, "clicked",
+                            G_CALLBACK (gtk_widget_hide), dialog);
+  g_signal_connect (dialog, "delete-event",
+                    G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
+  w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "software_usage_switch"));
+  g_settings_bind (self->priv->privacy_settings, SEND_SOFTWARE_USAGE_STATS,
+                   w, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+}
+
+static void
 cc_privacy_panel_finalize (GObject *object)
 {
   CcPrivacyPanelPrivate *priv = CC_PRIVACY_PANEL (object)->priv;
@@ -574,6 +598,7 @@ cc_privacy_panel_finalize (GObject *object)
   g_clear_pointer (&priv->recent_dialog, gtk_widget_destroy);
   g_clear_pointer (&priv->screen_lock_dialog, gtk_widget_destroy);
   g_clear_pointer (&priv->trash_dialog, gtk_widget_destroy);
+  g_clear_pointer (&priv->software_dialog, gtk_widget_destroy);
   g_clear_object (&priv->builder);
   g_clear_object (&priv->lockdown_settings);
   g_clear_object (&priv->lock_settings);
@@ -659,6 +684,7 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
   self->priv->recent_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "recent_dialog"));
   self->priv->screen_lock_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, 
"screen_lock_dialog"));
   self->priv->trash_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "trash_dialog"));
+  self->priv->software_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "software_dialog"));
 
   frame = WID ("frame");
   widget = gtk_list_box_new ();
@@ -682,6 +708,7 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
   add_screen_lock (self);
   add_usage_history (self);
   add_trash_temp (self);
+  add_software (self);
 
   g_signal_connect (self->priv->lockdown_settings, "changed",
                     G_CALLBACK (on_lockdown_settings_changed), self);
diff --git a/panels/privacy/privacy.ui b/panels/privacy/privacy.ui
index fcb2384..721d6e4 100644
--- a/panels/privacy/privacy.ui
+++ b/panels/privacy/privacy.ui
@@ -666,6 +666,138 @@
       <action-widget response="0">trash_done</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkDialog" id="software_dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Software Usage</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="use_header_bar">0</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox9">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkLabel" id="label3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="margin_start">12</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">12</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Sending us information about which software you use 
helps us provide you with more accurate recommendations. It also helps us to improve our software.
+
+All the information we collect is made anonymous, and we will never share your data with third 
parties.</property>
+            <property name="wrap">True</property>
+            <property name="max_width_chars">50</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area9">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkLinkButton" id="software_policy_linkbutton">
+                <property name="label" translatable="yes">Privacy Policy</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="relief">none</property>
+                <property 
name="uri">https://git.gnome.org/browse/gnome-software/plain/doc/privacy-policy.html</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+                <property name="non_homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="software_done">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">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="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="margin_start">6</property>
+            <property name="margin_top">12</property>
+            <property name="margin_bottom">12</property>
+            <property name="row_spacing">12</property>
+            <property name="column_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="software_usage_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Send software usage statistics</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">recently_used_switch</property>
+              </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="software_usage_switch">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="halign">end</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">software_done</action-widget>
+    </action-widgets>
+  </object>
       <object class="GtkBox" id="privacy_vbox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]