[Xfce4-commits] <mousepad:master> Hardcoded help location to docs.xfce.org.

Nick Schermer noreply at xfce.org
Sun Dec 30 11:58:05 CET 2012


Updating branch refs/heads/master
         to 2c8a3873cadb4a7ab799480f32113cf9de5afaaf (commit)
       from 0194fadcf4cbbe15e1da6643073a9fc3d7f6b084 (commit)

commit 2c8a3873cadb4a7ab799480f32113cf9de5afaaf
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Dec 30 11:50:50 2012 +0100

    Hardcoded help location to docs.xfce.org.
    
    Should use the function in 4ui for this, but that's for later.

 Makefile.am                 |   13 --------
 MousepadHelp.in             |   68 -------------------------------------------
 mousepad/mousepad-dialogs.c |   33 +++-----------------
 3 files changed, 5 insertions(+), 109 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 788fedf..ad568bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,17 +9,6 @@ distclean-local:
 distuninstallcheck_listfiles = 						\ 
 	find . -type f -print | grep -v ./share/icons/hicolor/icon-theme.cache
 
-mousepad_scriptsdir = $(libdir)/xfce4/mousepad
-mousepad_scripts_SCRIPTS =							\
-	MousepadHelp
-
-MousepadHelp: MousepadHelp.in Makefile
-	rm -f MousepadHelp.gen MousepadHelp
-	sed -e "s,\@datadir\@,$(datadir),g" 					\
-		< $(srcdir)/MousepadHelp.in					\
-		> MousepadHelp.gen
-	mv MousepadHelp.gen MousepadHelp
-
 desktopdir = $(datadir)/applications
 desktop_in_in_files = 								\
 	mousepad.desktop.in.in
@@ -39,14 +28,12 @@ ChangeLog: Makefile
 dist-hook: ChangeLog
 
 EXTRA_DIST =									\
-	MousepadHelp.in								\
 	intltool-extract.in							\
 	intltool-merge.in							\
 	intltool-update.in							\
 	$(desktop_in_in_files)
 
 DISTCLEANFILES =								\
-	MousepadHelp								\
 	intltool-extract							\
 	intltool-merge								\
 	intltool-update								\
diff --git a/MousepadHelp.in b/MousepadHelp.in
deleted file mode 100644
index c6322f5..0000000
--- a/MousepadHelp.in
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2004-2006 Benedikt Meurer <benny at xfce.org>
-# Copyright (c) 2007      Nick Schermer <nick 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.
-#
-
-APPLICATIONS="exo-open firefox epiphany opera galeon mozilla konqueror dillo"
-
-URL="http://docs.xfce.org"
-
-# find a suitable browser to launch if no BROWSER variable is set
-if [ "x$BROWSER" = "x" ]; then
-  for i in $APPLICATIONS; do
-    # find the application in the path
-    testapp=$(which $i 2>/dev/null)
-    if test -f "$testapp"; then
-      # use the application and break
-      BROWSER=$i
-      break
-    fi
-  done
-fi
-
-# tell the use if no suitable browser was found
-if [ "x$BROWSER" = "x" ]; then
-  # print warning and leave
-  echo "MousepadHelp: Could not find a browser to use. Please set the BROWSER variable."
-  exit 1
-fi
-
-# run the browser
-case $BROWSER in
-  exo-open)
-    $BROWSER --launch WebBrowser $URL
-  ;;
-  opera*)
-    $BROWSER -remote openURL\($URL,new-window\) || $BROWSER $URL
-  ;;
-  firefox*)
-    $BROWSER -a firefox -remote openurl\($URL,new-window\) || $BROWSER $URL
-  ;;
-  communicator*|netscape|mozilla*|phoenix*|firebird*)
-    $BROWSER -remote openurl\($URL,new-window\) || $BROWSER $URL
-  ;;
-  *)
-    $BROWSER $URL;
-  ;;
-esac
-
-# leave
-exit 0
-
-# vim:set ts=2 sw=2 et ai:
-
diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index f5d4ccd..f1ab29d 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -86,10 +86,9 @@ mousepad_dialogs_show_help (GtkWindow   *parent,
                             const gchar *page,
                             const gchar *offset)
 {
-  GdkScreen *screen;
-  GError    *error = NULL;
-  gchar     *command;
-  gchar     *tmp;
+  GdkScreen   *screen;
+  GError      *error = NULL;
+  const gchar *uri;
 
   /* get screen */
   if (G_LIKELY (parent))
@@ -97,37 +96,15 @@ mousepad_dialogs_show_help (GtkWindow   *parent,
   else
     screen = gdk_screen_get_default ();
 
-  /* generate the command for the documentation browser */
-  command = g_strdup (LIBDIR G_DIR_SEPARATOR_S "xfce4" G_DIR_SEPARATOR_S "mousepad" G_DIR_SEPARATOR_S "MousepadHelp");
-
-  /* check if a page is given */
-  if (G_UNLIKELY (page != NULL))
-    {
-      /* append page as second parameter */
-      tmp = g_strconcat (command, " ", page, NULL);
-      g_free (command);
-      command = tmp;
-
-      /* check if an offset is given */
-      if (G_UNLIKELY (offset != NULL))
-        {
-          /* append offset as third parameter */
-          tmp = g_strconcat (command, " ", offset, NULL);
-          g_free (command);
-          command = tmp;
-        }
-    }
+  uri = "http://docs.xfce.org";
 
   /* try to run the documentation browser */
-  if (!gdk_spawn_command_line_on_screen (screen, command, &error))
+  if (!gtk_show_uri (screen, uri, gtk_get_current_event_time (), &error))
     {
       /* display an error message to the user */
       mousepad_dialogs_show_error (parent, error, _("Failed to open the documentation browser"));
       g_error_free (error);
     }
-
-  /* cleanup */
-  g_free (command);
 }
 
 


More information about the Xfce4-commits mailing list