header: Convert the volume button box to a Gtk.ListBox
And give it the boxed-list style class so it looks nice. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
dae588bfaf
commit
a626a1f3c4
|
@ -46,9 +46,9 @@ class Header(Gtk.HeaderBar):
|
||||||
self._volume = volume.VolumeRow()
|
self._volume = volume.VolumeRow()
|
||||||
self._replaygain = replaygain.ReplayGainRow()
|
self._replaygain = replaygain.ReplayGainRow()
|
||||||
|
|
||||||
self._box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
|
self._box = Gtk.ListBox(selection_mode=Gtk.SelectionMode.NONE)
|
||||||
|
self._box.add_css_class("boxed-list")
|
||||||
self._box.append(self._volume)
|
self._box.append(self._volume)
|
||||||
self._box.append(Gtk.Separator())
|
|
||||||
self._box.append(self._replaygain)
|
self._box.append(self._replaygain)
|
||||||
|
|
||||||
icon = _volume_icon(self.volume)
|
icon = _volume_icon(self.volume)
|
||||||
|
|
|
@ -106,23 +106,22 @@ class TestHeader(tests.util.TestCase):
|
||||||
self.assertEqual(self.header._button.get_tooltip_text(),
|
self.assertEqual(self.header._button.get_tooltip_text(),
|
||||||
"volume: 100%\nnormalizing: off")
|
"volume: 100%\nnormalizing: off")
|
||||||
|
|
||||||
def test_popover(self):
|
def test_popover_button(self):
|
||||||
"""Check that the menu popover was set up correctly."""
|
"""Check that the menu popover button was set up correctly."""
|
||||||
self.assertIsInstance(self.header._button,
|
self.assertIsInstance(self.header._button,
|
||||||
emmental.buttons.PopoverButton)
|
emmental.buttons.PopoverButton)
|
||||||
self.assertIsInstance(self.header._box, Gtk.Box)
|
|
||||||
|
|
||||||
self.assertEqual(self.header._box.get_orientation(),
|
|
||||||
Gtk.Orientation.VERTICAL)
|
|
||||||
self.assertEqual(self.header._box.get_spacing(), 0)
|
|
||||||
|
|
||||||
self.assertEqual(self.header._button.get_icon_name(),
|
self.assertEqual(self.header._button.get_icon_name(),
|
||||||
"audio-volume-high-symbolic")
|
"audio-volume-high-symbolic")
|
||||||
self.assertEqual(self.header._button.popover_child, self.header._box)
|
self.assertEqual(self.header._button.popover_child, self.header._box)
|
||||||
self.assertEqual(self.header._box.get_first_child(),
|
|
||||||
self.header._volume)
|
|
||||||
|
|
||||||
sep = self.header._volume.get_next_sibling()
|
def test_popover_child(self):
|
||||||
self.assertIsInstance(sep, Gtk.Separator)
|
"""Check that the menu popover button child was set up correctly."""
|
||||||
self.assertEqual(sep.get_orientation(), Gtk.Orientation.HORIZONTAL)
|
self.assertIsInstance(self.header._box, Gtk.ListBox)
|
||||||
self.assertEqual(sep.get_next_sibling(), self.header._replaygain)
|
self.assertEqual(self.header._box.get_selection_mode(),
|
||||||
|
Gtk.SelectionMode.NONE)
|
||||||
|
self.assertTrue(self.header._box.has_css_class("boxed-list"))
|
||||||
|
|
||||||
|
self.assertEqual(self.header._box.get_row_at_index(0),
|
||||||
|
self.header._volume)
|
||||||
|
self.assertEqual(self.header._box.get_row_at_index(1),
|
||||||
|
self.header._replaygain)
|
||||||
|
|
Loading…
Reference in New Issue