[gnome-control-center] privacy: Add location setting



commit 7bcf4c189f7785cf969f17b87846eaf18b8334b0
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sat Aug 2 15:32:45 2014 +0200

    privacy: Add location setting
    
    For now its just a switch to enable/disable geolocation through
    gnome-shell's setting. In future we'll hopefully at least have
    controls to enable/disable geolocation for applications from here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731119

 panels/privacy/cc-privacy-panel.c |   13 +++++
 panels/privacy/privacy.ui         |   92 +++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 0 deletions(-)
---
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index a15f6c9..12ec561 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -35,6 +35,7 @@ CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
 #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"
+#define LOCATION_ENABLED "enabled"
 
 struct _CcPrivacyPanelPrivate
 {
@@ -49,6 +50,7 @@ struct _CcPrivacyPanelPrivate
   GSettings  *lock_settings;
   GSettings  *privacy_settings;
   GSettings  *notification_settings;
+  GSettings  *location_settings;
 };
 
 static void
@@ -597,6 +599,7 @@ cc_privacy_panel_finalize (GObject *object)
   g_clear_object (&priv->lock_settings);
   g_clear_object (&priv->privacy_settings);
   g_clear_object (&priv->notification_settings);
+  g_clear_object (&priv->location_settings);
 
   G_OBJECT_CLASS (cc_privacy_panel_parent_class)->finalize (object);
 }
@@ -678,6 +681,7 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
   self->priv->lock_settings = g_settings_new ("org.gnome.desktop.screensaver");
   self->priv->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
   self->priv->notification_settings = g_settings_new ("org.gnome.desktop.notifications");
+  self->priv->location_settings = g_settings_new ("org.gnome.system.location");
 
   add_screen_lock (self);
   add_usage_history (self);
@@ -688,6 +692,15 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
                     G_CALLBACK (on_lockdown_settings_changed), self);
   update_lock_screen_sensitivity (self);
 
+  widget = WID ("location_services_switch");
+  gtk_switch_set_active (GTK_SWITCH (widget),
+                         g_settings_get_boolean (self->priv->location_settings,
+                                                 LOCATION_ENABLED));
+  g_settings_bind (self->priv->location_settings,
+                   LOCATION_ENABLED,
+                   widget, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
   widget = WID ("privacy_vbox");
   gtk_container_add (GTK_CONTAINER (self), widget);
 }
diff --git a/panels/privacy/privacy.ui b/panels/privacy/privacy.ui
index beff77c..875b7a8 100644
--- a/panels/privacy/privacy.ui
+++ b/panels/privacy/privacy.ui
@@ -735,5 +735,97 @@ All the information we collect is made anonymous, and we will never share your d
             <property name="position">0</property>
           </packing>
         </child>
+
+        <child>
+          <object class="GtkFrame" id="location_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="shadow_type">in</property>
+            <property name="margin_top">12</property>
+            <property name="margin_bottom">12</property>
+
+            <child>
+              <object class="GtkListBox" id="location_listbox">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="selection_mode">none</property>
+                <child>
+                  <object class="GtkListBoxRow" id="location_services_row">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+
+                    <child>
+                      <object class="GtkGrid" id="location_services_grid">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="row_spacing">0</property>
+                        <property name="column_spacing">32</property>
+                        <property name="margin_start">12</property>
+                        <property name="margin_end">6</property>
+                        <property name="margin_top">12</property>
+                        <property name="margin_bottom">12</property>
+                        <child>
+                          <object class="GtkLabel" id="location_services_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">_Location Services</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">location_services_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="GtkLabel" id="location_description_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Allows applications to determine your 
geographical location</property>
+                            <style>
+                              <class name="dim-label"/>
+                            </style>
+                          </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="location_services_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">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
       </object>
 </interface>


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