[gnome-control-center] privacy: Move "Location Services" into a dialog



commit 3ca5b11d7a520e746cc27a57dbb0e6277219f986
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Feb 16 18:17:45 2016 +0000

    privacy: Move "Location Services" into a dialog
    
    We are about to add per-application settings for geolocation access and
    they won't really fit well in the main view. This is as per design
    mockup:
    
    https://dl.dropboxusercontent.com/u/5031519/privacy/privacy-3.20.png
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761245

 panels/privacy/cc-privacy-panel.c |   32 ++++++++++++-----
 panels/privacy/privacy.ui         |   72 ++++++++++++++++++++++--------------
 2 files changed, 67 insertions(+), 37 deletions(-)
---
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index 01effe8..6668936 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -43,6 +43,7 @@ struct _CcPrivacyPanelPrivate
   GtkBuilder *builder;
   GtkWidget  *recent_dialog;
   GtkWidget  *screen_lock_dialog;
+  GtkWidget  *location_dialog;
   GtkWidget  *trash_dialog;
   GtkWidget  *software_dialog;
   GtkWidget  *list_box;
@@ -380,6 +381,25 @@ add_screen_lock (CcPrivacyPanel *self)
 }
 
 static void
+add_location (CcPrivacyPanel *self)
+{
+  GtkWidget *w;
+  GtkWidget *dialog;
+
+  w = get_on_off_label (self->priv->location_settings, LOCATION_ENABLED);
+  add_row (self, _("Location Services"), "location_dialog", w);
+
+  dialog = self->priv->location_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, "location_services_switch"));
+  g_settings_bind (self->priv->location_settings, LOCATION_ENABLED,
+                   w, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+}
+
+static void
 retain_history_combo_changed_cb (GtkWidget      *widget,
                                  CcPrivacyPanel *self)
 {
@@ -767,6 +787,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->location_dialog, gtk_widget_destroy);
   g_clear_pointer (&priv->trash_dialog, gtk_widget_destroy);
   g_clear_pointer (&priv->software_dialog, gtk_widget_destroy);
   g_clear_pointer (&priv->abrt_dialog, gtk_widget_destroy);
@@ -836,6 +857,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->location_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "location_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"));
   self->priv->abrt_dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "abrt_dialog"));
@@ -861,6 +883,7 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
   self->priv->location_settings = g_settings_new ("org.gnome.system.location");
 
   add_screen_lock (self);
+  add_location (self);
   add_usage_history (self);
   add_trash_temp (self);
   add_software (self);
@@ -870,15 +893,6 @@ 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 feaa332..804157c 100644
--- a/panels/privacy/privacy.ui
+++ b/panels/privacy/privacy.ui
@@ -714,24 +714,34 @@ All the information we collect is made anonymous, and we will never share your d
       </object>
     </child>
   </object>
-      <object class="GtkBox" id="privacy_vbox">
-        <property name="visible">True</property>
+  <object class="GtkDialog" id="location_dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Location Services</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="use_header_bar">1</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="location-vbox">
         <property name="can_focus">False</property>
-        <property name="margin_start">134</property>
-        <property name="margin_end">134</property>
-        <property name="margin_top">22</property>
-        <property name="margin_bottom">22</property>
         <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
         <child>
-          <object class="GtkFrame" id="frame">
+          <object class="GtkLabel" id="location_description_label">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="shadow_type">in</property>
+            <property name="margin_start">12</property>
+            <property name="margin_end">12</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">12</property>
+            <property name="label" translatable="yes">Location services allow applications to determine your 
geographical position. Accuracy is increased by enabling WiFi and GPS.</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>
+            <property name="position">1</property>
           </packing>
         </child>
 
@@ -771,7 +781,6 @@ All the information we collect is made anonymous, and we will never share your d
                             <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>
@@ -782,24 +791,6 @@ All the information we collect is made anonymous, and we will never share your d
                         </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">Used 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>
@@ -819,6 +810,7 @@ All the information we collect is made anonymous, and we will never share your d
                 </child>
               </object>
             </child>
+
           </object>
           <packing>
             <property name="expand">False</property>
@@ -826,6 +818,30 @@ All the information we collect is made anonymous, and we will never share your d
             <property name="position">2</property>
           </packing>
         </child>
+
+      </object>
+    </child>
+  </object>
+      <object class="GtkBox" id="privacy_vbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_start">134</property>
+        <property name="margin_end">134</property>
+        <property name="margin_top">22</property>
+        <property name="margin_bottom">22</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkFrame" id="frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="shadow_type">in</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
       </object>
 
   <object class="GtkDialog" id="abrt_dialog">


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