From 8953a9b26b606662e20d316f7bdbf8b72632b2dd Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 3 Oct 2008 22:23:00 +0200 Subject: [PATCH] Integrate documentation, bug tracker and website --- midori/midori-browser.c | 74 ++++++++++++++++++++++++++++++++++++----- midori/midori-view.c | 13 ++++++++ 2 files changed, 79 insertions(+), 8 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index cb6c11ef..8ae8e230 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2088,8 +2088,8 @@ _action_tab_next_activate (GtkAction* action, static const gchar* credits_authors[] = { "Christian Dywan ", NULL }; -static const gchar* credits_documenters/*[]*/ = /*{ - */NULL/* }*/; +static const gchar* credits_documenters[] = { + "Christian Dywan " }; static const gchar* credits_artists[] = { "Nancy Runge ", NULL }; @@ -2099,10 +2099,35 @@ static const gchar* license = "License as published by the Free Software Foundation; either\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 _action_about_activate (GtkAction* action, 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), "logo-icon-name", gtk_window_get_icon_name (GTK_WINDOW (browser)), "name", PACKAGE_NAME, @@ -2120,16 +2145,40 @@ _action_about_activate (GtkAction* action, } static void -_action_help_contents_activate (GtkAction* action, - MidoriBrowser* browser) +_action_help_link_activate (GtkAction* action, + MidoriBrowser* browser) { - const gchar* faq_uri = "http://wiki.xfce.org/_export/xhtml/midori_faq"; + const gchar* action_name; + const gchar* uri; gint n; - n = midori_browser_add_uri (browser, faq_uri); - midori_browser_set_current_page (browser, n); + 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); + } + } + static void _action_panel_activate (GtkToggleAction* action, MidoriBrowser* browser) @@ -2495,7 +2544,13 @@ static const GtkActionEntry entries[] = { { "Help", NULL, N_("_Help") }, { "HelpContents", GTK_STOCK_HELP, 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, NULL, "", N_("Show information about the program"), G_CALLBACK (_action_about_activate) }, @@ -2663,6 +2718,9 @@ static const gchar* ui_markup = "" "" "" + "" + "" + "" "" "" "" diff --git a/midori/midori-view.c b/midori/midori-view.c index eeea06f3..c35646f8 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -2161,6 +2161,19 @@ midori_view_set_uri (MidoriView* view, "", 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 ( + "No documentation installed" + "

No documentation installed

" + "

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." + "", + view->uri); + } if (data) { webkit_web_view_load_html_string (