Commit 2463439f authored by Jean Felder's avatar Jean Felder

disclistbox: Change selection_mode_allowed to a property

This should cleanup the code base a little bit.
parent e8d36b35
......@@ -242,6 +242,7 @@
<property name="margin_bottom">64</property>
<property name="margin_end">32</property>
<property name="orientation">vertical</property>
<property name="selection_mode_allowed">True</property>
<property name="visible">True</property>
<signal name="selection-changed" handler="_on_selection_changed" swapped="no"/>
</object>
......
......@@ -80,8 +80,6 @@ class AlbumWidget(Gtk.EventBox):
self._album = None
self._header_bar = None
self._disc_listbox.set_selection_mode_allowed(True)
# FIXME: Assigned to appease searchview
# _get_selected_songs
self.view = self._disc_listbox
......
......@@ -75,8 +75,8 @@ class ArtistAlbumWidget(Gtk.Box):
self.cover_stack.update(self._media)
self._disc_listbox = ui.get_object('disclistbox')
self._disc_listbox.set_selection_mode_allowed(
self._selection_mode_allowed)
allowed = self._selection_mode_allowed
self._disc_listbox.props.selection_mode_allowed = allowed
ui.get_object('title').set_label(self._album_title)
year = utils.get_media_year(self._media)
......
......@@ -291,6 +291,8 @@ class DiscListBox(Gtk.Box):
'selection-changed': (GObject.SignalFlags.RUN_FIRST, None, ()),
}
selection_mode_allowed = GObject.Property(type=bool, default=False)
def __repr__(self):
return '<DiscListBox>'
......@@ -300,7 +302,6 @@ class DiscListBox(Gtk.Box):
super().__init__(orientation=Gtk.Orientation.VERTICAL)
self._selection_mode = False
self._selection_mode_allowed = False
self._selected_items = []
@log
......@@ -366,15 +367,7 @@ class DiscListBox(Gtk.Box):
:param bool value: Activate selection mode
"""
if not self._selection_mode_allowed:
if not self.props.selection_mode_allowed:
return
self._selection_mode = value
@log
def set_selection_mode_allowed(self, allowed):
"""Set if selection mode is allowed
:param bool allowed: Allow selection mode
"""
self._selection_mode_allowed = allowed
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment