diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2017-08-12 11:03:17 -0300 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2017-08-12 11:03:17 -0300 |
commit | 5c4f2ff8a6b8e8befbf98751c248cb496f9fb622 (patch) | |
tree | 4eee17457197aac9d94208702ac8c88f59465234 | |
parent | aae4dd842b7293eb04d91269b0152b154225f472 (diff) | |
download | gnome-control-center-5c4f2ff8a6b8e8befbf98751c248cb496f9fb622.tar.gz |
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
-rw-r--r-- | panels/network/gnome-network-panel.desktop.in.in | 2 | ||||
-rw-r--r-- | shell/cc-panel-list.c | 64 |
2 files changed, 64 insertions, 2 deletions
diff --git a/panels/network/gnome-network-panel.desktop.in.in b/panels/network/gnome-network-panel.desktop.in.in index e3a0265ec..d0817ab29 100644 --- a/panels/network/gnome-network-panel.desktop.in.in +++ b/panels/network/gnome-network-panel.desktop.in.in @@ -8,7 +8,7 @@ Terminal=false Type=Application NoDisplay=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; X-GNOME-Bugzilla-Bugzilla=GNOME X-GNOME-Bugzilla-Product=gnome-control-center diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c index b984aaea0..c9d551bba 100644 --- a/shell/cc-panel-list.c +++ b/shell/cc-panel-list.c @@ -261,6 +261,54 @@ filter_func (GtkListBoxRow *row, 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 sort_function (GtkListBoxRow *a, GtkListBoxRow *b, @@ -291,7 +339,7 @@ sort_function (GtkListBoxRow *a, if (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 @@ -398,6 +446,10 @@ header_func (GtkListBoxRow *row, 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, 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), header_func, self, |