Commit 82e0906b authored by Vineet Reddy's avatar Vineet Reddy

window: Create a Gtk.gesture if views does not exist

parent 929e6ba6
Pipeline #191968 passed with stages
in 10 minutes and 16 seconds
......@@ -229,6 +229,13 @@ class Window(Gtk.ApplicationWindow):
'key_press_event', self._on_key_press)
self._btn_ctrl = Gtk.GestureMultiPress().new(self)
# All views are created together, so if the album view is
# already initialized, assume the rest are as well.
if self.views[View.ALBUM] is not None:
return
# The Gtk.gesture is recreated only if views does not exist
self._btn_ctrl.props.propagation_phase = Gtk.PropagationPhase.CAPTURE
# Mouse button 8 is the back button.
self._btn_ctrl.props.button = 8
......@@ -237,12 +244,6 @@ class Window(Gtk.ApplicationWindow):
self.views[View.EMPTY].props.state = EmptyView.State.SEARCH
self._headerbar.props.state = HeaderBar.State.MAIN
# All views are created together, so if the album view is
# already initialized, assume the rest are as well.
if self.views[View.ALBUM] is not None:
return
self.views[View.ALBUM] = AlbumsView(self._app)
self.views[View.ARTIST] = ArtistsView(self._app)
self.views[View.SONG] = SongsView(self._app)
......
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