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;
|
GtkStack parent;
|
||||||
|
|
||||||
GtkWidget *devices_listbox;
|
|
||||||
GtkWidget *privacy_listbox;
|
GtkWidget *privacy_listbox;
|
||||||
GtkWidget *main_listbox;
|
GtkWidget *main_listbox;
|
||||||
GtkWidget *search_listbox;
|
GtkWidget *search_listbox;
|
||||||
|
@ -52,7 +51,6 @@ struct _CcPanelList
|
||||||
*/
|
*/
|
||||||
gboolean autoselect_panel : 1;
|
gboolean autoselect_panel : 1;
|
||||||
|
|
||||||
GtkListBoxRow *devices_row;
|
|
||||||
GtkListBoxRow *privacy_row;
|
GtkListBoxRow *privacy_row;
|
||||||
|
|
||||||
gchar *current_panel_id;
|
gchar *current_panel_id;
|
||||||
|
@ -96,9 +94,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_DEVICES:
|
|
||||||
return self->devices_listbox;
|
|
||||||
|
|
||||||
case CC_PANEL_LIST_PRIVACY:
|
case CC_PANEL_LIST_PRIVACY:
|
||||||
return self->privacy_listbox;
|
return self->privacy_listbox;
|
||||||
|
|
||||||
|
@ -120,10 +115,6 @@ get_listbox_from_category (CcPanelList *self,
|
||||||
|
|
||||||
switch (category)
|
switch (category)
|
||||||
{
|
{
|
||||||
case CC_CATEGORY_DEVICES:
|
|
||||||
return self->devices_listbox;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CC_CATEGORY_PRIVACY:
|
case CC_CATEGORY_PRIVACY:
|
||||||
return self->privacy_listbox;
|
return self->privacy_listbox;
|
||||||
break;
|
break;
|
||||||
|
@ -149,7 +140,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)
|
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 (listbox, row_index - 1);
|
||||||
|
|
||||||
if (next_row)
|
if (next_row)
|
||||||
|
@ -163,9 +154,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->devices_listbox)
|
|
||||||
return CC_PANEL_LIST_DEVICES;
|
|
||||||
|
|
||||||
if (listbox == self->privacy_listbox)
|
if (listbox == self->privacy_listbox)
|
||||||
return CC_PANEL_LIST_PRIVACY;
|
return CC_PANEL_LIST_PRIVACY;
|
||||||
|
|
||||||
|
@ -250,9 +238,7 @@ get_panel_id_from_row (CcPanelList *self,
|
||||||
|
|
||||||
RowData *row_data;
|
RowData *row_data;
|
||||||
|
|
||||||
if (row == self->devices_row)
|
if (row == self->privacy_row)
|
||||||
return "devices";
|
|
||||||
else if (row == self->privacy_row)
|
|
||||||
return "privacy";
|
return "privacy";
|
||||||
|
|
||||||
row_data = g_object_get_data (G_OBJECT (row), "data");
|
row_data = g_object_get_data (G_OBJECT (row), "data");
|
||||||
|
@ -412,7 +398,6 @@ static const gchar * const panel_order[] = {
|
||||||
"sound",
|
"sound",
|
||||||
"power",
|
"power",
|
||||||
"network",
|
"network",
|
||||||
"devices",
|
|
||||||
|
|
||||||
/* Privacy page */
|
/* Privacy page */
|
||||||
"location",
|
"location",
|
||||||
|
@ -523,12 +508,22 @@ header_func (GtkListBoxRow *row,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CcPanelList *self = CC_PANEL_LIST (user_data);
|
CcPanelList *self = CC_PANEL_LIST (user_data);
|
||||||
|
RowData *row_data, *before_data;
|
||||||
|
|
||||||
if (!before)
|
if (!before)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The Details row always have the separator */
|
if (row == self->privacy_row || before == self->privacy_row)
|
||||||
if (row == self->devices_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;
|
GtkWidget *separator;
|
||||||
|
|
||||||
|
@ -540,36 +535,7 @@ header_func (GtkListBoxRow *row,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RowData *row_data, *before_data;
|
gtk_list_box_row_set_header (row, NULL);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,13 +555,6 @@ row_activated_cb (GtkWidget *listbox,
|
||||||
goto out;
|
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
|
* When a panel is selected, the previous one should be
|
||||||
* unselected, except when it's search.
|
* unselected, except when it's search.
|
||||||
|
@ -605,9 +564,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->devices_listbox)
|
|
||||||
gtk_list_box_unselect_all (GTK_LIST_BOX (self->devices_listbox));
|
|
||||||
|
|
||||||
if (listbox != self->privacy_listbox)
|
if (listbox != self->privacy_listbox)
|
||||||
gtk_list_box_unselect_all (GTK_LIST_BOX (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");
|
data = g_object_get_data (G_OBJECT (row), "data");
|
||||||
|
|
||||||
if (data->category == CC_CATEGORY_DEVICES)
|
if (data->category == CC_CATEGORY_PRIVACY)
|
||||||
real_listbox = self->devices_listbox;
|
|
||||||
else if (data->category == CC_CATEGORY_PRIVACY)
|
|
||||||
real_listbox = self->privacy_listbox;
|
real_listbox = self->privacy_listbox;
|
||||||
else
|
else
|
||||||
real_listbox = self->main_listbox;
|
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_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_listbox);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CcPanelList, privacy_row);
|
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, main_listbox);
|
||||||
|
@ -857,11 +809,6 @@ cc_panel_list_init (CcPanelList *self)
|
||||||
self,
|
self,
|
||||||
NULL);
|
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),
|
gtk_list_box_set_header_func (GTK_LIST_BOX (self->main_listbox),
|
||||||
header_func,
|
header_func,
|
||||||
self,
|
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);
|
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 */
|
/* Only show the Devices/Details rows when there's at least one panel */
|
||||||
if (category == CC_CATEGORY_DEVICES)
|
if (category == CC_CATEGORY_PRIVACY)
|
||||||
gtk_widget_show (GTK_WIDGET (self->devices_row));
|
|
||||||
else if (category == CC_CATEGORY_PRIVACY)
|
|
||||||
gtk_widget_show (GTK_WIDGET (self->privacy_row));
|
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));
|
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->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 */
|
/* 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)
|
||||||
|
|
|
@ -30,7 +30,6 @@ G_BEGIN_DECLS
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CC_PANEL_LIST_MAIN,
|
CC_PANEL_LIST_MAIN,
|
||||||
CC_PANEL_LIST_DEVICES,
|
|
||||||
CC_PANEL_LIST_PRIVACY,
|
CC_PANEL_LIST_PRIVACY,
|
||||||
CC_PANEL_LIST_WIDGET,
|
CC_PANEL_LIST_WIDGET,
|
||||||
CC_PANEL_LIST_SEARCH
|
CC_PANEL_LIST_SEARCH
|
||||||
|
|
|
@ -70,64 +70,6 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">main</property>
|
<property name="name">main</property>
|
||||||
|
@ -144,17 +86,6 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
<child>
|
||||||
<object class="GtkListBox" id="search_listbox">
|
<object class="GtkListBox" id="search_listbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -277,10 +277,6 @@ update_list_title (CcWindow *self)
|
||||||
title = g_strdup (_("Privacy"));
|
title = g_strdup (_("Privacy"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CC_PANEL_LIST_DEVICES:
|
|
||||||
title = g_strdup (_("Devices"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CC_PANEL_LIST_MAIN:
|
case CC_PANEL_LIST_MAIN:
|
||||||
title = g_strdup (_("Settings"));
|
title = g_strdup (_("Settings"));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue