[gnome-games/wip/exalm/platform-preferences: 74/95] preferences-sidebar: Add separators between rows with different categories
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/platform-preferences: 74/95] preferences-sidebar: Add separators between rows with different categories
- Date: Sun, 21 Oct 2018 15:07:36 +0000 (UTC)
commit 4c282da16039ad5126fd1da1e3c8a87176ed62c0
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sun Oct 21 19:37:31 2018 +0500
preferences-sidebar: Add separators between rows with different categories
src/ui/preferences-sidebar.vala | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/ui/preferences-sidebar.vala b/src/ui/preferences-sidebar.vala
index 577c6a92..e07666ae 100644
--- a/src/ui/preferences-sidebar.vala
+++ b/src/ui/preferences-sidebar.vala
@@ -108,8 +108,21 @@ private class Games.PreferencesSidebar: Gtk.Bin {
}
private void update_header (Gtk.ListBoxRow row, Gtk.ListBoxRow? before) {
- if (before != null && row.get_header () == null) {
+ 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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]