[gnome-music] searchbar: Allow searching in all sources
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] searchbar: Allow searching in all sources
- Date: Mon, 12 May 2014 08:48:53 +0000 (UTC)
commit 6d0e6252b3713002ec63d5a6b4efc09156da9b9f
Author: Arnel Borja <arnelborja src gnome org>
Date: Wed May 7 00:45:17 2014 +0800
searchbar: Allow searching in all sources
gnomemusic/grilo.py | 9 ++++++++-
gnomemusic/searchbar.py | 3 ++-
gnomemusic/view.py | 6 ++++--
3 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 7da8e0c..97bef9e 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -186,7 +186,14 @@ class Grilo(GObject.GObject):
@log
def _search_callback(source, param, item, remaining, data, error):
callback(source, param, item, remaining, data)
- self.search_source.search(q, self.METADATA_KEYS, options, _search_callback, data)
+ if self.search_source:
+ self.search_source.search(q, self.METADATA_KEYS, options,
+ _search_callback, data)
+ else:
+ Grl.multiple_search([self.sources[key] for key in self.sources
+ if key != 'grl-filesystem' and key != 'grl-tracker-source'],
+ q, self.METADATA_KEYS, options,
+ _search_callback, data)
@log
def get_media_from_uri(self, uri, callback):
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index 123eb90..0a89250 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -71,6 +71,7 @@ class SourceManager(BaseManager):
def fill_in_values(self, model):
if self.id == "source":
self.values.append(['', '', self.label])
+ self.values.append(['all', _("All"), ""])
self.values.append(['grl-tracker-source', _("Local"), ''])
for key in grilo.sources:
source = grilo.sources[key]
@@ -86,7 +87,7 @@ class SourceManager(BaseManager):
return
super(SourceManager, self).set_active(selected_id)
- src = grilo.sources[selected_id]
+ src = grilo.sources[selected_id] if selected_id != 'all' else None
grilo.search_source = src
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index afe01dc..b998544 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -1451,10 +1451,12 @@ class Search(ViewContainer):
self.songs_model = self._model.filter_new(self._model.get_path(songs_iter))
# Use queries for Tracker
- if grilo.search_source.get_id() == 'grl-tracker-source':
+ if not grilo.search_source or \
+ grilo.search_source.get_id() == 'grl-tracker-source':
for category in ('album', 'artist', 'song'):
query = query_matcher[category][fields_filter](search_term)
grilo.populate_custom_query(query, self._add_item, -1, [self._model, category])
- else:
+ if not grilo.search_source or \
+ grilo.search_source.get_id() != 'grl-tracker-source':
# nope, can't do - reverting to Search
grilo.search(search_term, self._add_item, [self._model, 'song'])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]