panel-list: Remove the Devices subsection
Same case of the Details subsection, it's now part of the main list.
This commit is contained in:
parent
e7f221e1b9
commit
a99ad542ae
4 changed files with 17 additions and 147 deletions
|
@ -42,7 +42,6 @@ struct _CcPanelList
|
|||
{
|
||||
GtkStack parent;
|
||||
|
||||
GtkWidget *devices_listbox;
|
||||
GtkWidget *privacy_listbox;
|
||||
GtkWidget *main_listbox;
|
||||
GtkWidget *search_listbox;
|
||||
|
@ -52,7 +51,6 @@ struct _CcPanelList
|
|||
*/
|
||||
gboolean autoselect_panel : 1;
|
||||
|
||||
GtkListBoxRow *devices_row;
|
||||
GtkListBoxRow *privacy_row;
|
||||
|
||||
gchar *current_panel_id;
|
||||
|
@ -96,9 +94,6 @@ get_widget_from_view (CcPanelList *self,
|
|||
case CC_PANEL_LIST_MAIN:
|
||||
return self->main_listbox;
|
||||
|
||||
case CC_PANEL_LIST_DEVICES:
|
||||
return self->devices_listbox;
|
||||
|
||||
case CC_PANEL_LIST_PRIVACY:
|
||||
return self->privacy_listbox;
|
||||
|
||||
|
@ -120,10 +115,6 @@ get_listbox_from_category (CcPanelList *self,
|
|||
|
||||
switch (category)
|
||||
{
|
||||
case CC_CATEGORY_DEVICES:
|
||||
return self->devices_listbox;
|
||||
break;
|
||||
|
||||
case CC_CATEGORY_PRIVACY:
|
||||
return self->privacy_listbox;
|
||||
break;
|
||||
|
@ -149,7 +140,7 @@ activate_row_below (CcPanelList *self,
|
|||
next_row = gtk_list_box_get_row_at_index (listbox, row_index + 1);
|
||||
|
||||
/* Try the previous one if the current is invalid */
|
||||
if (!next_row || next_row == self->devices_row)
|
||||
if (!next_row)
|
||||
next_row = gtk_list_box_get_row_at_index (listbox, row_index - 1);
|
||||
|
||||
if (next_row)
|
||||
|
@ -163,9 +154,6 @@ get_view_from_listbox (CcPanelList *self,
|
|||
if (listbox == self->main_listbox)
|
||||
return CC_PANEL_LIST_MAIN;
|
||||
|
||||
if (listbox == self->devices_listbox)
|
||||
return CC_PANEL_LIST_DEVICES;
|
||||
|
||||
if (listbox == self->privacy_listbox)
|
||||
return CC_PANEL_LIST_PRIVACY;
|
||||
|
||||
|
@ -250,9 +238,7 @@ get_panel_id_from_row (CcPanelList *self,
|
|||
|
||||
RowData *row_data;
|
||||
|
||||
if (row == self->devices_row)
|
||||
return "devices";
|
||||
else if (row == self->privacy_row)
|
||||
if (row == self->privacy_row)
|
||||
return "privacy";
|
||||
|
||||
row_data = g_object_get_data (G_OBJECT (row), "data");
|
||||
|
@ -412,7 +398,6 @@ static const gchar * const panel_order[] = {
|
|||
"sound",
|
||||
"power",
|
||||
"network",
|
||||
"devices",
|
||||
|
||||
/* Privacy page */
|
||||
"location",
|
||||
|
@ -523,12 +508,22 @@ header_func (GtkListBoxRow *row,
|
|||
gpointer user_data)
|
||||
{
|
||||
CcPanelList *self = CC_PANEL_LIST (user_data);
|
||||
RowData *row_data, *before_data;
|
||||
|
||||
if (!before)
|
||||
return;
|
||||
|
||||
/* The Details row always have the separator */
|
||||
if (row == self->devices_row)
|
||||
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");
|
||||
|
||||
if (row_data->category != before_data->category)
|
||||
{
|
||||
GtkWidget *separator;
|
||||
|
||||
|
@ -540,36 +535,7 @@ header_func (GtkListBoxRow *row,
|
|||
}
|
||||
else
|
||||
{
|
||||
RowData *row_data, *before_data;
|
||||
|
||||
if (row == self->privacy_row ||
|
||||
before == self->devices_row ||
|
||||
before == self->privacy_row)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We can only retrieve the data after assuring that none
|
||||
* of the rows are Devices and Details.
|
||||
*/
|
||||
row_data = g_object_get_data (G_OBJECT (row), "data");
|
||||
before_data = g_object_get_data (G_OBJECT (before), "data");
|
||||
|
||||
if (row_data->category != before_data->category)
|
||||
{
|
||||
GtkWidget *separator;
|
||||
|
||||
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_widget_set_hexpand (separator, TRUE);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
gtk_list_box_row_set_header (row, separator);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_list_box_row_set_header (row, NULL);
|
||||
}
|
||||
gtk_list_box_row_set_header (row, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,13 +555,6 @@ row_activated_cb (GtkWidget *listbox,
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* Devices */
|
||||
if (row == self->devices_row)
|
||||
{
|
||||
switch_to_view (self, CC_PANEL_LIST_DEVICES);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* When a panel is selected, the previous one should be
|
||||
* unselected, except when it's search.
|
||||
|
@ -605,9 +564,6 @@ row_activated_cb (GtkWidget *listbox,
|
|||
if (listbox != self->main_listbox)
|
||||
gtk_list_box_unselect_all (GTK_LIST_BOX (self->main_listbox));
|
||||
|
||||
if (listbox != self->devices_listbox)
|
||||
gtk_list_box_unselect_all (GTK_LIST_BOX (self->devices_listbox));
|
||||
|
||||
if (listbox != self->privacy_listbox)
|
||||
gtk_list_box_unselect_all (GTK_LIST_BOX (self->privacy_listbox));
|
||||
}
|
||||
|
@ -655,9 +611,7 @@ search_row_activated_cb (GtkWidget *listbox,
|
|||
|
||||
data = g_object_get_data (G_OBJECT (row), "data");
|
||||
|
||||
if (data->category == CC_CATEGORY_DEVICES)
|
||||
real_listbox = self->devices_listbox;
|
||||
else if (data->category == CC_CATEGORY_PRIVACY)
|
||||
if (data->category == CC_CATEGORY_PRIVACY)
|
||||
real_listbox = self->privacy_listbox;
|
||||
else
|
||||
real_listbox = self->main_listbox;
|
||||
|
@ -827,8 +781,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_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, privacy_listbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcPanelList, privacy_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcPanelList, main_listbox);
|
||||
|
@ -857,11 +809,6 @@ cc_panel_list_init (CcPanelList *self)
|
|||
self,
|
||||
NULL);
|
||||
|
||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->devices_listbox),
|
||||
sort_function,
|
||||
self,
|
||||
NULL);
|
||||
|
||||
gtk_list_box_set_header_func (GTK_LIST_BOX (self->main_listbox),
|
||||
header_func,
|
||||
self,
|
||||
|
@ -1016,9 +963,7 @@ cc_panel_list_add_panel (CcPanelList *self,
|
|||
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_DEVICES)
|
||||
gtk_widget_show (GTK_WIDGET (self->devices_row));
|
||||
else if (category == CC_CATEGORY_PRIVACY)
|
||||
if (category == CC_CATEGORY_PRIVACY)
|
||||
gtk_widget_show (GTK_WIDGET (self->privacy_row));
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1097,6 @@ cc_panel_list_set_selection_mode (CcPanelList *self,
|
|||
g_return_if_fail (CC_IS_PANEL_LIST (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->devices_listbox), selection_mode);
|
||||
|
||||
/* When selection mode changed, selection will be lost. So reselect */
|
||||
if (selection_mode == GTK_SELECTION_SINGLE && self->current_panel_id)
|
||||
|
|
|
@ -30,7 +30,6 @@ G_BEGIN_DECLS
|
|||
typedef enum
|
||||
{
|
||||
CC_PANEL_LIST_MAIN,
|
||||
CC_PANEL_LIST_DEVICES,
|
||||
CC_PANEL_LIST_PRIVACY,
|
||||
CC_PANEL_LIST_WIDGET,
|
||||
CC_PANEL_LIST_SEARCH
|
||||
|
|
|
@ -70,64 +70,6 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="devices_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-devices-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">Devices</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>
|
||||
<packing>
|
||||
<property name="name">main</property>
|
||||
|
@ -144,17 +86,6 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="devices_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">devices</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="search_listbox">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -277,10 +277,6 @@ update_list_title (CcWindow *self)
|
|||
title = g_strdup (_("Privacy"));
|
||||
break;
|
||||
|
||||
case CC_PANEL_LIST_DEVICES:
|
||||
title = g_strdup (_("Devices"));
|
||||
break;
|
||||
|
||||
case CC_PANEL_LIST_MAIN:
|
||||
title = g_strdup (_("Settings"));
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue