[Xfce4-commits] <xfce4-docs:master> Add xfhelp scripts.

Nick Schermer noreply at xfce.org
Wed Sep 21 18:32:01 CEST 2011


Updating branch refs/heads/master
         to 8a909006056efa380ead1f2746f81f9f56d97eff (commit)
       from 26070f28f3ad7d4f9c9b44e0e319235f5259bd2e (commit)

commit 8a909006056efa380ead1f2746f81f9f56d97eff
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Sep 21 18:30:48 2011 +0200

    Add xfhelp scripts.

 Makefile.am        |   25 +++++++++++++++++++++-
 xfhelp4.desktop.in |   11 ++++++++++
 xfhelp4.in         |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e44b43d..fbe5b94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,9 @@
 SUBDIRS = \
 	xfce-user-guide
 
+bin_SCRIPTS= \
+	xfhelp4
+
 distclean-local:
 	rm -rf *.spec *.cache *~
 
@@ -18,18 +21,36 @@ ChangeLog: Makefile
 
 dist-hook: ChangeLog
 
+desktopdir = $(datadir)/applications
+desktop_in_files = xfhelp4.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+ at INTLTOOL_DESKTOP_RULE@
+
+edit = sed \
+	-e "s, at _datadir_\@,$(datadir),g" \
+	-e "s, at _libdir_\@,$(libdir),g" \
+	-e "s, at _docdir_\@,$$(dirname $(docdir)),g" \
+	-e "s, at _sysconfdir_\@,$(sysconfdir),g"
+
+xfhelp4: Makefile $(srcdir)/xfhelp4.in
+	rm -f xfhelp4 xfhelp4.tmp
+	$(edit) $(srcdir)/xfhelp4.in >xfhelp4.tmp
+	mv xfhelp4.tmp xfhelp4
+
 EXTRA_DIST = \
 	$(desktop_in_files) \
 	intltool-extract.in \
 	intltool-merge.in \
-	intltool-update.in
+	intltool-update.in \
+	xfhelp4.in
 
 DISTCLEANFILES = \
 	$(desktop_DATA) \
 	intltool-extract \
 	intltool-merge \
 	intltool-update \
-	intltool-update-tmp
+	intltool-update-tmp \
+	xfhelp4
 
 DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-gen-doc
diff --git a/xfhelp4.desktop.in b/xfhelp4.desktop.in
new file mode 100644
index 0000000..784caac
--- /dev/null
+++ b/xfhelp4.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Exec=xfhelp4
+Icon=help-contents
+StartupNotify=false
+Terminal=false
+Categories=Utility;X-XFCE;X-Xfce-Toplevel;
+OnlyShowIn=XFCE;
+_Name=Help
+_Comment=Help using Xfce
diff --git a/xfhelp4.in b/xfhelp4.in
new file mode 100644
index 0000000..8f0e7fc
--- /dev/null
+++ b/xfhelp4.in
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+#  xfce
+#
+#  Copyright (C) 1999 Olivier Fourdan (fourdan at xfce.org)
+#  Copyright (C) 2003 Jasper Huijsmans (jasper at xfce.org)
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+HELP_DIR="@_docdir_@"
+
+if [ ! x"$1" = x"" ]; then
+    MODULE="${1%.html}"
+else
+    MODULE="xfce-utils"
+fi
+
+# Check for translated documentation
+if [ -n "$LC_ALL" ] ; then
+  LC=$LC_ALL
+elif [ -n "$LANG" ] ; then
+  LC=$LANG
+else
+  LC="C"
+fi
+
+LC_CLEAN="`echo $LC | sed 's/\(..\)_.*/\1/'`"
+
+if [ -r "$HELP_DIR/$MODULE/html/$LC/index.html" ]
+then
+  URL="$HELP_DIR/$MODULE/html/$LC/index.html"
+elif [ -r "$HELP_DIR/$MODULE/html/$LC_CLEAN/index.html" ]
+then
+  URL="$HELP_DIR/$MODULE/html/$LC_CLEAN/index.html"
+elif [ -r "$HELP_DIR/$MODULE/html/C/index.html" ]
+then
+  URL="$HELP_DIR/$MODULE/html/C/index.html"
+else
+  URL="$HELP_DIR/xfce-utils/html/C/index.html"
+fi
+
+exo-open --launch WebBrowser $URL


More information about the Xfce4-commits mailing list