Commit 72923965 authored by Vadim Rutkovsky's avatar Vadim Rutkovsky

view: connect to view-selection-changed only when selection mode is on

parent 72ad3bb5
......@@ -105,17 +105,25 @@ class Toolbar(GObject.GObject):
@log
def set_selection_mode(self, selectionMode):
self._selection_handler = None
self._selectionMode = selectionMode
if selectionMode:
self._select_button.hide()
self._cancel_button.show()
self.header_bar.get_style_context().add_class('selection-mode')
self._cancel_button.get_style_context().remove_class('selection-mode')
view = self._stack_switcher.get_stack().get_visible_child()
self._selection_handler = view.view.connect(
'view-selection-changed', view._on_view_selection_changed)
else:
self.header_bar.get_style_context().remove_class('selection-mode')
self._select_button.set_active(False)
self._select_button.show()
self._cancel_button.hide()
view = self._stack_switcher.get_stack().get_visible_child()
if self._selection_handler:
view.view.disconnect(self._selection_handler)
self._selection_handler = None
self.emit('selection-mode-changed')
self._update()
......
......@@ -135,10 +135,9 @@ class ViewContainer(Gtk.Stack):
self._init = False
grilo.connect('ready', self._on_grilo_ready)
self.selection_socket = None
self.header_bar.connect('selection-mode-changed',
self._on_selection_mode_changed)
self.view.connect('view-selection-changed',
self._on_view_selection_changed)
self._discovering_urls = {}
grilo.connect('changes-pending', self._on_changes_pending)
......
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