[gnome-music/wip/merge: 262/343] grilo: Create a default options object and use a copy on populate
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/merge: 262/343] grilo: Create a default options object and use a copy on populate
- Date: Thu, 25 Jul 2013 11:34:39 +0000 (UTC)
commit 60ef061ac99af5d8a4e0bdce270b0eeb9d48eda7
Author: Arnel A. Borja <arnelborja src gnome org>
Date: Thu Jul 18 21:34:41 2013 +0800
grilo: Create a default options object and use a copy on populate
This will decrease the memory usage when loading views.
gnomemusic/grilo.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 87f27b6..077ef49 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -17,6 +17,11 @@ class Grilo(GObject.GObject):
def __init__(self):
GObject.GObject.__init__(self)
+
+ self.options = Grl.OperationOptions()
+ self.options.set_flags(Grl.ResolutionFlags.FULL |
+ Grl.ResolutionFlags.IDLE_RELAY)
+
self.registry = Grl.Registry.get_default()
try:
self.registry.load_all_plugins()
@@ -56,9 +61,7 @@ class Grilo(GObject.GObject):
self.populate_items(Query.SONGS, offset, callback)
def populate_items(self, query, offset, callback, count=50):
- options = Grl.OperationOptions()
- options.set_flags(Grl.ResolutionFlags.FULL |
- Grl.ResolutionFlags.IDLE_RELAY)
+ options = self.options.copy()
options.set_skip(offset)
options.set_count(count)
@@ -68,21 +71,18 @@ class Grilo(GObject.GObject):
def get_album_songs(self, album_id, callback):
query = Query.album_songs(album_id)
- options = Grl.OperationOptions()
- options.set_flags(Grl.ResolutionFlags.FULL |
- Grl.ResolutionFlags.IDLE_RELAY)
+ options = self.options.copy()
self.tracker.query(query, self.METADATA_KEYS, options, callback, None)
def _search_callback(self):
print("yeah")
def search(self, q):
+ options = self.options.copy()
for source in self.sources:
print(source.get_name() + " - " + q)
source.search(q, [Grl.METADATA_KEY_ID], 0, 10,
- Grl.MetadataResolutionFlags.FULL |
- Grl.MetadataResolutionFlags.IDLE_RELAY,
- self._search_callback, source)
+ options, self._search_callback, source)
Grl.init(None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]