[Xfce4-commits] <thunar:master> Attach help buttons to docs.xfce.org.

Nick Schermer noreply at xfce.org
Sun Jan 8 12:46:01 CET 2012


Updating branch refs/heads/master
         to 0251e32742841aa7aa7ab176013928fac8cfb293 (commit)
       from aa5cfe4555211c264a212a6d58d9816adac46393 (commit)

commit 0251e32742841aa7aa7ab176013928fac8cfb293
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Jan 8 12:44:57 2012 +0100

    Attach help buttons to docs.xfce.org.

 Makefile.am                        |   11 ------
 ThunarHelp.in                      |   50 -----------------------------
 thunar/thunar-column-editor.c      |    7 +++-
 thunar/thunar-dialogs.c            |   61 ------------------------------------
 thunar/thunar-dialogs.h            |    4 --
 thunar/thunar-preferences-dialog.c |    3 +-
 thunar/thunar-properties-dialog.c  |    5 ++-
 thunar/thunar-renamer-dialog.c     |    5 ++-
 thunar/thunar-window.c             |    3 +-
 9 files changed, 18 insertions(+), 131 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 845e402..17873ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,15 +54,6 @@ ThunarBulkRename: ThunarBulkRename.in Makefile
 		&& mv ThunarBulkRename.gen ThunarBulkRename 		\
 	)
 
-ThunarHelp: ThunarHelp.in Makefile
-	$(AM_V_GEN) (							\
-		rm -f ThunarHelp.gen ThunarHelp				\
-		&& sed -e "s,\@docdir\@,$(docdir),g" 			\
-			< $(srcdir)/ThunarHelp.in			\
-			> ThunarHelp.gen				\
-		&& mv ThunarHelp.gen ThunarHelp				\
-	)
-
 desktopdir = $(datadir)/applications
 desktop_in_in_files = 							\
 	Thunar.desktop.in.in						\
@@ -86,7 +77,6 @@ EXTRA_DIST =								\
 	FAQ								\
 	HACKING								\
 	ThunarBulkRename.in						\
-	ThunarHelp.in							\
 	intltool-extract.in						\
 	intltool-merge.in						\
 	intltool-update.in						\
@@ -95,7 +85,6 @@ EXTRA_DIST =								\
 
 DISTCLEANFILES =							\
 	ThunarBulkRename						\
-	ThunarHelp							\
 	intltool-extract						\
 	intltool-merge							\
 	intltool-update							\
diff --git a/ThunarHelp.in b/ThunarHelp.in
deleted file mode 100644
index 3294b35..0000000
--- a/ThunarHelp.in
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-#
-# Copyright (c) 2004-2006 Benedikt Meurer <benny 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.
-#
-
-HELPDIR="@docdir@/html/"
-
-if test -n "$LC_ALL"; then
-  LC=$LC_ALL
-elif test -n "$LANG"; then
-  LC=$LANG
-else
-  LC="C"
-fi
-
-if test -n "$1"; then
-  HELPFILE="$1.html"
-else
-  HELPFILE="index.html"
-fi
-
-if test -r "$HELPDIR/$LC/$HELPFILE"; then
-  URL="$HELPDIR/$LC/$HELPFILE"
-elif test -r "$HELPDIR/`echo $LC | sed 's/\(..\)_.*/\1/'`/$HELPFILE"; then
-  URL="$HELPDIR/`echo $LC | sed 's/\(..\)_.*/\1/'`/$HELPFILE"
-else 
-  URL="$HELPDIR/C/index.html"
-fi
-
-[ -n "$2" ] && URL="$URL#$2"
-
-exec exo-open --launch WebBrowser "file://$URL"
-
-# vim:set ts=2 sw=2 et ai:
diff --git a/thunar/thunar-column-editor.c b/thunar/thunar-column-editor.c
index 738c49f..75149e2 100644
--- a/thunar/thunar-column-editor.c
+++ b/thunar/thunar-column-editor.c
@@ -21,6 +21,8 @@
 #include <config.h>
 #endif
 
+#include <libxfce4ui/libxfce4ui.h>
+
 #include <thunar/thunar-abstract-dialog.h>
 #include <thunar/thunar-column-editor.h>
 #include <thunar/thunar-dialogs.h>
@@ -302,7 +304,10 @@ thunar_column_editor_help_clicked (GtkWidget          *button,
   _thunar_return_if_fail (GTK_IS_BUTTON (button));
 
   /* open the user manual */
-  thunar_dialogs_show_help (column_editor, "the-file-manager-window", "visible-columns-in-the-detailed-list-view");
+  xfce_dialog_show_help (GTK_WINDOW (gtk_widget_get_toplevel (button)),
+                         "thunar",
+                         "the-file-manager-window",
+                         "visible-columns-in-the-detailed-list-view");
 }
 
 
diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c
index 576252b..3d92ec4 100644
--- a/thunar/thunar-dialogs.c
+++ b/thunar/thunar-dialogs.c
@@ -323,67 +323,6 @@ thunar_dialogs_show_error (gpointer      parent,
 
 
 /**
- * thunar_dialogs_show_help:
- * @parent : a #GtkWidget on which the user manual should be shown, or a #GdkScreen
- *           if no #GtkWidget is known. May also be %NULL, in which case the default
- *           #GdkScreen will be used.
- * @page   : the name of the page of the user manual to display or %NULL to display
- *           the overview page.
- * @offset : the offset of the topic in the @page to display or %NULL to just display
- *           @page.
- *
- * Displays the Thunar user manual. If @page is not %NULL it specifies the basename
- * of the HTML file to display. @offset may refer to a anchor in the @page.
- **/
-void
-thunar_dialogs_show_help (gpointer     parent,
-                          const gchar *page,
-                          const gchar *offset)
-{
-  GdkScreen *screen;
-  GError    *error = NULL;
-  gchar     *command;
-  gchar     *tmp;
-
-  /* determine the screen on which to launch the help */
-  screen = thunar_util_parse_parent (parent, NULL);
-
-  /* generate the command for the documentation browser */
-  command = g_strdup (HELPERDIR G_DIR_SEPARATOR_S "Thunar" G_DIR_SEPARATOR_S "ThunarHelp");
-
-  /* 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;
-        }
-    }
-
-  /* try to run the documentation browser */
-  if (!gdk_spawn_command_line_on_screen (screen, command, &error))
-    {
-      /* display an error message to the user */
-      thunar_dialogs_show_error (parent, error, _("Failed to open the documentation browser"));
-      g_error_free (error);
-    }
-
-  /* cleanup */
-  g_free (command);
-}
-
-
-
-/**
  * thunar_dialogs_show_job_ask:
  * @parent   : the parent #GtkWindow or %NULL.
  * @question : the question text.
diff --git a/thunar/thunar-dialogs.h b/thunar/thunar-dialogs.h
index b8b82c0..d476cb6 100644
--- a/thunar/thunar-dialogs.h
+++ b/thunar/thunar-dialogs.h
@@ -39,10 +39,6 @@ void               thunar_dialogs_show_error           (gpointer              pa
                                                         const gchar          *format,
                                                         ...) G_GNUC_PRINTF (3, 4);
 
-void               thunar_dialogs_show_help            (gpointer              parent,
-                                                        const gchar          *page,
-                                                        const gchar          *offset);
-
 ThunarJobResponse  thunar_dialogs_show_job_ask         (GtkWindow            *parent,
                                                         const gchar          *question,
                                                         ThunarJobResponse     choices);
diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c
index 504db2c..c5df299 100644
--- a/thunar/thunar-preferences-dialog.c
+++ b/thunar/thunar-preferences-dialog.c
@@ -610,7 +610,8 @@ thunar_preferences_dialog_response (GtkDialog *dialog,
   if (G_UNLIKELY (response == GTK_RESPONSE_HELP))
     {
       /* open the preferences section of the user manual */
-      thunar_dialogs_show_help (GTK_WIDGET (dialog), "preferences", NULL);
+      xfce_dialog_show_help (GTK_WINDOW (dialog), "thunar",
+                             "preferences", NULL);
     }
   else
     {
diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c
index c189e26..de90d5d 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -33,6 +33,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include <exo/exo.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include <thunar/thunar-abstract-dialog.h>
 #include <thunar/thunar-application.h>
@@ -599,7 +600,9 @@ thunar_properties_dialog_response (GtkDialog *dialog,
     }
   else if (response == GTK_RESPONSE_HELP)
     {
-      thunar_dialogs_show_help (dialog, "working-with-files-and-folders", "file-properties");
+      xfce_dialog_show_help (GTK_WINDOW (dialog), "thunar",
+                             "working-with-files-and-folders",
+                             "file-properties");
     }
   else if (GTK_DIALOG_CLASS (thunar_properties_dialog_parent_class)->response != NULL)
     {
diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c
index 619d93e..66ea52f 100644
--- a/thunar/thunar-renamer-dialog.c
+++ b/thunar/thunar-renamer-dialog.c
@@ -28,6 +28,8 @@
 #include <string.h>
 #endif
 
+#include <libxfce4ui/libxfce4ui.h>
+
 #include <thunar/thunar-abstract-dialog.h>
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-dialogs.h>
@@ -928,7 +930,8 @@ thunar_renamer_dialog_help (ThunarRenamerDialog *renamer_dialog)
   if (G_LIKELY (help_url == NULL))
     {
       /* open the general documentation if no specific URL */
-      thunar_dialogs_show_help (GTK_WIDGET (renamer_dialog), "advanced-topics", "to-bulk-rename-files");
+      xfce_dialog_show_help (GTK_WINDOW (renamer_dialog), "thunar",
+                             "advanced-topics", "to-bulk-rename-files");
     }
   else
     {
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index a42d982..8d930a9 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -31,6 +31,7 @@
 #endif
 
 #include <gdk/gdkkeysyms.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-browser.h>
@@ -2362,7 +2363,7 @@ thunar_window_action_contents (GtkAction    *action,
                                ThunarWindow *window)
 {
   /* display the documentation index */
-  thunar_dialogs_show_help (window, NULL, NULL);
+  xfce_dialog_show_help (GTK_WINDOW (window), "thunar", NULL, NULL);
 }
 
 


More information about the Xfce4-commits mailing list