Skip to content

Commit

Permalink
qubes-rpc/nautilus: Add support for Nautilus API 4.0
Browse files Browse the repository at this point in the history
The get_file_items method of Nautilus.MenuProvider no longer take the window argument.

https://gnome.pages.gitlab.gnome.org/nautilus-python/nautilus-python-migrating-to-4.html

Fixes: QubesOS/qubes-issues#7916
  • Loading branch information
noskb committed Nov 28, 2022
1 parent 45a7af9 commit 0f7f0d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion qubes-rpc/nautilus/qvm_copy_nautilus.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ class CopyToAppvmItemExtension(GObject.GObject, Nautilus.MenuProvider):
Uses the nautilus-python api to provide a context menu with Nautilus which
will enable the user to select file(s) to to copy to another AppVM
'''
def get_file_items(self, window, files):
def get_file_items(self, *args):
'''Attaches context menu in Nautilus
`args` will be `[files: List[Nautilus.FileInfo]]` in Nautilus 4.0 API,
and `[window: Gtk.Widget, files: List[Nautilus.FileInfo]]` in Nautilus 3.0 API.
'''
files = args[-1]
if not files:
return

Expand Down
6 changes: 5 additions & 1 deletion qubes-rpc/nautilus/qvm_dvm_nautilus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ class OpenInDvmItemExtension(GObject.GObject, Nautilus.MenuProvider):
will enable the user to select file(s) to to open in a disposableVM
'''

def get_file_items(self, window, files):
def get_file_items(self, *args):
'''Attaches context menu in Nautilus
`args` will be `[files: List[Nautilus.FileInfo]]` in Nautilus 4.0 API,
and `[window: Gtk.Widget, files: List[Nautilus.FileInfo]]` in Nautilus 3.0 API.
'''
files = args[-1]
if not files:
return

Expand Down
6 changes: 5 additions & 1 deletion qubes-rpc/nautilus/qvm_move_nautilus.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ class MoveToAppvmItemExtension(GObject.GObject, Nautilus.MenuProvider):
Uses the nautilus-python api to provide a context menu within Nautilus which
will enable the user to select file(s) to to move to another AppVM
'''
def get_file_items(self, window, files):
def get_file_items(self, *args):
'''Attaches context menu in Nautilus
`args` will be `[files: List[Nautilus.FileInfo]]` in Nautilus 4.0 API,
and `[window: Gtk.Widget, files: List[Nautilus.FileInfo]]` in Nautilus 3.0 API.
'''
files = args[-1]
if not files:
return

Expand Down

0 comments on commit 0f7f0d6

Please sign in to comment.