Răsfoiți Sursa

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
Jason Mehring 9 ani în urmă
părinte
comite
6836420c3c

+ 2 - 3
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
 

+ 1 - 1
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,

+ 5 - 0
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)

+ 0 - 7
misc/nautilus-actions.conf

@@ -1,7 +0,0 @@
-[runtime]
-items-create-root-menu=false
-items-add-about-item=false
-
-[io-provider na-desktop]
-readable=true
-writable=true

+ 0 - 9
qubes-rpc/qvm-copy-gnome.desktop

@@ -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

+ 0 - 9
qubes-rpc/qvm-dvm-gnome.desktop

@@ -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

+ 0 - 9
qubes-rpc/qvm-move-gnome.desktop

@@ -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

+ 36 - 0
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()])

+ 43 - 0
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)

+ 36 - 0
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()])

+ 10 - 5
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