diff --git a/tests/gtk/test_window.py b/tests/gtk/test_window.py index f5fd522..82a6d6a 100644 --- a/tests/gtk/test_window.py +++ b/tests/gtk/test_window.py @@ -82,6 +82,18 @@ class TestWindow(unittest.TestCase): self.assertEqual(window2.child, label) self.assertEqual(window2._splitview.props.content, label) + def test_sidebar(self): + """Test the window sidebar property.""" + self.assertIsNone(self.window.sidebar) + self.window.sidebar = Gtk.Label() + self.assertEqual(self.window._splitview.props.sidebar, + self.window.sidebar) + + label = Gtk.Label() + window2 = xfstestsdb.gtk.window.Window(sidebar=label) + self.assertEqual(window2.sidebar, label) + self.assertEqual(window2._splitview.props.sidebar, label) + def test_runid(self): """Test the window runid property.""" self.assertEqual(self.window.runid, 0) diff --git a/xfstestsdb/gtk/window.py b/xfstestsdb/gtk/window.py index 9830f2e..d4c6609 100644 --- a/xfstestsdb/gtk/window.py +++ b/xfstestsdb/gtk/window.py @@ -10,6 +10,7 @@ class Window(Adw.Window): """Our customized Window displayed to the user.""" child = GObject.Property(type=Gtk.Widget) + sidebar = GObject.Property(type=Gtk.Widget) headerbar = GObject.Property(type=Adw.HeaderBar) title = GObject.Property(type=Adw.WindowTitle) runid = GObject.Property(type=int) @@ -22,6 +23,7 @@ class Window(Adw.Window): title=Adw.WindowTitle(title="xfstestsdb gtk"), headerbar=Adw.HeaderBar(), **kwargs) self._splitview = Adw.OverlaySplitView(content=self.child, + sidebar=self.sidebar, collapsed=True, show_sidebar=self.show_sidebar) self._show_sidebar = Gtk.ToggleButton(icon_name="sidebar-show", @@ -37,6 +39,7 @@ class Window(Adw.Window): self._show_sidebar.bind_property("active", self, "show-sidebar", GObject.BindingFlags.BIDIRECTIONAL) self.bind_property("show-sidebar", self._splitview, "show-sidebar") + self.bind_property("sidebar", self._splitview, "sidebar") self.bind_property("child", self._splitview, "content") self.connect("notify::runid", self.__notify_runid)