build, privacy: Make Location settings build conditional

Considering the retirement of Mozilla Location Service, most
laptop/desktop users will rely on weaker network based location
sources.

Let's make the Location settings a build option, disabled by default.
-Dlocation-services=enabled

See #2959
This commit is contained in:
Felipe Borges 2024-03-19 15:34:32 +01:00
parent dbbe0476cb
commit 5bdb890675
4 changed files with 19 additions and 5 deletions

View file

@ -273,6 +273,11 @@ endif
config_h.set('HAVE_MALCONTENT', enable_malcontent,
description: 'Define to 1 if malcontent support is enabled')
# location services support
location_services = get_option('location-services')
config_h.set('HAVE_LOCATION_SERVICES', location_services.enabled(),
description: 'Whether location services is enabled')
if host_is_linux
# ModemManager
mm_dep = dependency('mm-glib', version: '>= 0.7')

View file

@ -1,5 +1,6 @@
option('deprecated-declarations', type: 'feature', value: 'disabled', description: 'build with deprecated declaration warnings')
option('documentation', type: 'boolean', value: false, description: 'build documentation')
option('location-services', type: 'feature', value: 'disabled', description: 'build with location services')
option('ibus', type: 'boolean', value: true, description: 'build with IBus support')
option('privileged_group', type: 'string', value: 'wheel', description: 'name of group that has elevated permissions')
option('snap', type: 'boolean', value: true, description: 'build with Snap support')

View file

@ -40,6 +40,7 @@ struct _CcPrivacyPanel
AdwNavigationView *navigation;
CcListRow *bolt_row;
CcListRow *location_row;
};
CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
@ -70,6 +71,7 @@ cc_privacy_panel_class_init (CcPrivacyPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcPrivacyPanel, navigation);
gtk_widget_class_bind_template_child (widget_class, CcPrivacyPanel, bolt_row);
gtk_widget_class_bind_template_child (widget_class, CcPrivacyPanel, location_row);
g_type_ensure (CC_TYPE_CAMERA_PAGE);
g_type_ensure (CC_TYPE_DIAGNOSTICS_PAGE);
@ -110,5 +112,14 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
self->bolt_row, "visible", G_BINDING_SYNC_CREATE);
#endif
#ifdef HAVE_LOCATION_SERVICES
CcLocationPage *location_page = g_object_new (CC_TYPE_LOCATION_PAGE, NULL);
adw_navigation_view_add (self->navigation, ADW_NAVIGATION_PAGE (location_page));
g_object_bind_property (location_page, "visible",
self->location_row, "visible", G_BINDING_SYNC_CREATE);
#endif
g_signal_connect_object (self, "notify::subpage", G_CALLBACK (on_subpage_set), self, G_CONNECT_SWAPPED);
}

View file

@ -32,7 +32,8 @@
</child>
<child>
<object class="CcListRow">
<object class="CcListRow" id="location_row">
<property name="visible">False</property>
<property name="title" translatable="yes">_Location</property>
<property name="subtitle" translatable="yes">Control access to your location</property>
<property name="icon-name">location-access-symbolic</property>
@ -124,10 +125,6 @@
<object class="CcScreenPage"/>
</child>
<child>
<object class="CcLocationPage"/>
</child>
<child>
<object class="CcCameraPage"/>
</child>