[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH virt-viewer] Add a desktop file for launching remote-viewer



From: "Daniel P. Berrange" <berrange redhat com>

Enable automagic handling of spice:// URLs in firefox by
registering a desktop handler for remote-viewer with the
SPICE URI scheme
---
 src/Makefile.am           |    5 +++++
 src/remote-viewer.desktop |    6 ++++++
 virt-viewer.spec.in       |    5 +++++
 3 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 src/remote-viewer.desktop

diff --git a/src/Makefile.am b/src/Makefile.am
index 6ee97fa..1604b46 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -111,6 +111,11 @@ 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
new file mode 100644
index 0000000..f930592
--- /dev/null
+++ b/src/remote-viewer.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Remote Viewer
+Exec=remote-viewer %u
+Type=Application
+Terminal=False
+MimeType=x-scheme-handler/spice
diff --git a/virt-viewer.spec.in b/virt-viewer.spec.in
index 2eed9c3..bbdfade 100644
--- a/virt-viewer.spec.in
+++ b/virt-viewer.spec.in
@@ -35,6 +35,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: openssh-clients
 Requires(post):   %{_sbindir}/update-alternatives
 Requires(postun): %{_sbindir}/update-alternatives
+Requires(post): desktop-file-utils
+Requires(postun): desktop-file-utils
 
 %if %{with_gtk3}
 BuildRequires: gtk3-devel >= 3.0.0
@@ -132,6 +134,7 @@ rm -rf $RPM_BUILD_ROOT
 /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
 %{_sbindir}/update-alternatives --install %{_libexecdir}/spice-xpi-client \
   spice-xpi-client %{_libexecdir}/spice-xpi-client-remote-viewer 25
+update-desktop-database -q %{_datadir}/applications
 
 %postun
 if [ $1 -eq 0 ] ; then
@@ -139,6 +142,7 @@ if [ $1 -eq 0 ] ; then
   /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
   %{_sbindir}/update-alternatives --remove spice-xpi-client %{_libexecdir}/spice-xpi-client-remote-viewer
 fi
+update-desktop-database -q %{_datadir}/applications
 
 %posttrans
 /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
@@ -154,6 +158,7 @@ fi
 %{_datadir}/%{name}/ui/virt-viewer-auth.xml
 %{_datadir}/%{name}/ui/virt-viewer-about.xml
 %{_datadir}/icons/hicolor/*/apps/*
+%{_datadir}/applications/remote-viewer.desktop
 %ghost %{_libexecdir}/spice-xpi-client
 %{_libexecdir}/spice-xpi-client-remote-viewer
 %{_mandir}/man1/virt-viewer.1*
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]