[kupfer] data, search: Send Action result items with pane-reset signal
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] data, search: Send Action result items with pane-reset signal
- Date: Wed, 9 Sep 2009 19:16:50 +0000 (UTC)
commit 731aa1fcc8315828cebd41e7f6d1919b7ec95a73
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Sep 9 19:06:48 2009 +0200
data, search: Send Action result items with pane-reset signal
kupfer/data.py | 9 ++++++---
kupfer/search.py | 3 +++
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/data.py b/kupfer/data.py
index 2a087d2..485e747 100644
--- a/kupfer/data.py
+++ b/kupfer/data.py
@@ -928,7 +928,7 @@ class DataController (gobject.GObject, pretty.OutputMixin):
if not sel:
break
if hasattr(sel, "is_valid") and not sel.is_valid():
- self.emit("pane-reset", paneenum, sel)
+ self.emit("pane-reset", paneenum, None)
self.select(paneenum, None)
def browse_up(self, pane):
@@ -979,11 +979,14 @@ class DataController (gobject.GObject, pretty.OutputMixin):
if action.is_factory() and ret:
self.source_pane.push_source(ret)
return
- if action.is_async():
+ if action.has_result() and ret:
+ self.emit("pane-reset", SourcePane, search.wrap_rankable(ret))
+ return
+ elif action.is_async():
self._task_runner.add_task(ret)
self.emit("launched-action", SourceActionMode, leaf, action)
-# pane cleared (invalid item) item was invalid
+# pane cleared or set with new item
# pane, item
gobject.signal_new("pane-reset", DataController, gobject.SIGNAL_RUN_LAST,
gobject.TYPE_BOOLEAN, (gobject.TYPE_INT, gobject.TYPE_PYOBJECT,))
diff --git a/kupfer/search.py b/kupfer/search.py
index 057685d..22d950c 100644
--- a/kupfer/search.py
+++ b/kupfer/search.py
@@ -8,6 +8,9 @@ from kupfer.relevance import score
def make_rankables(itr, rank=0):
return (Rankable(unicode(obj), obj, rank) for obj in itr)
+def wrap_rankable(obj, rank=0):
+ return Rankable(unicode(obj), obj, rank)
+
def locale_rankable_cmp(me, other):
p1 = -cmp(me.rank, other.rank)
return p1 or (me.rank and locale.strcoll(me.value, other.value))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]