From 6836420c3c61eede29ad0a64cb137d9a100cf426 Mon Sep 17 00:00:00 2001 From: Jason Mehring Date: Fri, 27 Feb 2015 00:52:17 -0500 Subject: [PATCH] Removed nautilus-actions depend and replaced with nautilus-python nautilus-actions was orphaned in fc21, so all nautilus context menus have been re-written as nautilus-python extensions --- Makefile | 5 ++-- debian/control | 2 +- debian/qubes-core-agent.postinst | 5 ++++ misc/nautilus-actions.conf | 7 ------ qubes-rpc/qvm-copy-gnome.desktop | 9 ------- qubes-rpc/qvm-dvm-gnome.desktop | 9 ------- qubes-rpc/qvm-move-gnome.desktop | 9 ------- qubes-rpc/qvm_copy_nautilus.py | 36 ++++++++++++++++++++++++++ qubes-rpc/qvm_dvm_nautilus.py | 43 ++++++++++++++++++++++++++++++++ qubes-rpc/qvm_move_nautilus.py | 36 ++++++++++++++++++++++++++ rpm_spec/core-vm.spec | 15 +++++++---- 11 files changed, 133 insertions(+), 43 deletions(-) delete mode 100644 misc/nautilus-actions.conf delete mode 100644 qubes-rpc/qvm-copy-gnome.desktop delete mode 100644 qubes-rpc/qvm-dvm-gnome.desktop delete mode 100644 qubes-rpc/qvm-move-gnome.desktop create mode 100755 qubes-rpc/qvm_copy_nautilus.py create mode 100755 qubes-rpc/qvm_dvm_nautilus.py create mode 100755 qubes-rpc/qvm_move_nautilus.py diff --git a/Makefile b/Makefile index daa8a1b..0b52fef 100644 --- a/Makefile +++ b/Makefile @@ -175,11 +175,10 @@ install-common: install -m 0644 qubes-rpc/qubes.GetImageRGBA $(DESTDIR)/etc/qubes-rpc install -m 0644 qubes-rpc/qubes.SetDateTime $(DESTDIR)/etc/qubes-rpc - install -d $(DESTDIR)/usr/share/file-manager/actions - install -m 0644 qubes-rpc/*-gnome.desktop $(DESTDIR)/usr/share/file-manager/actions + install -d $(DESTDIR)/usr/share/nautilus-python/extensions + install -m 0644 qubes-rpc/*_nautilus.py $(DESTDIR)/usr/share/nautilus-python/extensions install -D -m 0755 misc/qubes-desktop-run $(DESTDIR)/usr/bin/qubes-desktop-run - install -D misc/nautilus-actions.conf $(DESTDIR)/etc/xdg/nautilus-actions/nautilus-actions.conf install -d $(DESTDIR)/mnt/removable diff --git a/debian/control b/debian/control index 81b477d..a628d29 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Git: git://git.qubes-os.org/marmarek/core-agent-linux.git Package: qubes-core-agent Architecture: any Depends: qubes-utils (>= 3.0.1), libvchan-xen, xenstore-utils, iptables-persistent, xserver-xorg-video-dummy, xen-utils-common, ethtool, python2.7, python-gi, init-system-helpers, xdg-user-dirs, iptables, net-tools, initscripts, imagemagick, fakeroot, systemd, locales, sudo, dmsetup, psmisc, ncurses-term, xserver-xorg-core, x11-xserver-utils, xinit, ${shlibs:Depends}, ${misc:Depends} -Recommends: tinyproxy, gnome-themes-standard, xsettingsd, gnome-packagekit, chrony, ntpdate, network-manager (>= 0.8.1-1), network-manager-gnome, haveged, nautilus-actions, libnotify-bin, notify-osd, gnome-terminal +Recommends: tinyproxy, gnome-themes-standard, xsettingsd, gnome-packagekit, chrony, ntpdate, network-manager (>= 0.8.1-1), network-manager-gnome, haveged, libnotify-bin, notify-osd, gnome-terminal, python-nautilus Conflicts: qubes-core-agent-linux, firewalld, qubes-core-vm-sysvinit Description: Qubes core agent This package includes various daemons necessary for qubes domU support, diff --git a/debian/qubes-core-agent.postinst b/debian/qubes-core-agent.postinst index a891ae9..533fabd 100755 --- a/debian/qubes-core-agent.postinst +++ b/debian/qubes-core-agent.postinst @@ -302,6 +302,11 @@ case "${1}" in # XXX: TODO: Needs to be implemented still # These do not exist on debian; maybe a different package name # ntpd.service \ + + # Remove Nautilus actions as they have been replaced with nautilus-python + rm -f /usr/share/file-manager/actions/qvm-copy-gnome.desktop + rm -f /usr/share/file-manager/actions/qvm-move-gnome.desktop + rm -f /usr/share/file-manager/actions/qvm-dvm-gnome.desktop ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/misc/nautilus-actions.conf b/misc/nautilus-actions.conf deleted file mode 100644 index 46f5021..0000000 --- a/misc/nautilus-actions.conf +++ /dev/null @@ -1,7 +0,0 @@ -[runtime] -items-create-root-menu=false -items-add-about-item=false - -[io-provider na-desktop] -readable=true -writable=true diff --git a/qubes-rpc/qvm-copy-gnome.desktop b/qubes-rpc/qvm-copy-gnome.desktop deleted file mode 100644 index bb28125..0000000 --- a/qubes-rpc/qvm-copy-gnome.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Action -ToolbarLabel[C]=Copy to other AppVM -Name[C]=Copy to other AppVM -Profiles=profile-zero; - -[X-Action-Profile profile-zero] -Exec=/usr/lib/qubes/qvm-copy-to-vm.gnome %F -Name[C]=Default profile diff --git a/qubes-rpc/qvm-dvm-gnome.desktop b/qubes-rpc/qvm-dvm-gnome.desktop deleted file mode 100644 index 28664a4..0000000 --- a/qubes-rpc/qvm-dvm-gnome.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Action -ToolbarLabel[C]=Open in DisposableVM -Name[C]=Open in DisposableVM -Profiles=profile-zero; - -[X-Action-Profile profile-zero] -Exec=/usr/bin/qvm-open-in-dvm %f -Name[C]=Default profile diff --git a/qubes-rpc/qvm-move-gnome.desktop b/qubes-rpc/qvm-move-gnome.desktop deleted file mode 100644 index 7ae9be7..0000000 --- a/qubes-rpc/qvm-move-gnome.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Action -ToolbarLabel[C]=Move to other AppVM -Name[C]=Move to other AppVM -Profiles=profile-zero; - -[X-Action-Profile profile-zero] -Exec=/usr/lib/qubes/qvm-move-to-vm.gnome %F -Name[C]=Default profile diff --git a/qubes-rpc/qvm_copy_nautilus.py b/qubes-rpc/qvm_copy_nautilus.py new file mode 100755 index 0000000..30c990a --- /dev/null +++ b/qubes-rpc/qvm_copy_nautilus.py @@ -0,0 +1,36 @@ +import subprocess + +from gi.repository import Nautilus, GObject + + +class CopyToAppvmItemExtension(GObject.GObject, Nautilus.MenuProvider): + '''Copy file(s) to AppVM. + + Uses the nautilus-python api to previce 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): + '''Attaches context menu in Nautilus + ''' + if not files: + return + + menu_item = Nautilus.MenuItem(name='QubesMenuProvider::CopyToAppvm', + label='Copy To Other AppVM...', + tip='', + icon='') + + menu_item.connect('activate', self.on_menu_item_clicked, files) + return menu_item, + + def on_menu_item_clicked(self, menu, files): + '''Called when user chooses files though Nautilus context menu. + ''' + for file_obj in files: + + # Check if file still exists + if file_obj.is_gone(): + return + + gio_file = file_obj.get_location() + subprocess.call(['/usr/lib/qubes/qvm-copy-to-vm.gnome', gio_file.get_path()]) diff --git a/qubes-rpc/qvm_dvm_nautilus.py b/qubes-rpc/qvm_dvm_nautilus.py new file mode 100755 index 0000000..a4311a4 --- /dev/null +++ b/qubes-rpc/qvm_dvm_nautilus.py @@ -0,0 +1,43 @@ +import os +from subprocess import Popen + +from gi.repository import Nautilus, GObject + + +class OpenInDvmItemExtension(GObject.GObject, Nautilus.MenuProvider): + '''Open File(s) in DisposableVM. + + Uses the nautilus-python api to provide a context menu within Nautilus which + will enable the user to select file(s) to to open in a disposableVM + ''' + + def get_file_items(self, window, files): + '''Attaches context menu in Nautilus + ''' + if not files: + return + + menu_item = Nautilus.MenuItem(name='QubesMenuProvider::OpenInDvm', + label='Open In DisposableVM', + tip='', + icon='') + + menu_item.connect('activate', self.on_menu_item_clicked, files) + return menu_item, + + def on_menu_item_clicked(self, menu, files): + '''Called when user chooses files though Nautilus context menu. + ''' + for file_obj in files: + + # Check if file still exists + if file_obj.is_gone(): + return + + gio_file = file_obj.get_location() + + # Use subprocess.DEVNULL in python >= 3.3 + devnull = open(os.devnull, 'wb') + + # Use Popen instead of subprocess.call to spawn the process + Popen(['nohup', '/usr/bin/qvm-open-in-dvm', gio_file.get_path()], stdout=devnull, stderr=devnull) diff --git a/qubes-rpc/qvm_move_nautilus.py b/qubes-rpc/qvm_move_nautilus.py new file mode 100755 index 0000000..46a1639 --- /dev/null +++ b/qubes-rpc/qvm_move_nautilus.py @@ -0,0 +1,36 @@ +import subprocess + +from gi.repository import Nautilus, GObject + + +class MoveToAppvmItemExtension(GObject.GObject, Nautilus.MenuProvider): + '''Move file(s) to AppVM. + + 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): + '''Attaches context menu in Nautilus + ''' + if not files: + return + + menu_item = Nautilus.MenuItem(name='QubesMenuProvider::MoveToAppvm', + label='Move To Other AppVM...', + tip='', + icon='') + + menu_item.connect('activate', self.on_menu_item_clicked, files) + return menu_item, + + def on_menu_item_clicked(self, menu, files): + '''Called when user chooses files though Nautilus context menu. + ''' + for file_obj in files: + + # Check if file still exists + if file_obj.is_gone(): + return + + gio_file = file_obj.get_location() + subprocess.call(['/usr/lib/qubes/qvm-move-to-vm.gnome', gio_file.get_path()]) diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index babd75e..757e3fd 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -45,7 +45,7 @@ Requires: ethtool Requires: tinyproxy Requires: ntpdate Requires: net-tools -Requires: nautilus-actions +Requires: nautilus-python Requires: qubes-core-vm-kernel-placeholder Requires: qubes-utils Requires: initscripts @@ -266,6 +266,11 @@ if [ ! -f '/etc/sysconfig/ip6tables' ]; then cp -p /usr/lib/qubes/init/ip6tables /etc/sysconfig/ip6tables fi +# Remove Nautilus actions as they have been replaced with nautilus-python +rm -f /usr/share/file-manager/actions/qvm-copy-gnome.desktop +rm -f /usr/share/file-manager/actions/qvm-move-gnome.desktop +rm -f /usr/share/file-manager/actions/qvm-dvm-gnome.desktop + if [ "$1" != 1 ] ; then # do the rest of %post thing only when updating for the first time... exit 0 @@ -389,7 +394,6 @@ rm -f %{name}-%{version} %config(noreplace) /etc/udev/rules.d/50-qubes-misc.rules %config(noreplace) /etc/udev/rules.d/99-qubes-network.rules /etc/xdg/autostart/00-qubes-show-hide-nm-applet.desktop -/etc/xdg/nautilus-actions/nautilus-actions.conf /etc/xen/scripts/vif-route-qubes %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf %config(noreplace) /etc/yum.repos.d/qubes-r3.repo @@ -441,9 +445,10 @@ rm -f %{name}-%{version} /usr/share/qubes/serial.conf /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override /usr/share/glib-2.0/schemas/org.gnome.nautilus.gschema.override -/usr/share/file-manager/actions/qvm-copy-gnome.desktop -/usr/share/file-manager/actions/qvm-move-gnome.desktop -/usr/share/file-manager/actions/qvm-dvm-gnome.desktop +/usr/share/nautilus-python/extensions/qvm_copy_nautilus.py* +/usr/share/nautilus-python/extensions/qvm_move_nautilus.py* +/usr/share/nautilus-python/extensions/qvm_dvm_nautilus.py* + %dir /usr/share/qubes /usr/share/qubes/mime-override/globs %dir /home_volatile