[pitivi] greeter: Open project file dragged from Nautilus
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] greeter: Open project file dragged from Nautilus
- Date: Tue, 7 Aug 2018 01:30:59 +0000 (UTC)
commit 817d885a4daa8d8887ffcfc2f004b6ce1348c77d
Author: HarishFulara07 <harish14143 iiitd ac in>
Date: Sat Aug 4 18:23:49 2018 +0530
greeter: Open project file dragged from Nautilus
pitivi/greeterperspective.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/pitivi/greeterperspective.py b/pitivi/greeterperspective.py
index eacc9c7e..53be72b4 100644
--- a/pitivi/greeterperspective.py
+++ b/pitivi/greeterperspective.py
@@ -35,6 +35,7 @@ from pitivi.utils.ui import beautify_last_updated_timestamp
from pitivi.utils.ui import beautify_project_path
from pitivi.utils.ui import fix_infobar
from pitivi.utils.ui import GREETER_PERSPECTIVE_CSS
+from pitivi.utils.ui import URI_TARGET_ENTRY
MAX_RECENT_PROJECTS = 10
@@ -120,6 +121,9 @@ class GreeterPerspective(Perspective):
builder.add_from_file(os.path.join(get_ui_dir(), "greeter.ui"))
self.toplevel_widget = builder.get_object("toplevel_vbox")
+ self.toplevel_widget.drag_dest_set(
+ Gtk.DestDefaults.ALL, [URI_TARGET_ENTRY], Gdk.DragAction.COPY)
+ self.toplevel_widget.connect("drag-data-received", self.__drag_data_received_cb)
self.__topvbox = builder.get_object("topvbox")
self.__welcome_vbox = builder.get_object("welcome_vbox")
@@ -298,6 +302,18 @@ class GreeterPerspective(Perspective):
assert not visible_options
return menu_button
+ def __drag_data_received_cb(self, unused_widget, unused_context, unused_x,
+ unused_y, data, unused_info, unused_time):
+ """Opens the project file dragged from Nautilus."""
+ uris = data.get_uris()
+ if not uris:
+ return
+
+ uri = uris[0]
+ extension = os.path.splitext(uri)[1][1:]
+ if extension in self.__project_filter:
+ self.app.project_manager.loadProject(uri)
+
def __new_project_cb(self, unused_action, unused_param):
self.app.project_manager.newBlankProject()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]