diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index fe4a2bb9d..150cc26ff 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -30,7 +30,6 @@
#include "firmware-security/cc-firmware-security-page.h"
#include "cc-list-row.h"
#include "location/cc-location-page.h"
-#include "microphone/cc-microphone-page.h"
#include "cc-privacy-resources.h"
#include "screen/cc-screen-page.h"
#include "usage/cc-usage-page.h"
@@ -55,8 +54,6 @@ cc_privacy_panel_get_help_uri (CcPanel *panel)
return "help:gnome-help/camera";
else if (g_strcmp0 (page_tag, "location-page") == 0)
return "help:gnome-help/location";
- else if (g_strcmp0 (page_tag, "microphone-page") == 0)
- return "help:gnome-help/microphone";
else
return NULL;
}
@@ -78,7 +75,6 @@ cc_privacy_panel_class_init (CcPrivacyPanelClass *klass)
g_type_ensure (CC_TYPE_DIAGNOSTICS_PAGE);
g_type_ensure (CC_TYPE_FIRMWARE_SECURITY_PAGE);
g_type_ensure (CC_TYPE_LOCATION_PAGE);
- g_type_ensure (CC_TYPE_MICROPHONE_PAGE);
g_type_ensure (CC_TYPE_SCREEN_PAGE);
g_type_ensure (CC_TYPE_USAGE_PAGE);
}
diff --git a/panels/privacy/cc-privacy-panel.ui b/panels/privacy/cc-privacy-panel.ui
index 8ba3c2c09..44c66b2d4 100644
--- a/panels/privacy/cc-privacy-panel.ui
+++ b/panels/privacy/cc-privacy-panel.ui
@@ -84,18 +84,6 @@
-
-
-
-
-
-
-
-
diff --git a/panels/privacy/meson.build b/panels/privacy/meson.build
index 9962b37c8..67881e9cf 100644
--- a/panels/privacy/meson.build
+++ b/panels/privacy/meson.build
@@ -19,7 +19,6 @@ sources = files(
'firmware-security/cc-firmware-security-page.c',
'firmware-security/cc-firmware-security-utils.c',
'location/cc-location-page.c',
- 'microphone/cc-microphone-page.c',
'cc-privacy-panel.c',
'screen/cc-screen-page.c',
'usage/cc-usage-page.c',
diff --git a/panels/privacy/microphone/cc-microphone-page.c b/panels/privacy/microphone/cc-microphone-page.c
deleted file mode 100644
index 041589943..000000000
--- a/panels/privacy/microphone/cc-microphone-page.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2018 Red Hat, Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see .
- *
- * Author: Matthias Clasen
- */
-
-#include "cc-microphone-page.h"
-#include "cc-util.h"
-
-#include
-#include
-
-#define APP_PERMISSIONS_TABLE "devices"
-#define APP_PERMISSIONS_ID "microphone"
-
-struct _CcMicrophonePage
-{
- AdwNavigationPage parent_instance;
-
- AdwSwitchRow *microphone_row;
- GtkListBox *microphone_apps_list_box;
-
- GSettings *privacy_settings;
- GCancellable *cancellable;
-
- GDBusProxy *perm_store;
- GVariant *microphone_apps_perms;
- GVariant *microphone_apps_data;
- GHashTable *microphone_app_switches;
-
- GtkSizeGroup *microphone_icon_size_group;
-};
-
-G_DEFINE_TYPE (CcMicrophonePage, cc_microphone_page, ADW_TYPE_NAVIGATION_PAGE)
-
-typedef struct
-{
- CcMicrophonePage *self;
- GtkWidget *widget;
- gchar *app_id;
- gboolean changing_state;
- gboolean pending_state;
-} MicrophoneAppStateData;
-
-static void
-microphone_app_state_data_free (MicrophoneAppStateData *data)
-{
- g_free (data->app_id);
- g_slice_free (MicrophoneAppStateData, data);
-}
-
-static void
-on_perm_store_set_done (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- MicrophoneAppStateData *data;
- GVariant *results;
- GError *error = NULL;
-
- results = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),
- res,
- &error);
- if (results == NULL)
- {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("Failed to store permissions: %s", error->message);
- g_error_free (error);
-
- return;
- }
- g_variant_unref (results);
-
- data = (MicrophoneAppStateData *) user_data;
- data->changing_state = FALSE;
- gtk_switch_set_state (GTK_SWITCH (data->widget), data->pending_state);
-}
-
-static gboolean
-on_microphone_app_state_set (GtkSwitch *widget,
- gboolean state,
- gpointer user_data)
-{
- MicrophoneAppStateData *data = (MicrophoneAppStateData *) user_data;
- CcMicrophonePage *self = data->self;
- GVariant *params;
- GVariantIter iter;
- const gchar *key;
- gchar **value;
- GVariantBuilder builder;
- gboolean active_microphone;
-
- if (data->changing_state)
- return TRUE;
-
- active_microphone = !g_settings_get_boolean (self->privacy_settings,
- "disable-microphone");
- data->changing_state = TRUE;
- data->pending_state = active_microphone && state;
-
- g_variant_iter_init (&iter, self->microphone_apps_perms);
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
- while (g_variant_iter_loop (&iter, "{&s^a&s}", &key, &value))
- {
- if (g_strv_length (value) != 1)
- /* It's OK to drop the entry if it's not in expected format */
- continue;
-
- if (g_strcmp0 (data->app_id, key) == 0)
- value[0] = state ? "yes" : "no";
-
- g_variant_builder_add (&builder, "{s^as}", key, value);
- }
-
- params = g_variant_new ("(sbsa{sas}v)",
- APP_PERMISSIONS_TABLE,
- TRUE,
- APP_PERMISSIONS_ID,
- &builder,
- self->microphone_apps_data);
-
- g_dbus_proxy_call (self->perm_store,
- "Set",
- params,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- self->cancellable,
- on_perm_store_set_done,
- data);
-
- return TRUE;
-}
-
-static gboolean
-update_app_switch_state (GValue *value,
- GVariant *variant,
- gpointer data)
-{
- GtkSwitch *w = GTK_SWITCH (data);
- gboolean active_microphone;
- gboolean active_app;
- gboolean state;
-
- active_microphone = !g_variant_get_boolean (variant);
- active_app = gtk_switch_get_active (w);
- state = active_microphone && active_app;
-
- g_value_set_boolean (value, state);
-
- return TRUE;
-}
-
-
-static void
-add_microphone_app (CcMicrophonePage *self,
- const gchar *app_id,
- gboolean enabled)
-{
- GDesktopAppInfo *app_info;
- char *desktop_id;
- GtkWidget *row, *w;
- GIcon *icon;
- MicrophoneAppStateData *data;
-
- w = g_hash_table_lookup (self->microphone_app_switches, app_id);
- if (w != NULL)
- {
- gtk_switch_set_active (GTK_SWITCH (w), enabled);
-
- return;
- }
-
- desktop_id = g_strdup_printf ("%s.desktop", app_id);
- app_info = g_desktop_app_info_new (desktop_id);
- g_free (desktop_id);
- if (app_info == NULL)
- return;
-
- row = adw_action_row_new ();
- gtk_list_box_append (self->microphone_apps_list_box, row);
-
- icon = g_app_info_get_icon (G_APP_INFO (app_info));
- w = gtk_image_new_from_gicon (icon);
- gtk_image_set_icon_size (GTK_IMAGE (w), GTK_ICON_SIZE_LARGE);
- gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
- gtk_size_group_add_widget (self->microphone_icon_size_group, w);
- adw_action_row_add_prefix (ADW_ACTION_ROW (row), w);
- adw_action_row_set_activatable_widget (ADW_ACTION_ROW (row), w);
-
- adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row),
- g_app_info_get_name (G_APP_INFO (app_info)));
-
- w = gtk_switch_new ();
- gtk_switch_set_active (GTK_SWITCH (w), enabled);
- gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
- adw_action_row_add_suffix (ADW_ACTION_ROW (row), w);
-
- g_settings_bind_with_mapping (self->privacy_settings,
- "disable-microphone",
- w,
- "state",
- G_SETTINGS_BIND_GET,
- update_app_switch_state,
- NULL,
- g_object_ref (w),
- g_object_unref);
-
- g_hash_table_insert (self->microphone_app_switches,
- g_strdup (app_id),
- g_object_ref (w));
-
- data = g_slice_new (MicrophoneAppStateData);
- data->self = self;
- data->app_id = g_strdup (app_id);
- data->widget = w;
- data->changing_state = FALSE;
- g_signal_connect_data (G_OBJECT (w),
- "state-set",
- G_CALLBACK (on_microphone_app_state_set),
- data,
- (GClosureNotify) microphone_app_state_data_free,
- 0);
-}
-
-/* Steals permissions and permissions_data references */
-static void
-update_perm_store (CcMicrophonePage *self,
- GVariant *permissions,
- GVariant *permissions_data)
-{
- GVariantIter iter;
- const gchar *key;
- gchar **value;
-
- g_clear_pointer (&self->microphone_apps_perms, g_variant_unref);
- self->microphone_apps_perms = permissions;
- g_clear_pointer (&self->microphone_apps_data, g_variant_unref);
- self->microphone_apps_data = permissions_data;
-
- g_variant_iter_init (&iter, permissions);
- while (g_variant_iter_loop (&iter, "{&s^a&s}", &key, &value))
- {
- gboolean enabled;
-
- if (g_strv_length (value) != 1)
- {
- g_debug ("Permissions for %s in incorrect format, ignoring.", key);
- continue;
- }
-
- enabled = (g_strcmp0 (value[0], "no") != 0);
-
- add_microphone_app (self, key, enabled);
- }
-}
-
-static void
-on_perm_store_signal (GDBusProxy *proxy,
- gchar *sender_name,
- gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
-{
- GVariant *permissions, *permissions_data;
-
- if (g_strcmp0 (signal_name, "Changed") != 0)
- return;
-
- permissions = g_variant_get_child_value (parameters, 4);
- permissions_data = g_variant_get_child_value (parameters, 3);
- update_perm_store (user_data, permissions, permissions_data);
-}
-
-static void
-on_perm_store_lookup_done (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- CcMicrophonePage *self = user_data;
- g_autoptr(GError) error = NULL;
- GVariant *ret, *permissions, *permissions_data;
-
- ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),
- res,
- &error);
- if (ret == NULL)
- {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("Failed fetch permissions from flatpak permission store: %s", error->message);
- return;
- }
-
- permissions = g_variant_get_child_value (ret, 0);
- permissions_data = g_variant_get_child_value (ret, 1);
- update_perm_store (user_data, permissions, permissions_data);
-
- g_signal_connect_object (source_object,
- "g-signal",
- G_CALLBACK (on_perm_store_signal),
- self,
- 0);
-}
-
-static void
-on_perm_store_ready (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- CcMicrophonePage *self;
- g_autoptr(GError) error = NULL;
- GDBusProxy *proxy;
- GVariant *params;
-
- proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (proxy == NULL)
- {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("Failed to connect to flatpak permission store: %s", error->message);
- return;
- }
- self = user_data;
- self->perm_store = proxy;
-
- params = g_variant_new ("(ss)",
- APP_PERMISSIONS_TABLE,
- APP_PERMISSIONS_ID);
- g_dbus_proxy_call (self->perm_store,
- "Lookup",
- params,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- self->cancellable,
- on_perm_store_lookup_done,
- self);
-}
-
-static void
-cc_microphone_page_finalize (GObject *object)
-{
- CcMicrophonePage *self = CC_MICROPHONE_PAGE (object);
-
- g_cancellable_cancel (self->cancellable);
- g_clear_object (&self->cancellable);
-
- g_clear_object (&self->privacy_settings);
- g_clear_object (&self->perm_store);
- g_clear_object (&self->microphone_icon_size_group);
- g_clear_pointer (&self->microphone_apps_perms, g_variant_unref);
- g_clear_pointer (&self->microphone_apps_data, g_variant_unref);
- g_clear_pointer (&self->microphone_app_switches, g_hash_table_unref);
-
- G_OBJECT_CLASS (cc_microphone_page_parent_class)->finalize (object);
-}
-
-static void
-cc_microphone_page_class_init (CcMicrophonePageClass *klass)
-{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = cc_microphone_page_finalize;
-
- gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/privacy/microphone/cc-microphone-page.ui");
-
- gtk_widget_class_bind_template_child (widget_class, CcMicrophonePage, microphone_row);
- gtk_widget_class_bind_template_child (widget_class, CcMicrophonePage, microphone_apps_list_box);
-}
-
-static void
-cc_microphone_page_init (CcMicrophonePage *self)
-{
- gtk_widget_init_template (GTK_WIDGET (self));
-
- self->microphone_icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
-
- self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
-
- self->cancellable = g_cancellable_new ();
-
- g_settings_bind (self->privacy_settings,
- "disable-microphone",
- self->microphone_row,
- "active",
- G_SETTINGS_BIND_INVERT_BOOLEAN);
-
- self->microphone_app_switches = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- g_object_unref);
-
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.impl.portal.PermissionStore",
- "/org/freedesktop/impl/portal/PermissionStore",
- "org.freedesktop.impl.portal.PermissionStore",
- self->cancellable,
- on_perm_store_ready,
- self);
-}
diff --git a/panels/privacy/microphone/cc-microphone-page.h b/panels/privacy/microphone/cc-microphone-page.h
deleted file mode 100644
index ddc7ebffa..000000000
--- a/panels/privacy/microphone/cc-microphone-page.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2018 Red Hat, Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see .
- *
- * Author: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-G_BEGIN_DECLS
-
-#define CC_TYPE_MICROPHONE_PAGE (cc_microphone_page_get_type ())
-G_DECLARE_FINAL_TYPE (CcMicrophonePage, cc_microphone_page, CC, MICROPHONE_PAGE, AdwNavigationPage)
-
-G_END_DECLS
diff --git a/panels/privacy/microphone/cc-microphone-page.ui b/panels/privacy/microphone/cc-microphone-page.ui
deleted file mode 100644
index 61b9bea1d..000000000
--- a/panels/privacy/microphone/cc-microphone-page.ui
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
- Microphones
- microphone
-
-
-
-
-
-
-
-
-
-
-
- _Microphone Access
- Allow permitted apps to use microphones
- True
-
-
-
-
-
-
-
- Permitted Apps
- The following sandboxed apps have been given permission to use microphones. Apps that are not sandboxed can use microphones without asking for permission.
-
-
- true
- none
-
-
-
-
- 18
- 18
- 18
- 18
- No sandboxed apps have asked for microphone access
- true
- 50
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/panels/privacy/privacy.gresource.xml b/panels/privacy/privacy.gresource.xml
index 9b6053b5d..4e478fdac 100644
--- a/panels/privacy/privacy.gresource.xml
+++ b/panels/privacy/privacy.gresource.xml
@@ -11,7 +11,6 @@
firmware-security/cc-firmware-security-help-dialog.ui
firmware-security/cc-firmware-security-page.ui
location/cc-location-page.ui
- microphone/cc-microphone-page.ui
cc-privacy-panel.ui
screen/cc-screen-page.ui
usage/cc-usage-page.ui
@@ -23,7 +22,6 @@
icons/scalable/actions/device-diagnostics-symbolic.svg
icons/scalable/actions/device-security-symbolic.svg
icons/scalable/actions/location-access-symbolic.svg
- icons/scalable/actions/microphone-access-symbolic.svg
icons/scalable/actions/screen-lock-symbolic.svg
icons/scalable/actions/thunderbolt-access-symbolic.svg
icons/scalable/actions/trash-file-history-symbolic.svg
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 80fc5d733..2e4fe019a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -173,7 +173,6 @@ panels/privacy/firmware-security/cc-firmware-security-page.ui
panels/privacy/firmware-security/cc-firmware-security-utils.c
panels/privacy/location/cc-location-page.ui
panels/privacy/location/cc-location-page.c
-panels/privacy/microphone/cc-microphone-page.ui
panels/privacy/cc-privacy-panel.ui
panels/privacy/screen/cc-screen-page.c
panels/privacy/screen/cc-screen-page.ui