shell: Disable privacy panels temporarely

It will be reimplemented in a single panel in later commits.
This commit is contained in:
Marco Melorio 2023-06-03 12:31:53 +02:00 committed by Felipe Borges
parent 174ca7c935
commit 31a91a221c
7 changed files with 9 additions and 185 deletions

View file

@ -3,17 +3,12 @@ subdir('common')
panels = [
'applications',
'background',
'camera',
'color',
'datetime',
'default-apps',
'diagnostics',
'display',
'firmware-security',
'info-overview',
'keyboard',
'location',
'microphone',
'mouse',
'multitasking',
'notifications',
@ -22,12 +17,10 @@ panels = [
'printers',
'region',
'removable-media',
'screen',
'search',
'sharing',
'sound',
'universal-access',
'usage',
'user-accounts',
'wwan',
]
@ -39,7 +32,6 @@ endif
if host_is_linux_not_s390
panels += [
'bluetooth',
'thunderbolt',
'wacom'
]
endif

View file

@ -42,7 +42,6 @@ struct _CcPanelList
{
AdwBin parent;
GtkWidget *privacy_listbox;
GtkWidget *main_listbox;
GtkWidget *search_listbox;
GtkStack *stack;
@ -52,8 +51,6 @@ struct _CcPanelList
*/
gboolean autoselect_panel : 1;
GtkListBoxRow *privacy_row;
gchar *current_panel_id;
gchar *search_query;
@ -95,9 +92,6 @@ get_widget_from_view (CcPanelList *self,
case CC_PANEL_LIST_MAIN:
return self->main_listbox;
case CC_PANEL_LIST_PRIVACY:
return self->privacy_listbox;
case CC_PANEL_LIST_SEARCH:
return self->search_listbox;
@ -109,40 +103,21 @@ get_widget_from_view (CcPanelList *self,
}
}
static GtkWidget *
get_listbox_from_category (CcPanelList *self,
CcPanelCategory category)
{
switch (category)
{
case CC_CATEGORY_PRIVACY:
return self->privacy_listbox;
break;
default:
return self->main_listbox;
break;
}
return NULL;
}
static void
activate_row_below (CcPanelList *self,
RowData *data)
{
GtkListBoxRow *next_row;
GtkListBox *listbox;
guint row_index;
row_index = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (data->row));
listbox = GTK_LIST_BOX (get_listbox_from_category (self, data->category));
next_row = gtk_list_box_get_row_at_index (listbox, row_index + 1);
next_row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->main_listbox),
row_index + 1);
/* Try the previous one if the current is invalid */
if (!next_row)
next_row = gtk_list_box_get_row_at_index (listbox, row_index - 1);
next_row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->main_listbox),
row_index - 1);
if (next_row)
g_signal_emit_by_name (next_row, "activate");
@ -155,9 +130,6 @@ get_view_from_listbox (CcPanelList *self,
if (listbox == self->main_listbox)
return CC_PANEL_LIST_MAIN;
if (listbox == self->privacy_listbox)
return CC_PANEL_LIST_PRIVACY;
return CC_PANEL_LIST_SEARCH;
}
@ -242,12 +214,7 @@ get_panel_id_from_row (CcPanelList *self,
GtkListBoxRow *row)
{
RowData *row_data;
if (row == self->privacy_row)
return "privacy";
row_data = g_object_get_data (G_OBJECT (row), "data");
RowData *row_data = g_object_get_data (G_OBJECT (row), "data");
g_assert (row_data != NULL);
return row_data->id;
@ -401,20 +368,9 @@ static const gchar * const panel_order[] = {
"search",
"multitasking",
"applications",
"privacy",
"online-accounts",
"sharing",
/* Privacy page */
"location",
"camera",
"microphone",
"thunderbolt",
"usage",
"lock",
"diagnostics",
"firmware-security",
/* Devices page */
"sound",
"power",
@ -522,13 +478,6 @@ header_func (GtkListBoxRow *row,
if (!before)
return;
if (row == self->privacy_row || before == self->privacy_row)
return;
/*
* We can only retrieve the data after assuring that none
* of the rows are the Privacy row.
*/
row_data = g_object_get_data (G_OBJECT (row), "data");
before_data = g_object_get_data (G_OBJECT (before), "data");
@ -557,25 +506,6 @@ row_activated_cb (GtkWidget *listbox,
{
RowData *data;
if (row == self->privacy_row)
{
switch_to_view (self, CC_PANEL_LIST_PRIVACY);
goto out;
}
/*
* When a panel is selected, the previous one should be
* unselected, except when it's search.
*/
if (listbox != self->search_listbox)
{
if (listbox != self->main_listbox)
gtk_list_box_unselect_all (GTK_LIST_BOX (self->main_listbox));
if (listbox != self->privacy_listbox)
gtk_list_box_unselect_all (GTK_LIST_BOX (self->privacy_listbox));
}
/*
* Since we're not sure that the activated row is in the
* current view, set the view here.
@ -598,7 +528,6 @@ row_activated_cb (GtkWidget *listbox,
g_signal_emit (self, signals[SHOW_PANEL], 0, data->id);
out:
/* After selecting the panel and eventually changing the view, reset the
* autoselect flag. If necessary, cc_panel_list_set_active_panel() will
* set it to FALSE again.
@ -611,7 +540,6 @@ search_row_activated_cb (GtkWidget *listbox,
GtkListBoxRow *row,
CcPanelList *self)
{
GtkWidget *real_listbox;
GtkWidget *child;
RowData *data;
@ -619,13 +547,8 @@ search_row_activated_cb (GtkWidget *listbox,
data = g_object_get_data (G_OBJECT (row), "data");
if (data->category == CC_CATEGORY_PRIVACY)
real_listbox = self->privacy_listbox;
else
real_listbox = self->main_listbox;
/* Select the correct row */
for (child = gtk_widget_get_first_child (real_listbox);
for (child = gtk_widget_get_first_child (self->main_listbox);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
@ -647,7 +570,7 @@ search_row_activated_cb (GtkWidget *listbox,
real_row = GTK_LIST_BOX_ROW (real_row_data->row);
gtk_list_box_select_row (GTK_LIST_BOX (real_listbox), real_row);
gtk_list_box_select_row (GTK_LIST_BOX (self->main_listbox), real_row);
gtk_widget_grab_focus (GTK_WIDGET (real_row));
/* Don't autoselect first panel because we are already
@ -813,8 +736,6 @@ cc_panel_list_class_init (CcPanelListClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Settings/gtk/cc-panel-list.ui");
gtk_widget_class_bind_template_child (widget_class, CcPanelList, privacy_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, privacy_row);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, main_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, search_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, stack);
@ -838,11 +759,6 @@ cc_panel_list_init (CcPanelList *self)
self,
NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->privacy_listbox),
sort_function,
self,
NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (self->main_listbox),
header_func,
self,
@ -990,7 +906,6 @@ cc_panel_list_add_panel (CcPanelList *self,
CcPanelVisibility visibility,
gboolean has_sidebar)
{
GtkWidget *listbox;
RowData *data, *search_data;
g_return_if_fail (CC_IS_PANEL_LIST (self));
@ -999,8 +914,7 @@ cc_panel_list_add_panel (CcPanelList *self,
data = row_data_new (category, id, title, description, keywords, icon, visibility, has_sidebar);
gtk_widget_set_visible (data->row, visibility == CC_PANEL_VISIBLE);
listbox = get_listbox_from_category (self, category);
gtk_list_box_append (GTK_LIST_BOX (listbox), data->row);
gtk_list_box_append (GTK_LIST_BOX (self->main_listbox), data->row);
/* And add to the search listbox too */
search_data = row_data_new (category, id, title, description, keywords, icon, visibility, has_sidebar);
@ -1010,10 +924,6 @@ cc_panel_list_add_panel (CcPanelList *self,
g_hash_table_insert (self->id_to_data, data->id, data);
g_hash_table_insert (self->id_to_search_data, search_data->id, search_data);
/* Only show the Devices/Details rows when there's at least one panel */
if (category == CC_CATEGORY_PRIVACY)
gtk_widget_set_visible (GTK_WIDGET (self->privacy_row), TRUE);
}
/* Scrolls sibebar so that @row is at middle of the visible part of list */
@ -1187,7 +1097,7 @@ cc_panel_list_add_sidebar_widget (CcPanelList *self,
gtk_stack_add_named (self->stack, widget, "custom-widget");
switch_to_view (self, CC_PANEL_LIST_WIDGET);
}
else if (self->view != CC_PANEL_LIST_PRIVACY)
else
{
switch_to_view (self, CC_PANEL_LIST_MAIN);
}

View file

@ -30,7 +30,6 @@ G_BEGIN_DECLS
typedef enum
{
CC_PANEL_LIST_MAIN,
CC_PANEL_LIST_PRIVACY,
CC_PANEL_LIST_WIDGET,
CC_PANEL_LIST_SEARCH
} CcPanelListView;

View file

@ -21,51 +21,6 @@
<style>
<class name="navigation-sidebar" />
</style>
<child>
<object class="GtkListBoxRow" id="privacy_row">
<property name="visible">False</property>
<child>
<object class="GtkBox">
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage">
<property name="icon_name">preferences-system-privacy-symbolic</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Privacy</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon_name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">privacy</property>
<property name="child">
<object class="GtkListBox" id="privacy_listbox">
<signal name="row-activated" handler="row_activated_cb" object="CcPanelList" swapped="no" />
<style>
<class name="navigation-sidebar" />
</style>
</object>
</property>
</object>

View file

@ -57,9 +57,6 @@ extern GType cc_removable_media_panel_get_type (void);
extern GType cc_search_panel_get_type (void);
extern GType cc_sharing_panel_get_type (void);
extern GType cc_sound_panel_get_type (void);
#ifdef BUILD_THUNDERBOLT
extern GType cc_bolt_panel_get_type (void);
#endif /* BUILD_THUNDERBOLT */
extern GType cc_ua_panel_get_type (void);
extern GType cc_user_panel_get_type (void);
#ifdef BUILD_WACOM
@ -68,19 +65,8 @@ extern GType cc_wacom_panel_get_type (void);
#ifdef BUILD_WWAN
extern GType cc_wwan_panel_get_type (void);
#endif /* BUILD_WWAN */
extern GType cc_location_panel_get_type (void);
extern GType cc_firmware_security_panel_get_type (void);
extern GType cc_camera_panel_get_type (void);
extern GType cc_microphone_panel_get_type (void);
extern GType cc_usage_panel_get_type (void);
extern GType cc_screen_panel_get_type (void);
extern GType cc_diagnostics_panel_get_type (void);
/* Static init functions */
extern void cc_diagnostics_panel_static_init_func (void);
#ifdef BUILD_THUNDERBOLT
extern void cc_thunderbolt_panel_static_init_func (void);
#endif /* BUILD_THUNDERBOLT */
#ifdef BUILD_NETWORK
extern void cc_wifi_panel_static_init_func (void);
#endif /* BUILD_NETWORK */
@ -90,7 +76,6 @@ extern void cc_wacom_panel_static_init_func (void);
#ifdef BUILD_WWAN
extern void cc_wwan_panel_static_init_func (void);
#endif /* BUILD_WWAN */
extern void cc_firmware_security_panel_static_init_func (void);
#define PANEL_TYPE(name, get_type, init_func) { name, get_type, init_func }
@ -107,17 +92,12 @@ static CcPanelLoaderVtable default_panels[] =
#ifdef BUILD_BLUETOOTH
PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),
#endif
PANEL_TYPE("camera", cc_camera_panel_get_type, NULL),
PANEL_TYPE("color", cc_color_panel_get_type, NULL),
PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
PANEL_TYPE("diagnostics", cc_diagnostics_panel_get_type, cc_diagnostics_panel_static_init_func),
PANEL_TYPE("display", cc_display_panel_get_type, NULL),
PANEL_TYPE("info-overview", cc_info_overview_panel_get_type, NULL),
PANEL_TYPE("keyboard", cc_keyboard_panel_get_type, NULL),
PANEL_TYPE("location", cc_location_panel_get_type, NULL),
PANEL_TYPE("firmware-security",cc_firmware_security_panel_get_type, cc_firmware_security_panel_static_init_func),
PANEL_TYPE("microphone", cc_microphone_panel_get_type, NULL),
PANEL_TYPE("mouse", cc_mouse_panel_get_type, NULL),
PANEL_TYPE("multitasking", cc_multitasking_panel_get_type, NULL),
#ifdef BUILD_NETWORK
@ -130,15 +110,10 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("printers", cc_printers_panel_get_type, NULL),
PANEL_TYPE("region", cc_region_panel_get_type, NULL),
PANEL_TYPE("removable-media", cc_removable_media_panel_get_type, NULL),
PANEL_TYPE("screen", cc_screen_panel_get_type, NULL),
PANEL_TYPE("search", cc_search_panel_get_type, NULL),
PANEL_TYPE("sharing", cc_sharing_panel_get_type, NULL),
PANEL_TYPE("sound", cc_sound_panel_get_type, NULL),
#ifdef BUILD_THUNDERBOLT
PANEL_TYPE("thunderbolt", cc_bolt_panel_get_type, cc_thunderbolt_panel_static_init_func),
#endif
PANEL_TYPE("universal-access", cc_ua_panel_get_type, NULL),
PANEL_TYPE("usage", cc_usage_panel_get_type, NULL),
PANEL_TYPE("user-accounts", cc_user_panel_get_type, NULL),
#ifdef BUILD_WACOM
PANEL_TYPE("wacom", cc_wacom_panel_get_type, cc_wacom_panel_static_init_func),
@ -179,8 +154,6 @@ parse_categories (GDesktopAppInfo *app)
retval = CC_CATEGORY_DEVICES;
else if (g_strv_contains (const_strv (split), "X-GNOME-DetailsSettings"))
retval = CC_CATEGORY_DETAILS;
else if (g_strv_contains (const_strv (split), "X-GNOME-PrivacySettings"))
retval = CC_CATEGORY_PRIVACY;
else if (g_strv_contains (const_strv (split), "HardwareSettings"))
retval = CC_CATEGORY_HARDWARE;

View file

@ -36,7 +36,6 @@ typedef enum
CC_CATEGORY_PERSONALIZATION,
CC_CATEGORY_ACCOUNT,
CC_CATEGORY_HARDWARE,
CC_CATEGORY_PRIVACY,
CC_CATEGORY_DEVICES,
CC_CATEGORY_DETAILS,
CC_CATEGORY_LAST

View file

@ -238,10 +238,6 @@ update_list_title (CcWindow *self)
switch (view)
{
case CC_PANEL_LIST_PRIVACY:
title = g_strdup (_("Privacy"));
break;
case CC_PANEL_LIST_MAIN:
title = g_strdup (_("Settings"));
break;