Commit 2d6de618 authored by Marinus Schraal's avatar Marinus Schraal

searchbar: Move FilterView row-activated to ui

This also moves the actual handling to Searchbar.
parent b75d5a52
......@@ -18,6 +18,7 @@
<property name="activate-on-single-click">True</property>
<property name="enable-search">False</property>
<property name="headers-visible">False</property>
<signal name="row-activated" handler="_on_row_activated"/>
</object>
</child>
<child>
......@@ -25,6 +26,7 @@
<property name="activate-on-single-click">True</property>
<property name="enable-search">False</property>
<property name="headers-visible">False</property>
<signal name="row-activated" handler="_on_row_activated"/>
</object>
</child>
</object>
......
......@@ -180,7 +180,6 @@ class FilterView(Gtk.TreeView):
self.set_model(self._model)
self.get_selection().set_mode(Gtk.SelectionMode.NONE)
self.connect("row-activated", self._row_activated)
col = Gtk.TreeViewColumn()
self.append_column(col)
......@@ -215,13 +214,6 @@ class FilterView(Gtk.TreeView):
if value is not None:
self.props.manager.fill_in_values(self._model)
@log
def _row_activated(self, view, path, col):
id_ = self._model[self._model.get_iter(path)][BaseModelColumns.ID]
self.emit('selection-changed', self.props.manager, id_)
self.props.manager.entry.emit('changed')
@log
def _render_radio(self, col, cell, model, iter_):
id_ = model[iter_][BaseModelColumns.ID]
......@@ -299,6 +291,21 @@ class DropDown(Gtk.Revealer):
self.search_manager.active = (
'search_all' if id_ != 'grl-tracker-source' else '')
@Gtk.Template.Callback()
@log
def _on_row_activated(self, filterview, path, col):
model = filterview.get_model()
id_ = model[model.get_iter(path)][BaseModelColumns.ID]
manager = filterview.props.manager
manager.active = id_
if manager == self._source_manager:
self._search_filter.set_sensitive(id_ == 'grl-tracker-source')
self.search_manager.active = (
'search_all' if id_ != 'grl-tracker-source' else '')
manager.entry.emit('changed')
@Gtk.Template(resource_path="/org/gnome/Music/Searchbar.ui")
class Searchbar(Gtk.SearchBar):
......
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