[gedit/gnome-3-8] external tools: provide environment variable with file browser root



commit 7189e5a833e1cb4f34453cdff110859352b02394
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Apr 26 13:07:28 2013 +0200

    external tools: provide environment variable with file browser root

 plugins/externaltools/tools/functions.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/plugins/externaltools/tools/functions.py b/plugins/externaltools/tools/functions.py
index ddc6ead..2e75d75 100644
--- a/plugins/externaltools/tools/functions.py
+++ b/plugins/externaltools/tools/functions.py
@@ -107,6 +107,18 @@ def run_external_tool(window, panel, node):
         capture.set_env(GEDIT_DOCUMENTS_URI  = ' '.join(documents_uri),
                         GEDIT_DOCUMENTS_PATH = ' '.join(documents_path))
 
+    # set file browser root env var if possible
+    bus = window.get_message_bus()
+
+    if bus.is_registered('/plugins/filebrowser', 'get_root'):
+        msg = bus.send_sync('/plugins/filebrowser', 'get_root')
+
+        if msg:
+            file_browser_root = msg.props.location
+
+            if file_browser_root and file_browser_root.is_native():
+                capture.set_env(GEDIT_FILE_BROWSER_ROOT = file_browser_root.get_path())
+
     flags = capture.CAPTURE_BOTH
     
     if not node.has_hash_bang():


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