[gedit] external tools: provide environment variable with file browser root



commit 23c4610bf6f8be4a230d2da6c54e081d9c99738e
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 32fd3c6..92cedd0 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]