[pitivi] medialibrary: Add 'Open containing folder' feature



commit 3222cf3cb368623d0fc8ac301ab0c8984f314650
Author: Umang Jain <mailumangjain gmail com>
Date:   Sun Feb 26 20:15:31 2017 +0100

    medialibrary: Add 'Open containing folder' feature
    
    Fixes https://phabricator.freedesktop.org/T3006
    
    Reviewed-by: Alex Băluț <alexandru balut gmail com>
    Differential Revision: https://phabricator.freedesktop.org/D1681

 pitivi/medialibrary.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 145f9ff..08d357e 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -1144,6 +1144,13 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         self._project.disable_proxies_for_assets(self.getSelectedAssets(),
                                                  delete_proxy_file=True)
 
+    def __open_containing_folder_cb(self, unused_action, unused_parameter):
+        assets = self.getSelectedAssets()
+        if len(assets) != 1:
+            return
+        parent_path = os.path.dirname(path_from_uri(assets[0].get_id()))
+        Gio.AppInfo.launch_default_for_uri(Gst.filename_to_uri(parent_path), None)
+
     def __createMenuModel(self):
         if self.app.proxy_manager.proxyingUnsupported:
             return None, None
@@ -1155,6 +1162,13 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         action_group = Gio.SimpleActionGroup()
         menu_model = Gio.Menu()
 
+        if len(assets) == 1:
+            action = Gio.SimpleAction.new("open-folder", None)
+            action.connect("activate", self.__open_containing_folder_cb)
+            action_group.insert(action)
+            text = _("Open containing folder")
+            menu_model.append(text, "assets.%s" % action.get_name().replace(" ", "."))
+
         proxies = [asset.get_proxy_target() for asset in assets
                    if asset.get_proxy_target()]
         in_progress = [asset.creation_progress for asset in assets


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