shell: Hardcode panel list order
Per the latest mockups [1], the panel list must be sorted by the category, and then follow a manual predefined order. This commit adds the hardcoded order to the the panel list. [1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/shell/settings-organization.png
This commit is contained in:
parent
aae4dd842b
commit
5c4f2ff8a6
2 changed files with 64 additions and 2 deletions
|
@ -8,7 +8,7 @@ Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;X-GNOME-ConnectivitySettings;
|
Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;
|
||||||
OnlyShowIn=GNOME;Unity;
|
OnlyShowIn=GNOME;Unity;
|
||||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||||
X-GNOME-Bugzilla-Product=gnome-control-center
|
X-GNOME-Bugzilla-Product=gnome-control-center
|
||||||
|
|
|
@ -261,6 +261,54 @@ filter_func (GtkListBoxRow *row,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const gchar * const panel_order[] = {
|
||||||
|
/* Main page */
|
||||||
|
"wifi",
|
||||||
|
"mobile-broadband",
|
||||||
|
"bluetooth",
|
||||||
|
"background",
|
||||||
|
"notifications",
|
||||||
|
"search",
|
||||||
|
"region",
|
||||||
|
"universal-access",
|
||||||
|
"online-accounts",
|
||||||
|
"privacy",
|
||||||
|
"sharing",
|
||||||
|
"sound",
|
||||||
|
"power",
|
||||||
|
"network",
|
||||||
|
|
||||||
|
/* Devices page */
|
||||||
|
"printers",
|
||||||
|
"keyboard",
|
||||||
|
"mouse",
|
||||||
|
"display",
|
||||||
|
"removable-media",
|
||||||
|
"wacom",
|
||||||
|
"color",
|
||||||
|
|
||||||
|
/* Details page */
|
||||||
|
"info-overview",
|
||||||
|
"datetime",
|
||||||
|
"user-accounts",
|
||||||
|
"default-apps",
|
||||||
|
"reset-settings"
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint
|
||||||
|
get_panel_id_index (const gchar *panel_id)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (panel_order); i++)
|
||||||
|
{
|
||||||
|
if (g_str_equal (panel_order[i], panel_id))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
sort_function (GtkListBoxRow *a,
|
sort_function (GtkListBoxRow *a,
|
||||||
GtkListBoxRow *b,
|
GtkListBoxRow *b,
|
||||||
|
@ -291,7 +339,7 @@ sort_function (GtkListBoxRow *a,
|
||||||
if (a_data->category != b_data->category)
|
if (a_data->category != b_data->category)
|
||||||
return a_data->category - b_data->category;
|
return a_data->category - b_data->category;
|
||||||
|
|
||||||
return g_strcmp0 (a_data->name, b_data->name);
|
return get_panel_id_index (a_data->id) - get_panel_id_index (b_data->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
@ -398,6 +446,10 @@ header_func (GtkListBoxRow *row,
|
||||||
|
|
||||||
gtk_list_box_row_set_header (row, separator);
|
gtk_list_box_row_set_header (row, separator);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_list_box_row_set_header (row, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,6 +715,16 @@ 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),
|
||||||
|
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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue