summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deluge/common.py11
-rw-r--r--deluge/ui/gtkui/files_tab.py3
-rw-r--r--deluge/ui/gtkui/menubar.py3
3 files changed, 13 insertions, 4 deletions
diff --git a/deluge/common.py b/deluge/common.py
index eec129a1b..92648bec3 100644
--- a/deluge/common.py
+++ b/deluge/common.py
@@ -231,12 +231,14 @@ def get_pixmap(fname):
return pkg_resources.resource_filename("deluge", os.path.join("data", \
"pixmaps", fname))
-def open_file(path):
+def open_file(path, timestamp=None):
"""
Opens a file or folder using the system configured program
:param path: the path to the file or folder to open
:type path: string
+ :param timestamp: the timestamp of the event that requested to open
+ :type timestamp: int
"""
if windows_check():
@@ -244,7 +246,12 @@ def open_file(path):
elif osx_check():
subprocess.Popen(["open", "%s" % path])
else:
- subprocess.Popen(["xdg-open", "%s" % path])
+ if timestamp is None:
+ timestamp = int(time.time())
+ env = os.environ.copy()
+ env["DESKTOP_STARTUP_ID"] = "%s-%u-%s-xdg_open_TIME%d" % \
+ (os.path.basename(sys.argv[0]), os.getpid(), os.uname()[1], timestamp)
+ subprocess.Popen(["xdg-open", "%s" % path], env=env)
def open_url_in_browser(url):
"""
diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
index 0856f360d..42a7745c9 100644
--- a/deluge/ui/gtkui/files_tab.py
+++ b/deluge/ui/gtkui/files_tab.py
@@ -361,7 +361,8 @@ class FilesTab(Tab):
path = self.get_file_path(select).split("/")
filepath = os.path.join(status["save_path"], *path)
log.debug("Open file '%s'", filepath)
- deluge.common.open_file(filepath)
+ timestamp = gtk.get_current_event_time()
+ deluge.common.open_file(filepath, timestamp=timestamp)
## The following 3 methods create the folder/file view in the treeview
def prepare_file_store(self, files):
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index f39031160..08729c884 100644
--- a/deluge/ui/gtkui/menubar.py
+++ b/deluge/ui/gtkui/menubar.py
@@ -307,7 +307,8 @@ class MenuBar(component.Component):
def on_menuitem_open_folder_activate(self, data=None):
log.debug("on_menuitem_open_folder")
def _on_torrent_status(status):
- deluge.common.open_file(status["save_path"])
+ timestamp = gtk.get_current_event_time()
+ deluge.common.open_file(status["save_path"], timestamp=timestamp)
for torrent_id in component.get("TorrentView").get_selected_torrents():
component.get("SessionProxy").get_torrent_status(torrent_id, ["save_path"]).addCallback(_on_torrent_status)