panel-list: Remove Details subsection

As per the latest mockups, the Details section is a toplevel
section, and not an actual subsection.

Remove all the code that implemented Details as a subsection,
and simply treat these panels as toplevel ones.
This commit is contained in:
Georges Basile Stavracas Neto 2019-11-27 19:23:11 -03:00
parent 3576133654
commit f0d246a8b0
4 changed files with 4 additions and 116 deletions

View file

@ -42,7 +42,6 @@ struct _CcPanelList
{ {
GtkStack parent; GtkStack parent;
GtkWidget *details_listbox;
GtkWidget *devices_listbox; GtkWidget *devices_listbox;
GtkWidget *privacy_listbox; GtkWidget *privacy_listbox;
GtkWidget *main_listbox; GtkWidget *main_listbox;
@ -53,7 +52,6 @@ struct _CcPanelList
*/ */
gboolean autoselect_panel : 1; gboolean autoselect_panel : 1;
GtkListBoxRow *details_row;
GtkListBoxRow *devices_row; GtkListBoxRow *devices_row;
GtkListBoxRow *privacy_row; GtkListBoxRow *privacy_row;
@ -98,9 +96,6 @@ get_widget_from_view (CcPanelList *self,
case CC_PANEL_LIST_MAIN: case CC_PANEL_LIST_MAIN:
return self->main_listbox; return self->main_listbox;
case CC_PANEL_LIST_DETAILS:
return self->details_listbox;
case CC_PANEL_LIST_DEVICES: case CC_PANEL_LIST_DEVICES:
return self->devices_listbox; return self->devices_listbox;
@ -129,10 +124,6 @@ get_listbox_from_category (CcPanelList *self,
return self->devices_listbox; return self->devices_listbox;
break; break;
case CC_CATEGORY_DETAILS:
return self->details_listbox;
break;
case CC_CATEGORY_PRIVACY: case CC_CATEGORY_PRIVACY:
return self->privacy_listbox; return self->privacy_listbox;
break; break;
@ -158,7 +149,7 @@ activate_row_below (CcPanelList *self,
next_row = gtk_list_box_get_row_at_index (listbox, row_index + 1); next_row = gtk_list_box_get_row_at_index (listbox, row_index + 1);
/* Try the previous one if the current is invalid */ /* Try the previous one if the current is invalid */
if (!next_row || next_row == self->devices_row || next_row == self->details_row) if (!next_row || next_row == self->devices_row)
next_row = gtk_list_box_get_row_at_index (listbox, row_index - 1); next_row = gtk_list_box_get_row_at_index (listbox, row_index - 1);
if (next_row) if (next_row)
@ -172,9 +163,6 @@ get_view_from_listbox (CcPanelList *self,
if (listbox == self->main_listbox) if (listbox == self->main_listbox)
return CC_PANEL_LIST_MAIN; return CC_PANEL_LIST_MAIN;
if (listbox == self->details_listbox)
return CC_PANEL_LIST_DETAILS;
if (listbox == self->devices_listbox) if (listbox == self->devices_listbox)
return CC_PANEL_LIST_DEVICES; return CC_PANEL_LIST_DEVICES;
@ -262,9 +250,7 @@ get_panel_id_from_row (CcPanelList *self,
RowData *row_data; RowData *row_data;
if (row == self->details_row) if (row == self->devices_row)
return "details";
else if (row == self->devices_row)
return "devices"; return "devices";
else if (row == self->privacy_row) else if (row == self->privacy_row)
return "privacy"; return "privacy";
@ -429,7 +415,6 @@ static const gchar * const panel_order[] = {
"power", "power",
"network", "network",
"devices", "devices",
"details",
/* Privacy page */ /* Privacy page */
"location", "location",
@ -543,7 +528,7 @@ header_func (GtkListBoxRow *row,
return; return;
/* The Details row always have the separator */ /* The Details row always have the separator */
if (row == self->details_row || row == self->devices_row) if (row == self->devices_row)
{ {
GtkWidget *separator; GtkWidget *separator;
@ -558,7 +543,6 @@ header_func (GtkListBoxRow *row,
RowData *row_data, *before_data; RowData *row_data, *before_data;
if (row == self->privacy_row || if (row == self->privacy_row ||
before == self->details_row ||
before == self->devices_row || before == self->devices_row ||
before == self->privacy_row) before == self->privacy_row)
{ {
@ -605,13 +589,6 @@ row_activated_cb (GtkWidget *listbox,
goto out; goto out;
} }
/* Details */
if (row == self->details_row)
{
switch_to_view (self, CC_PANEL_LIST_DETAILS);
goto out;
}
/* Devices */ /* Devices */
if (row == self->devices_row) if (row == self->devices_row)
{ {
@ -628,9 +605,6 @@ row_activated_cb (GtkWidget *listbox,
if (listbox != self->main_listbox) if (listbox != self->main_listbox)
gtk_list_box_unselect_all (GTK_LIST_BOX (self->main_listbox)); gtk_list_box_unselect_all (GTK_LIST_BOX (self->main_listbox));
if (listbox != self->details_listbox)
gtk_list_box_unselect_all (GTK_LIST_BOX (self->details_listbox));
if (listbox != self->devices_listbox) if (listbox != self->devices_listbox)
gtk_list_box_unselect_all (GTK_LIST_BOX (self->devices_listbox)); gtk_list_box_unselect_all (GTK_LIST_BOX (self->devices_listbox));
@ -681,9 +655,7 @@ search_row_activated_cb (GtkWidget *listbox,
data = g_object_get_data (G_OBJECT (row), "data"); data = g_object_get_data (G_OBJECT (row), "data");
if (data->category == CC_CATEGORY_DETAILS) if (data->category == CC_CATEGORY_DEVICES)
real_listbox = self->details_listbox;
else if (data->category == CC_CATEGORY_DEVICES)
real_listbox = self->devices_listbox; real_listbox = self->devices_listbox;
else if (data->category == CC_CATEGORY_PRIVACY) else if (data->category == CC_CATEGORY_PRIVACY)
real_listbox = self->privacy_listbox; real_listbox = self->privacy_listbox;
@ -855,8 +827,6 @@ cc_panel_list_class_init (CcPanelListClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/ControlCenter/gtk/cc-panel-list.ui"); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/ControlCenter/gtk/cc-panel-list.ui");
gtk_widget_class_bind_template_child (widget_class, CcPanelList, details_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, details_row);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, devices_listbox); gtk_widget_class_bind_template_child (widget_class, CcPanelList, devices_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, devices_row); gtk_widget_class_bind_template_child (widget_class, CcPanelList, devices_row);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, privacy_listbox); gtk_widget_class_bind_template_child (widget_class, CcPanelList, privacy_listbox);
@ -887,11 +857,6 @@ cc_panel_list_init (CcPanelList *self)
self, self,
NULL); NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->details_listbox),
sort_function,
self,
NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->devices_listbox), gtk_list_box_set_sort_func (GTK_LIST_BOX (self->devices_listbox),
sort_function, sort_function,
self, self,
@ -1053,8 +1018,6 @@ cc_panel_list_add_panel (CcPanelList *self,
/* Only show the Devices/Details rows when there's at least one panel */ /* Only show the Devices/Details rows when there's at least one panel */
if (category == CC_CATEGORY_DEVICES) if (category == CC_CATEGORY_DEVICES)
gtk_widget_show (GTK_WIDGET (self->devices_row)); gtk_widget_show (GTK_WIDGET (self->devices_row));
else if (category == CC_CATEGORY_DETAILS)
gtk_widget_show (GTK_WIDGET (self->details_row));
else if (category == CC_CATEGORY_PRIVACY) else if (category == CC_CATEGORY_PRIVACY)
gtk_widget_show (GTK_WIDGET (self->privacy_row)); gtk_widget_show (GTK_WIDGET (self->privacy_row));
} }
@ -1190,7 +1153,6 @@ cc_panel_list_set_selection_mode (CcPanelList *self,
gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->main_listbox), selection_mode); gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->main_listbox), selection_mode);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->devices_listbox), selection_mode); gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->devices_listbox), selection_mode);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->details_listbox), selection_mode);
/* When selection mode changed, selection will be lost. So reselect */ /* When selection mode changed, selection will be lost. So reselect */
if (selection_mode == GTK_SELECTION_SINGLE && self->current_panel_id) if (selection_mode == GTK_SELECTION_SINGLE && self->current_panel_id)

View file

@ -30,7 +30,6 @@ G_BEGIN_DECLS
typedef enum typedef enum
{ {
CC_PANEL_LIST_MAIN, CC_PANEL_LIST_MAIN,
CC_PANEL_LIST_DETAILS,
CC_PANEL_LIST_DEVICES, CC_PANEL_LIST_DEVICES,
CC_PANEL_LIST_PRIVACY, CC_PANEL_LIST_PRIVACY,
CC_PANEL_LIST_WIDGET, CC_PANEL_LIST_WIDGET,

View file

@ -128,64 +128,6 @@
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="GtkListBoxRow" id="details_row">
<property name="visible">False</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">preferences-system-details-symbolic</property>
<style>
<class name="sidebar-icon" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Details</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-next-symbolic</property>
<style>
<class name="sidebar-icon" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="name">main</property> <property name="name">main</property>
@ -213,17 +155,6 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkListBox" id="details_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="row-activated" handler="row_activated_cb" object="CcPanelList" swapped="no" />
</object>
<packing>
<property name="name">details</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkListBox" id="search_listbox"> <object class="GtkListBox" id="search_listbox">
<property name="visible">True</property> <property name="visible">True</property>

View file

@ -277,10 +277,6 @@ update_list_title (CcWindow *self)
title = g_strdup (_("Privacy")); title = g_strdup (_("Privacy"));
break; break;
case CC_PANEL_LIST_DETAILS:
title = g_strdup (_("Details"));
break;
case CC_PANEL_LIST_DEVICES: case CC_PANEL_LIST_DEVICES:
title = g_strdup (_("Devices")); title = g_strdup (_("Devices"));
break; break;