From 7d40ea421f25f816fe3c780c7ebefeabff9617a9 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Mon, 3 Oct 2022 13:46:18 +0200 Subject: [PATCH 1/2] feat: support Nautilus 4.0 API As explained in the comment, the Nautilus 4.0 API just passes files without the window object (which was unused anyway). This small fix keeps compatibility with the 3.0 API and checks the number of arguments. Would be really nice if you could make this count towards hacktoberfest as well! Signed-off-by: Gabriele Musco --- shell_integration/nautilus/syncstate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py index c4dacb5b0f5..5733cf69d88 100644 --- a/shell_integration/nautilus/syncstate.py +++ b/shell_integration/nautilus/syncstate.py @@ -26,7 +26,7 @@ import tempfile import time -from gi.repository import GObject, Nautilus +from repository import GObject, Nautilus # Note: setappname.sh will search and replace 'ownCloud' on this file to update this line and other # occurrences of the name @@ -200,8 +200,11 @@ def check_registered_paths(self, filename): break return (topLevelFolder, internalFile) - def get_file_items(self, window, files): + def get_file_items(self, *args): # Show the menu extension to share a file or folder + + # Nautilus 3.0 API passes args (window, files), 4.0 API just passes files + files = args[0] if len(args) == 1 else args[1] # Get usable file paths from the uris all_internal_files = True From 2543329741b731ef01e03d24683efa73da4b3f82 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Mon, 3 Oct 2022 21:09:26 +0200 Subject: [PATCH 2/2] fix import Signed-off-by: Gabriele Musco --- shell_integration/nautilus/syncstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py index 5733cf69d88..b6141e00102 100644 --- a/shell_integration/nautilus/syncstate.py +++ b/shell_integration/nautilus/syncstate.py @@ -26,7 +26,7 @@ import tempfile import time -from repository import GObject, Nautilus +from gi.repository import GObject, Nautilus # Note: setappname.sh will search and replace 'ownCloud' on this file to update this line and other # occurrences of the name