Integrate documentation, bug tracker and website

This commit is contained in:
Christian Dywan 2008-10-03 22:23:00 +02:00
parent e4238d7c73
commit 8953a9b26b
2 changed files with 79 additions and 8 deletions

View file

@ -2088,8 +2088,8 @@ _action_tab_next_activate (GtkAction* action,
static const gchar* credits_authors[] = { static const gchar* credits_authors[] = {
"Christian Dywan <christian@twotoasts.de>", NULL }; "Christian Dywan <christian@twotoasts.de>", NULL };
static const gchar* credits_documenters/*[]*/ = /*{ static const gchar* credits_documenters[] = {
*/NULL/* }*/; "Christian Dywan <christian@twotoasts.de>" };
static const gchar* credits_artists[] = { static const gchar* credits_artists[] = {
"Nancy Runge <nancy@twotoasts.de>", NULL }; "Nancy Runge <nancy@twotoasts.de>", NULL };
@ -2099,10 +2099,35 @@ static const gchar* license =
"License as published by the Free Software Foundation; either\n" "License as published by the Free Software Foundation; either\n"
"version 2.1 of the License, or (at your option) any later version.\n"; "version 2.1 of the License, or (at your option) any later version.\n";
static void
_action_about_activate_link (GtkAboutDialog* about,
const gchar* link,
gpointer user_data)
{
MidoriBrowser* browser;
gint n;
browser = MIDORI_BROWSER (user_data);
n = midori_browser_add_uri (browser, link);
midori_browser_set_current_page (browser, n);
}
static void
_action_about_activate_email (GtkAboutDialog* about,
const gchar* link,
gpointer user_data)
{
gchar* command = g_strconcat ("xdg-open ", link, NULL);
g_spawn_command_line_async (command, NULL);
g_free (command);
}
static void static void
_action_about_activate (GtkAction* action, _action_about_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
gtk_about_dialog_set_email_hook (_action_about_activate_email, NULL, NULL);
gtk_about_dialog_set_url_hook (_action_about_activate_link, browser, NULL);
gtk_show_about_dialog (GTK_WINDOW (browser), gtk_show_about_dialog (GTK_WINDOW (browser),
"logo-icon-name", gtk_window_get_icon_name (GTK_WINDOW (browser)), "logo-icon-name", gtk_window_get_icon_name (GTK_WINDOW (browser)),
"name", PACKAGE_NAME, "name", PACKAGE_NAME,
@ -2120,16 +2145,40 @@ _action_about_activate (GtkAction* action,
} }
static void static void
_action_help_contents_activate (GtkAction* action, _action_help_link_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
const gchar* faq_uri = "http://wiki.xfce.org/_export/xhtml/midori_faq"; const gchar* action_name;
const gchar* uri;
gint n; gint n;
n = midori_browser_add_uri (browser, faq_uri); action_name = gtk_action_get_name (action);
if (!strncmp ("HelpContents", action_name, 12))
{
#ifdef DOCDIR
uri = DOCDIR "/midori/user/midori.html";
if (!g_file_test (uri, G_FILE_TEST_EXISTS))
uri = "error:nodocs " DOCDIR "/midori/user/midori.html";
#else
uri = "error:nodocs " DATADIR "/doc/midori/user/midori.html";
#endif
}
else if (!strncmp ("HelpFAQ", action_name, 7))
uri = "http://wiki.xfce.org/_export/xhtml/midori_faq";
else if (!strncmp ("HelpBugs", action_name, 8))
uri = "http://www.twotoasts.de/bugs/";
else
uri = NULL;
if (uri)
{
n = midori_browser_add_uri (browser, uri);
midori_browser_set_current_page (browser, n); midori_browser_set_current_page (browser, n);
}
} }
static void static void
_action_panel_activate (GtkToggleAction* action, _action_panel_activate (GtkToggleAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
@ -2495,7 +2544,13 @@ static const GtkActionEntry entries[] = {
{ "Help", NULL, N_("_Help") }, { "Help", NULL, N_("_Help") },
{ "HelpContents", GTK_STOCK_HELP, { "HelpContents", GTK_STOCK_HELP,
N_("_Contents"), "F1", N_("_Contents"), "F1",
N_("Show the documentation"), G_CALLBACK (_action_help_contents_activate) }, N_("Show the documentation"), G_CALLBACK (_action_help_link_activate) },
{ "HelpFAQ", NULL,
N_("_Frequent questions"), NULL,
N_("Show the Frequently Asked Questions"), G_CALLBACK (_action_help_link_activate) },
{ "HelpBugs", NULL,
N_("_Report a bug"), NULL,
N_("Open Midori's bug tracker"), G_CALLBACK (_action_help_link_activate) },
{ "About", GTK_STOCK_ABOUT, { "About", GTK_STOCK_ABOUT,
NULL, "", NULL, "",
N_("Show information about the program"), G_CALLBACK (_action_about_activate) }, N_("Show information about the program"), G_CALLBACK (_action_about_activate) },
@ -2663,6 +2718,9 @@ static const gchar* ui_markup =
"</menu>" "</menu>"
"<menu action='Help'>" "<menu action='Help'>"
"<menuitem action='HelpContents'/>" "<menuitem action='HelpContents'/>"
"<menuitem action='HelpFAQ'/>"
"<menuitem action='HelpBugs'/>"
"<separator/>"
"<menuitem action='About'/>" "<menuitem action='About'/>"
"</menu>" "</menu>"
"</menubar>" "</menubar>"

View file

@ -2161,6 +2161,19 @@ midori_view_set_uri (MidoriView* view,
"</body></html>", "</body></html>",
view->uri, view->uri, view->uri); view->uri, view->uri, view->uri);
} }
else if (!strncmp (uri, "error:nodocs ", 13))
{
katze_assign (view->uri, g_strdup (&uri[13]));
data = g_strdup_printf (
"<html><head><title>No documentation installed</title></head>"
"<body><h1>No documentation installed</h1>"
"<p />There is no documentation installed at %s."
"You may want to ask your distribution or "
"package maintainer for it or if this a custom build "
"verify that the build is setup properly."
"</body></html>",
view->uri);
}
if (data) if (data)
{ {
webkit_web_view_load_html_string ( webkit_web_view_load_html_string (