[gnome-games/wip/exalm/platform-preferences: 8/30] preferences-sidebar: Add separators between rows with different categories



commit c44c60181fd2f137360033dc65968ac7cda6ff08
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]