Commit 5071f941 authored by Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto Committed by Marinus Schraal

view: Factor out function to setup the view

Groundwork for GtkFlowBox Albums view introduction.

Since the Albums view will handle the internal view differently, it
makes sense to add a new method that will be overriden in the future.

This patch moves the code related to setting up the view into a separate
function.

https://bugzilla.gnome.org/show_bug.cgi?id=760164
parent 1ade4d1f
......@@ -89,10 +89,10 @@ class ViewContainer(Gtk.Stack):
GObject.TYPE_BOOLEAN,
GObject.TYPE_INT
)
self.view = Gd.MainView(
shadow_type=Gtk.ShadowType.NONE
)
self.view.set_view_type(view_type)
# Setup the main view
self._setup_view(view_type)
self._box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self._box.pack_start(self.view, True, True, 0)
if use_sidebar:
......@@ -111,9 +111,6 @@ class ViewContainer(Gtk.Stack):
self._grid.add(self._box)
self.star_handler = Widgets.StarHandler(self, 9)
self.view.click_handler = self.view.connect('item-activated', self._on_item_activated)
# self.star_handler.star_renderer_click = False
self.view.connect('selection-mode-request', self._on_selection_mode_request)
self._cursor = None
self.window = window
self.header_bar = window.toolbar
......@@ -148,6 +145,14 @@ class ViewContainer(Gtk.Stack):
def _on_changes_pending(self, data=None):
pass
@log
def _setup_view(self, view_type):
self.view = Gd.MainView(shadow_type=Gtk.ShadowType.NONE)
self.view.set_view_type(view_type)
self.view.click_handler = self.view.connect('item-activated', self._on_item_activated)
self.view.connect('selection-mode-request', self._on_selection_mode_request)
@log
def _on_header_bar_toggled(self, button):
if button.get_active():
......
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