Browse Source

Use new help function to redirect to docs.xfce.org.

upstream/xfce4-panel-4.10.1
Nick Schermer 11 years ago
parent
commit
3047ee12ab
  1. 66
      common/panel-utils.c
  2. 2
      configure.ac.in

66
common/panel-utils.c

@ -44,7 +44,7 @@ panel_utils_help_button_clicked (GtkWidget *button,
toplevel = gtk_widget_get_toplevel (button);
panel_utils_show_help (GTK_WINDOW (toplevel),
xfce_panel_plugin_get_name (panel_plugin),
"properties");
NULL);
}
@ -114,69 +114,7 @@ panel_utils_show_help (GtkWindow *parent,
const gchar *page,
const gchar *offset)
{
GdkScreen *screen;
gchar *filename;
gchar *uri = NULL;
GError *error = NULL;
gchar *locale;
gboolean exists;
panel_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
if (G_LIKELY (parent != NULL))
screen = gtk_window_get_screen (parent);
else
screen = gdk_screen_get_default ();
if (page == NULL)
page = "index";
/* get the locale of the user */
locale = g_strdup (setlocale (LC_MESSAGES, NULL));
if (G_LIKELY (locale != NULL))
locale = g_strdelimit (locale, "._", '\0');
else
locale = g_strdup ("C");
/* check if the help page exists on the system */
filename = g_strconcat (HELPDIR, G_DIR_SEPARATOR_S, locale,
G_DIR_SEPARATOR_S, page, ".html", NULL);
exists = g_file_test (filename, G_FILE_TEST_EXISTS);
if (!exists)
{
g_free (filename);
filename = g_strconcat (HELPDIR, G_DIR_SEPARATOR_S "C"
G_DIR_SEPARATOR_S, page, ".html", NULL);
exists = g_file_test (filename, G_FILE_TEST_EXISTS);
}
if (G_LIKELY (exists))
{
uri = g_strconcat ("file://", filename, offset != NULL ? "#" : NULL, offset, NULL);
}
else if (xfce_dialog_confirm (parent, "web-browser", _("_Read Online"),
_("You can read the user manual online. This manual may however "
"not exactly match your panel version."),
_("The user manual is not installed on your computer")))
{
uri = g_strconcat ("http://docs.xfce.org/help.php?package=xfce4-panel&lang=",
locale, "&page=", page, "&anchor=", offset, NULL);
}
g_free (filename);
g_free (locale);
/* try to run the documentation browser */
if (uri != NULL
&& !exo_execute_preferred_application_on_screen ("WebBrowser", uri, NULL,
NULL, screen, &error))
{
/* display an error message to the user */
xfce_dialog_show_error (parent, error, _("Failed to open the documentation browser"));
g_error_free (error);
}
g_free (uri);
xfce_dialog_show_help (parent, "xfce4-panel", page, offset);
}

2
configure.ac.in

@ -127,7 +127,7 @@ dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.8.0])
XDT_CHECK_PACKAGE([GARCON], [garcon-1], [0.1.5])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.9.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.8.0])
XDT_CHECK_PACKAGE([EXO], [exo-1], [0.6.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])

Loading…
Cancel
Save