]> spindle.queued.net Git - midori/commitdiff
Integrate documentation, bug tracker and website
authorChristian Dywan <christian@twotoasts.de>
Fri, 3 Oct 2008 20:23:00 +0000 (22:23 +0200)
committerChristian Dywan <christian@twotoasts.de>
Fri, 3 Oct 2008 20:23:00 +0000 (22:23 +0200)
midori/midori-browser.c
midori/midori-view.c

index cb6c11efc2756517c362d219759e29fdda9478a7..8ae8e23026d307e388f244aa02490ad6b63c58cb 100644 (file)
@@ -2088,8 +2088,8 @@ _action_tab_next_activate (GtkAction*     action,
 
 static const gchar* credits_authors[] = {
     "Christian Dywan <christian@twotoasts.de>", NULL };
-static const gchar* credits_documenters/*[]*/ = /*{
-    */NULL/* }*/;
+static const gchar* credits_documenters[] = {
+    "Christian Dywan <christian@twotoasts.de>" };
 static const gchar* credits_artists[] = {
     "Nancy Runge <nancy@twotoasts.de>", 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 =
    "</menu>"
    "<menu action='Help'>"
     "<menuitem action='HelpContents'/>"
+    "<menuitem action='HelpFAQ'/>"
+    "<menuitem action='HelpBugs'/>"
+    "<separator/>"
     "<menuitem action='About'/>"
    "</menu>"
   "</menubar>"
index eeea06f3b3f4cee7e39e5d836a74fc4563b40840..c35646f8ae07b7b80cdd27a5803c59341bb56851 100644 (file)
@@ -2161,6 +2161,19 @@ midori_view_set_uri (MidoriView*  view,
                     "</body></html>",
                     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)
             {
                 webkit_web_view_load_html_string (