[PATCH 17/17] grilo-test-ui.py: Added query support



---
 tools/python/grilo-test-ui.py |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/python/grilo-test-ui.py b/tools/python/grilo-test-ui.py
index b795967..80675f2 100644
--- a/tools/python/grilo-test-ui.py
+++ b/tools/python/grilo-test-ui.py
@@ -66,8 +66,8 @@ class MainWindow(Gtk.Window):
         vbox = Gtk.VBox()
         self._search_text = Gtk.Entry()
         vbox.add(self._search_text)
-        query_text = Gtk.Entry()
-        vbox.add(query_text)
+        self._query_text = Gtk.Entry()
+        vbox.add(self._query_text)
         hbox.add(vbox)
 
         vbox = Gtk.VBox()
@@ -293,7 +293,12 @@ class MainWindow(Gtk.Window):
             source.remove(media, self._remove_cb, None)
 
     def _query_btn_clicked_cb(self, *args):
-        pass
+        success, iter = self._query_combo.get_active_iter()
+        if success:
+            model = self._query_combo.get_model()
+            source = model.get_value(iter, ComboBoxStore.SOURCE_COLUMN)
+            text = self._query_text.get_text()
+            self.query(source, text)
 
     def _search_btn_clicked_cb(self, *args):
         (success, iter) = self._search_combo.get_active_iter()
@@ -512,6 +517,18 @@ class MainWindow(Gtk.Window):
         self._clear_panes()
         self._operation_started(source, search_id, source is None)
 
+    def query(self, source, text):
+        self._cancel_current_operation()
+        state = OperationState(text)
+        query_id = source.query(text,
+                                self.BROWSE_KEYS,
+                                0, self.BROWSE_CHUNK_SIZE,
+                                self.BROWSE_FLAGS,
+                                self._search_cb,
+                                state)
+        self._clear_panes()
+        self._operation_started(source, query_id, False)
+
     def run(self):
         Gtk.main()
 
-- 
1.7.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]