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
This commit is contained in:
Zeeshan Ali (Khattak) 2014-08-02 15:32:45 +02:00 committed by Bastien Nocera
parent b2079ff4a6
commit 7bcf4c189f
2 changed files with 105 additions and 0 deletions

View file

@ -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);
}

View file

@ -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>