[virt-tools-list] [PATCH virt-viewer] Register remote-viewer mime handling

Marc-André Lureau marcandre.lureau at gmail.com
Mon Feb 11 13:41:51 UTC 2013


Unfortunately, I don't see yet how we could avoid the browser dialog
asking which application to open. On Firefox, each user has a
mimeTypes.rdf, but we can't really modify it..
---
 data/Makefile.am              | 23 ++++++++++++++++++++---
 data/remote-viewer.desktop.in |  9 +++++++++
 data/virt-viewer-mime.xml.in  | 11 +++++++++++
 po/POTFILES.in                |  2 ++
 src/Makefile.am               |  5 -----
 src/remote-viewer.desktop     |  6 ------
 6 files changed, 42 insertions(+), 14 deletions(-)
 create mode 100644 data/remote-viewer.desktop.in
 create mode 100644 data/virt-viewer-mime.xml.in
 delete mode 100644 src/remote-viewer.desktop

diff --git a/data/Makefile.am b/data/Makefile.am
index 2c3d739..e3f98a9 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,9 +1,10 @@
-NULL=
+NULL =
+CLEANFILES =
 
 EXTRA_DIST =					\
 	spice-xpi-client-remote-viewer		\
 	virt-viewer.nsis.in			\
-	virt-viewer-debug.nsis.in			\
+	virt-viewer-debug.nsis.in		\
 	$(NULL)
 
 if OS_WIN32
@@ -16,7 +17,23 @@ virt-viewer-$(VERSION).exe: virt-viewer.nsis deps.txt
 	makensis -NOCD -DDESTDIR=$$DESTDIR $< >/dev/null && \
 	rm -rf $$DESTDIR
 
-CLEANFILES = deps.txt virt-viewer-$(VERSION).exe
+CLEANFILES += deps.txt virt-viewer-$(VERSION).exe
+
+else #!WIN32
+
+desktopdir       = $(datadir)/applications
+DESKTOPFILES     = remote-viewer.desktop.in
+desktop_DATA     = $(DESKTOPFILES:.desktop.in=.desktop)
+ at INTLTOOL_DESKTOP_RULE@
+
+MIMEFILES = virt-viewer-mime.xml.in
+mimedir = $(datadir)/mime/packages
+mime_DATA = virt-viewer-mime.xml
+ at INTLTOOL_XML_RULE@
+
+CLEANFILES += $(mime_DATA) $(desktop_DATA)
+EXTRA_DIST += $(MIMEFILES) $(DESKTOPFILES)
+
 endif
 
 -include $(top_srcdir)/git.mk
diff --git a/data/remote-viewer.desktop.in b/data/remote-viewer.desktop.in
new file mode 100644
index 0000000..7fdfd47
--- /dev/null
+++ b/data/remote-viewer.desktop.in
@@ -0,0 +1,9 @@
+[Desktop Entry]
+_Name=Remote Viewer
+_Comment=Access remote desktops
+Exec=remote-viewer %u
+Type=Application
+Terminal=false
+MimeType=x-scheme-handler/spice;application/x-virt-viewer
+StartupNotify=true
+Categories=GNOME;GTK;Network;RemoteAccess;
diff --git a/data/virt-viewer-mime.xml.in b/data/virt-viewer-mime.xml.in
new file mode 100644
index 0000000..9fe9ff3
--- /dev/null
+++ b/data/virt-viewer-mime.xml.in
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+  <mime-type type="application/x-virt-viewer">
+    <sub-class-of type="text/plain"/>
+    <_comment>Virt-Viewer connection file</_comment>
+    <magic priority="50">
+      <match type="string" offset="0" value="[virt-viewer]"/>
+    </magic>
+    <glob pattern="*.vv"/>
+  </mime-type>
+</mime-info>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6b998e7..1f7f841 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,3 +1,5 @@
+data/remote-viewer.desktop.in
+data/virt-viewer-mime.xml.in
 src/gbinding.c
 src/remote-viewer-main.c
 src/remote-viewer.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 05e20b2..d14ab01 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -136,11 +136,6 @@ if OS_WIN32
 remote_viewer_LDFLAGS += -Wl,--subsystem,windows
 endif
 
-desktopdir = $(datadir)/applications
-desktop_DATA = remote-viewer.desktop
-
-EXTRA_DIST += $(desktop_DATA)
-
 VIRT_VIEWER_RES = virt-viewer.rc virt-viewer.manifest
 ICONDIR = $(top_builddir)/icons
 MANIFESTDIR = $(srcdir)
diff --git a/src/remote-viewer.desktop b/src/remote-viewer.desktop
deleted file mode 100644
index 7de7f6e..0000000
--- a/src/remote-viewer.desktop
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Remote Viewer
-Exec=remote-viewer %u
-Type=Application
-Terminal=false
-MimeType=x-scheme-handler/spice;
-- 
1.8.1.1.439.g50a6b54




More information about the virt-tools-list mailing list