gtk: Put the Window child into an Adw.OverlaySplitView
The OverlaySplitView contains a sidebar area that can be toggled by the user that I will be using to create an xfstests history browser. Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This commit is contained in:
parent
f951d4c998
commit
5621847451
|
@ -38,21 +38,25 @@ class TestWindow(unittest.TestCase):
|
|||
self.assertEqual(self.window.headerbar.props.title_widget,
|
||||
self.window.title)
|
||||
|
||||
def test_child(self):
|
||||
"""Test the window child property."""
|
||||
self.assertIsInstance(self.window.headerbar.get_next_sibling(),
|
||||
Adw.Bin)
|
||||
def test_splitview(self):
|
||||
"""Check that the Window's splitview is set up correctly."""
|
||||
self.assertIsInstance(self.window._splitview, Adw.OverlaySplitView)
|
||||
self.assertEqual(self.window.headerbar.get_next_sibling(),
|
||||
self.window._splitview)
|
||||
self.assertFalse(self.window._splitview.props.show_sidebar)
|
||||
self.assertTrue(self.window._splitview.props.collapsed)
|
||||
|
||||
def test_content(self):
|
||||
"""Test the window content property."""
|
||||
self.assertIsNone(self.window.child)
|
||||
self.window.child = Gtk.Label()
|
||||
self.assertEqual(self.window.headerbar.get_next_sibling().props.child,
|
||||
self.assertEqual(self.window._splitview.props.content,
|
||||
self.window.child)
|
||||
|
||||
label = Gtk.Label()
|
||||
window2 = xfstestsdb.gtk.window.Window(child=label)
|
||||
self.assertEqual(window2.child, label)
|
||||
self.assertEqual(window2.headerbar.get_next_sibling().props.child,
|
||||
label)
|
||||
self.assertEqual(window2._splitview.props.content, label)
|
||||
|
||||
def test_runid(self):
|
||||
"""Test the window runid property."""
|
||||
|
|
|
@ -20,13 +20,17 @@ class Window(Adw.Window):
|
|||
content=Gtk.Box(orientation=Gtk.Orientation.VERTICAL),
|
||||
title=Adw.WindowTitle(title="xfstestsdb gtk"),
|
||||
headerbar=Adw.HeaderBar(), **kwargs)
|
||||
self._splitview = Adw.OverlaySplitView(content=self.child,
|
||||
collapsed=True,
|
||||
show_sidebar=False)
|
||||
|
||||
self.headerbar.props.title_widget = self.title
|
||||
self.headerbar.add_css_class("flat")
|
||||
|
||||
self.props.content.append(self.headerbar)
|
||||
self.props.content.append(Adw.Bin(child=self.child))
|
||||
self.props.content.append(self._splitview)
|
||||
|
||||
self.bind_property("child", self.headerbar.get_next_sibling(), "child")
|
||||
self.bind_property("child", self._splitview, "content")
|
||||
self.connect("notify::runid", self.__notify_runid)
|
||||
|
||||
if __debug__:
|
||||
|
|
Loading…
Reference in New Issue