[kupfer] browser, data: Change launch-callback signal
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] browser, data: Change launch-callback signal
- Date: Sat, 2 Jan 2010 19:38:21 +0000 (UTC)
commit 60ddb9ac57de73826007292b6454811de7eb33bf
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sat Jan 2 14:48:42 2010 +0100
browser, data: Change launch-callback signal
Send a boolean with the launch-callback signal if the action had a
result or not.
If an action has a result, make sure the current window is visible in
the WindowController.
kupfer/browser.py | 7 +++++--
kupfer/data.py | 9 ++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/browser.py b/kupfer/browser.py
index ec78c98..3b13e0a 100644
--- a/kupfer/browser.py
+++ b/kupfer/browser.py
@@ -1378,11 +1378,14 @@ class WindowController (pretty.OutputMixin):
"""
menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, status_icon)
- def launch_callback(self, sender):
+ def launch_callback(self, sender, has_result):
# Separate window hide from the action being
# done. This is to solve a window focus bug when
# we switch windows using an action
- gobject.idle_add(self.put_away)
+ if has_result:
+ self.activate()
+ else:
+ gobject.idle_add(self.put_away)
def activate(self, sender=None, time=0):
evttime = time if time else gtk.get_current_event_time()
diff --git a/kupfer/data.py b/kupfer/data.py
index c4b2fd5..54bc8d4 100644
--- a/kupfer/data.py
+++ b/kupfer/data.py
@@ -1063,7 +1063,9 @@ class DataController (gobject.GObject, pretty.OutputMixin):
self.source_pane.push_source(ret)
if result_type == commandexec.RESULT_OBJECT:
self.emit("pane-reset", SourcePane, search.wrap_rankable(ret))
- self.emit("launched-action")
+ has_result = result_type in (commandexec.RESULT_SOURCE,
+ commandexec.RESULT_OBJECT)
+ self.emit("launched-action", has_result)
def find_object(self, url):
"""Find object with URI @url and select it in the first pane"""
@@ -1103,8 +1105,9 @@ gobject.signal_new("source-changed", DataController, gobject.SIGNAL_RUN_LAST,
gobject.signal_new("mode-changed", DataController, gobject.SIGNAL_RUN_LAST,
gobject.TYPE_BOOLEAN, (gobject.TYPE_INT, gobject.TYPE_PYOBJECT,))
-# mode, item, action
+# when an action was launched
+# arguments: has_result (boolean)
gobject.signal_new("launched-action", DataController, gobject.SIGNAL_RUN_LAST,
- gobject.TYPE_BOOLEAN, ())
+ gobject.TYPE_BOOLEAN, (gobject.TYPE_BOOLEAN, ))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]