Fix help handling.

master-1.22
infirit 2013-12-22 19:03:28 +01:00
parent f3aff1c106
commit 8a4039c6a3
1 changed files with 3 additions and 33 deletions

View File

@ -150,44 +150,15 @@ terminal_util_show_help (const char *topic,
GtkWindow *parent) GtkWindow *parent)
{ {
GError *error = NULL; GError *error = NULL;
const char *lang; char *url;
char *uri = NULL, *url;
guint i;
const char * const * langs = g_get_language_names ();
for (i = 0; langs[i]; i++)
{
lang = langs[i];
if (strchr (lang, '.'))
{
continue;
}
uri = g_build_filename (TERM_HELPDIR,
"mate-terminal", /* DOC_MODULE */
lang,
"mate-terminal.xml",
NULL);
if (g_file_test (uri, G_FILE_TEST_EXISTS))
{
break;
}
g_free (uri);
uri = NULL;
}
if (!uri)
return;
if (topic) if (topic)
{ {
url = g_strdup_printf ("help://%s?%s", uri, topic); url = g_strdup_printf ("help:mate-terminal/%s", topic);
} }
else else
{ {
url = g_strdup_printf ("help://%s", uri); url = g_strdup ("help:mate-terminal");
} }
if (!open_url (GTK_WINDOW (parent), url, gtk_get_current_event_time (), &error)) if (!open_url (GTK_WINDOW (parent), url, gtk_get_current_event_time (), &error))
@ -197,7 +168,6 @@ terminal_util_show_help (const char *topic,
g_error_free (error); g_error_free (error);
} }
g_free (uri);
g_free (url); g_free (url);
} }