From 5bdb89067568dd7ddcc465c21171c3e93ff873d6 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Tue, 19 Mar 2024 15:34:32 +0100 Subject: [PATCH] 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 --- meson.build | 5 +++++ meson_options.txt | 1 + panels/privacy/cc-privacy-panel.c | 11 +++++++++++ panels/privacy/cc-privacy-panel.ui | 7 ++----- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 1e2833646..41cd1a89d 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/meson_options.txt b/meson_options.txt index e53d6e3f3..f415a7e71 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c index b90019922..33024d26a 100644 --- a/panels/privacy/cc-privacy-panel.c +++ b/panels/privacy/cc-privacy-panel.c @@ -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); } diff --git a/panels/privacy/cc-privacy-panel.ui b/panels/privacy/cc-privacy-panel.ui index 44c66b2d4..1b3b9932c 100644 --- a/panels/privacy/cc-privacy-panel.ui +++ b/panels/privacy/cc-privacy-panel.ui @@ -32,7 +32,8 @@ - + + False _Location Control access to your location location-access-symbolic @@ -124,10 +125,6 @@ - - - -