[PATCH 16/17] grilo-test-ui.py: Media can be removed
- From: Simón Pena <spenap gmail com>
- To: grilo-list gnome org
- Subject: [PATCH 16/17] grilo-test-ui.py: Media can be removed
- Date: Sat, 14 Aug 2010 22:07:47 +0200
---
tools/python/grilo-test-ui.py | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/tools/python/grilo-test-ui.py b/tools/python/grilo-test-ui.py
index ba18423..b795967 100644
--- a/tools/python/grilo-test-ui.py
+++ b/tools/python/grilo-test-ui.py
@@ -284,7 +284,13 @@ class MainWindow(Gtk.Window):
dialog.destroy()
def _remove_btn_clicked_cb(self, *args):
- pass
+ selection = self._browser_window.get_browser().get_selection()
+ success, model, iter = selection.get_selected()
+ if success:
+ source = model.get_value(iter, BrowserListStore.SOURCE_COLUMN)
+ media = model.get_value(iter, BrowserListStore.CONTENT_COLUMN)
+
+ source.remove(media, self._remove_cb, None)
def _query_btn_clicked_cb(self, *args):
pass
@@ -400,6 +406,23 @@ class MainWindow(Gtk.Window):
def _store_cb(source, box, media, user_data, error):
print 'Media stored'
+ def _remove_cb(self, source, media, data, error):
+ print 'Media removed'
+ self._remove_item_from_view (source, media)
+
+ def _remove_item_from_view(self, source, media):
+ model = self._browser_window.get_browser().get_model()
+ success, iter = model.get_iter_first()
+ found = False
+ while success and not found:
+ iter_source = model.get_value(iter, BrowserListStore.SOURCE_COLUMN)
+ iter_media = model.get_value(iter, BrowserListStore.CONTENT_COLUMN)
+ if iter_source == source and iter_media == media:
+ model.remove(iter)
+ found = True
+ else:
+ success, iter = model.get_iter_next(iter)
+
def _browse_history_push (self, source, media):
self._ui_state.source_stack.append(source)
self._ui_state.container_stack.append(media)
--
1.7.0.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]