[gnome-games/wip/exalm/platform-preferences: 8/26] preferences-sidebar: Add header function
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/platform-preferences: 8/26] preferences-sidebar: Add header function
- Date: Thu, 27 Sep 2018 16:34:15 +0000 (UTC)
commit ebadd59396336ee34f6c8cf605b2eb7824fa9dd9
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Sep 25 19:49:02 2018 +0500
preferences-sidebar: Add header function
Add separators between rows with different categories.
src/ui/preferences-sidebar.vala | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/src/ui/preferences-sidebar.vala b/src/ui/preferences-sidebar.vala
index 6298a829..73982e33 100644
--- a/src/ui/preferences-sidebar.vala
+++ b/src/ui/preferences-sidebar.vala
@@ -56,6 +56,28 @@ private class Games.PreferencesSidebar: Gtk.Bin {
construct {
rows = new HashTable<PreferencesPage, PreferencesSidebarItem> (null, null);
show_selection = true;
+
+ list.set_header_func (update_header);
+ }
+
+ void update_header (Gtk.ListBoxRow row, Gtk.ListBoxRow? before) {
+ if (before == null)
+ return;
+
+ var item1 = row as PreferencesSidebarItem;
+ var item2 = before as PreferencesSidebarItem;
+
+ var page1 = item1.preferences_page;
+ var page2 = item2.preferences_page;
+
+ if (page1.category != page2.category) {
+ var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
+ separator.set_margin_top (4);
+ separator.set_margin_bottom (4);
+ separator.get_style_context ().add_class ("sidebar");
+
+ row.set_header (separator);
+ }
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]