merge_all_tap_menus() has been moved to menus.c.
[obnox/wireshark/wip.git] / gtk / help_dlg.c
index 5d53717df2e82d82755051ef8097255332f77f26..1ae8c0c506d844e77e0243824e7417ceeb2f1756 100644 (file)
 #ifdef HHC_DIR
 #include <windows.h>
 #include <htmlhelp.h>
-#include "epan/unicode-utils.h"
+#include <wsutil/unicode-utils.h>
 #endif
 
 
-#define HELP_DIR       "help"
+#define HELP_DIR        "help"
 
 
 #define NOTEBOOK_KEY    "notebook_key"
@@ -69,34 +69,20 @@ static GtkWidget *help_w = NULL;
  * (for text format changes).
  */
 typedef struct {
-  char *topic;
-  char *pathname;
-  GtkWidget *page;
+    char *topic;
+    char *pathname;
+    GtkWidget *page;
 } help_page_t;
 
 static GSList *help_text_pages = NULL;
 
 
-
-gboolean topic_available(topic_action_e action) {
-
-    if(action == HELP_CAPTURE_INTERFACES_DETAILS_DIALOG) {
-        /* XXX - add the page HELP_CAPTURE_INTERFACES_DETAILS_DIALOG and remove this if */
-        /* page currently not existing in user's guide */
-        return FALSE;
-    }
-    /* online: we have almost all possible pages available */
-    return TRUE;
-}
-
-
 /*
  * Open the help dialog and show a specific HTML help page.
  */
 void help_topic_html(const gchar *topic) {
     GString *url;
 
-
     /* try to open local .chm file */
 #ifdef HHC_DIR
     HWND hw;
@@ -120,8 +106,17 @@ void help_topic_html(const gchar *topic) {
 
     url = g_string_new("");
 
-    /* try to open the HTML page from wireshark.org instead */
-    g_string_append_printf(url, "http://www.wireshark.org/docs/wsug_html_chunked/%s", topic);
+#ifdef DOC_DIR
+    if (g_file_test(DOC_DIR "/guides/wsug_html_chunked", G_FILE_TEST_IS_DIR)) {
+        /* try to open the HTML page from wireshark.org instead */
+        g_string_append_printf(url, "file://" DOC_DIR "/guides/wsug_html_chunked/%s", topic);
+    } else {
+#endif /* ifdef DOC_DIR */
+       /* try to open the HTML page from wireshark.org instead */
+        g_string_append_printf(url, "http://www.wireshark.org/docs/wsug_html_chunked/%s", topic);
+#ifdef DOC_DIR
+    }
+#endif /* ifdef DOC_DIR */
 
     browser_open_url(url->str);
 
@@ -129,23 +124,22 @@ void help_topic_html(const gchar *topic) {
 }
 
 
-
 /**
  * Redraw all help pages, to use a new font.
  */
 void help_redraw(void)
 {
-  GSList *help_page_ent;
-  help_page_t *help_page;
-
-  if (help_w != NULL) {
-    for (help_page_ent = help_text_pages; help_page_ent != NULL;
-        help_page_ent = g_slist_next(help_page_ent))
-    {
-      help_page = (help_page_t *)help_page_ent->data;
-      text_page_redraw(help_page->page, help_page->pathname);
+    GSList *help_page_ent;
+    help_page_t *help_page;
+
+    if (help_w != NULL) {
+        for (help_page_ent = help_text_pages; help_page_ent != NULL;
+             help_page_ent = g_slist_next(help_page_ent))
+        {
+            help_page = (help_page_t *)help_page_ent->data;
+            text_page_redraw(help_page->page, help_page->pathname);
+        }
     }
-  }
 }
 
 
@@ -183,6 +177,9 @@ topic_online_url(topic_action_e action)
     case(ONLINEPAGE_SECURITY):
         return "http://wiki.wireshark.org/Security";
         break;
+    case(ONLINEPAGE_CHIMNEY):
+        return "http://wiki.wireshark.org/CaptureSetup/Offloading#chimney";
+        break;
     default:
         return NULL;
     }
@@ -248,6 +245,9 @@ topic_action(topic_action_e action)
     case(HELP_CONFIG_PROFILES_DIALOG):
         help_topic_html("ChCustConfigProfilesSection.html");
         break;
+    case (HELP_MANUAL_ADDR_RESOLVE_DIALOG):
+        help_topic_html("ChManualAddressResolveSection.html");
+        break;
     case(HELP_PRINT_DIALOG):
         help_topic_html("ChIOPrintSection.html");
         break;
@@ -255,7 +255,7 @@ topic_action(topic_action_e action)
         help_topic_html("ChWorkFindPacketSection.html");
         break;
     case(HELP_FIREWALL_DIALOG):
-        help_topic_html("ChUseAnalyzeMenuSection.html");
+        help_topic_html("ChUseToolsMenuSection.html");
         break;
     case(HELP_GOTO_DIALOG):
         help_topic_html("ChWorkGoToPacketSection.html");
@@ -275,7 +275,7 @@ topic_action(topic_action_e action)
     case(HELP_DECODE_AS_SHOW_DIALOG):
         help_topic_html("ChCustProtocolDissectionSection.html");
         break;
-    case(HELP_FOLLOW_TCP_STREAM_DIALOG):
+    case(HELP_FOLLOW_STREAM_DIALOG):
         help_topic_html("ChAdvFollowTCPSection.html");
         break;
     case(HELP_EXPERT_INFO_DIALOG):
@@ -296,12 +296,24 @@ topic_action(topic_action_e action)
     case(HELP_STATS_IO_GRAPH_DIALOG):
         help_topic_html("ChStatIOGraphs.html");
         break;
+    case(HELP_STATS_COMPARE_FILES_DIALOG):
+        help_topic_html("ChStatCompareCaptureFiles.html");
+        break;
+    case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
+        help_topic_html("ChTelLTEMACTraffic.html");
+        break;
+    case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
+        help_topic_html("ChTelLTERLCTraffic.html");
+        break;
     case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
         help_topic_html("ChStatWLANTraffic.html");
         break;
     case(HELP_FILESET_DIALOG):
         help_topic_html("ChIOFileSetSection.html");
         break;
+    case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
+        help_topic_html("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
+        break;
     case(HELP_CAPTURE_INTERFACES_DETAILS_DIALOG):
         help_topic_html("ChCapInterfaceDetailsSection.html");
         break;
@@ -317,8 +329,8 @@ topic_action(topic_action_e action)
         help_topic_html("ChIOExportSection.html#ChIOExportSelectedDialog");
         break;
     case(HELP_EXPORT_OBJECT_LIST):
-       help_topic_html("ChIOExportSection.html#ChIOExportObjectsDialog");
-       break;
+        help_topic_html("ChIOExportSection.html#ChIOExportObjectsDialog");
+        break;
     case(HELP_OPEN_DIALOG):
     case(HELP_OPEN_WIN32_DIALOG):
         help_topic_html("ChIOOpenSection.html");
@@ -327,10 +339,16 @@ topic_action(topic_action_e action)
     case(HELP_MERGE_WIN32_DIALOG):
         help_topic_html("ChIOMergeSection.html");
         break;
+    case(HELP_IMPORT_DIALOG):
+        help_topic_html("ChIOImportSection.html");
+        break;
     case(HELP_SAVE_DIALOG):
     case(HELP_SAVE_WIN32_DIALOG):
         help_topic_html("ChIOSaveSection.html");
         break;
+    case(HELP_TIME_SHIFT_DIALOG):
+        help_topic_html("ChWorkShiftTimePacketSection.html");
+        break;
 
     default:
         g_assert_not_reached();
@@ -344,8 +362,11 @@ topic_cb(GtkWidget *w _U_, topic_action_e action)
     topic_action(action);
 }
 
-void
-topic_menu_cb(GtkWidget *w _U_, gpointer data _U_, topic_action_e action) {
-    topic_action(action);
+
+gboolean
+topic_menu_cb(GtkWidget *w _U_, GdkEventButton *event _U_, gpointer user_data)
+{
+    topic_action((topic_action_e)GPOINTER_TO_INT(user_data));
+    return TRUE;
 }