mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 128772 - Account Help Button does not work
When pressing the help button, the following uri is created... ghelp:gnucash-help?acct-create and used to open the gnome help app. This segfaults in the '?' as ghelp:gnucash-help does work. To fix this use the full path to the help files.
This commit is contained in:
parent
743df212a1
commit
8c2538546b
@ -236,6 +236,61 @@ gnc_add_css_file (void)
|
|||||||
g_object_unref (provider_fallback);
|
g_object_unref (provider_fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function fixes an issue with yelp that it does not work with the
|
||||||
|
* ?anchor varient, see https://gitlab.gnome.org/GNOME/yelp/issues/116
|
||||||
|
*/
|
||||||
|
static gchar *
|
||||||
|
gnc_gnome_help_yelp_anchor_fix (const char *file_name, const char *anchor)
|
||||||
|
{
|
||||||
|
const gchar * const *sdatadirs = g_get_system_data_dirs ();
|
||||||
|
const gchar * const *langs = g_get_language_names ();
|
||||||
|
gchar *lookfor = g_strconcat ("gnome/help/", file_name, NULL);
|
||||||
|
gchar *help_path = NULL;
|
||||||
|
gchar *help_file = NULL;
|
||||||
|
gchar *full_path = NULL;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
for (; *sdatadirs; sdatadirs++)
|
||||||
|
{
|
||||||
|
gchar *filepath = g_build_filename (*sdatadirs, lookfor, NULL);
|
||||||
|
if (g_file_test (filepath, G_FILE_TEST_EXISTS))
|
||||||
|
help_path = g_strdup (filepath);
|
||||||
|
g_free (filepath);
|
||||||
|
}
|
||||||
|
g_free (lookfor);
|
||||||
|
|
||||||
|
if (!help_path)
|
||||||
|
{
|
||||||
|
gnc_error_dialog (NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||||
|
PERR("Unable to find 'gnome/help' directory");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the file extension, currently .xml
|
||||||
|
help_file = g_strconcat (file_name, ".xml", NULL);
|
||||||
|
|
||||||
|
for (; *langs; langs++)
|
||||||
|
{
|
||||||
|
gchar *filename = g_build_filename (help_path, *langs, help_file, NULL);
|
||||||
|
if (g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||||
|
full_path = g_strdup (filename);
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
g_free (help_path);
|
||||||
|
g_free (help_file);
|
||||||
|
|
||||||
|
if (full_path)
|
||||||
|
uri = g_strconcat ("ghelp:", full_path, "?", anchor, NULL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gnc_error_dialog (NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||||
|
PERR("Unable to find valid help language directory");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
g_free (full_path);
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MAC_INTEGRATION
|
#ifdef MAC_INTEGRATION
|
||||||
|
|
||||||
/* Don't be alarmed if this function looks strange to you: It's
|
/* Don't be alarmed if this function looks strange to you: It's
|
||||||
@ -418,16 +473,17 @@ gnc_gnome_help (const char *file_name, const char *anchor)
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *uri = NULL;
|
gchar *uri = NULL;
|
||||||
gboolean success;
|
gboolean success = TRUE;
|
||||||
|
|
||||||
if (anchor)
|
if (anchor)
|
||||||
uri = g_strconcat ("ghelp:", file_name, "?", anchor, NULL);
|
uri = gnc_gnome_help_yelp_anchor_fix (file_name, anchor);
|
||||||
else
|
else
|
||||||
uri = g_strconcat ("ghelp:", file_name, NULL);
|
uri = g_strconcat ("ghelp:", file_name, NULL);
|
||||||
|
|
||||||
DEBUG ("Attempting to opening help uri %s", uri);
|
DEBUG ("Attempting to opening help uri %s", uri);
|
||||||
|
|
||||||
success = gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error);
|
if (uri)
|
||||||
|
success = gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error);
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
if (success)
|
if (success)
|
||||||
|
Loading…
Reference in New Issue
Block a user