/* browse a file relative to the data dir */ void browser_open_data_file(const gchar *filename) { gchar *file_path; gchar *uri; /* build filename */ #ifdef G_OS_WIN32 if((strlen(filename) > 2) && (filename[1] == ':')) file_path = g_strdup(filename); #else /* XXX: is this correct for MacOS/Linux ? */ if((strlen(filename) > 1) && (filename[0] == '/')) file_path = g_strdup(filename); #endif else file_path = g_strdup_printf("%s/%s", get_datafile_dir(), filename); /* XXX - check, if the file is really existing, otherwise display a simple_dialog about the problem */ /* convert filename to uri */ uri = filename2uri(file_path); /* show the uri */ browser_open_url (uri); g_free(file_path); g_free(uri); }
void topic_action(topic_action_e action) { char *url; url = topic_action_url(action); if(url != NULL) { browser_open_url(url); g_free(url); } }
/* browse a file relative to the data dir */ void browser_open_data_file(const gchar *filename) { gchar *uri; /* XXX - check, if the file is really existing, otherwise display a simple_dialog about the problem */ uri = data_file_url(filename); /* show the uri */ browser_open_url (uri); g_free(uri); }
/* * 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; url = g_string_new(""); g_string_append_printf(url, "%s\\user-guide.chm::/wsug_chm/%s>Wireshark Help", get_datafile_dir(), topic); hw = HtmlHelpW(NULL, utf_8to16(url->str), HH_DISPLAY_TOPIC, 0); g_string_free(url, TRUE /* free_segment */); /* if the .chm file could be opened, stop here */ if(hw != NULL) { return; } #endif /* HHC_DIR */ url = g_string_new(""); #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); g_string_free(url, TRUE /* free_segment */); }
static void run (const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals) { static GimpParam values[2]; GimpPDBStatusType status; GError *error = NULL; *nreturn_vals = 1; *return_vals = values; status = GIMP_PDB_SUCCESS; INIT_I18N (); if (nparams == 1 && param[0].data.d_string != NULL && strlen (param[0].data.d_string)) { if (! browser_open_url (param[0].data.d_string, &error)) { status = GIMP_PDB_EXECUTION_ERROR; *nreturn_vals = 2; values[1].type = GIMP_PDB_STRING; values[1].data.d_string = error->message; } } else { status = GIMP_PDB_CALLING_ERROR; } values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; }
static void topic_action(topic_action_e action) { const char *online_url; /* pages online at www.wireshark.org */ online_url = topic_online_url(action); if(online_url != NULL) { browser_open_url (online_url); return; } switch(action) { /* local manual pages */ case(LOCALPAGE_MAN_WIRESHARK): browser_open_data_file("wireshark.html"); break; case(LOCALPAGE_MAN_WIRESHARK_FILTER): browser_open_data_file("wireshark-filter.html"); break; case(LOCALPAGE_MAN_TSHARK): browser_open_data_file("tshark.html"); break; case(LOCALPAGE_MAN_RAWSHARK): browser_open_data_file("rawshark.html"); break; case(LOCALPAGE_MAN_DUMPCAP): browser_open_data_file("dumpcap.html"); break; case(LOCALPAGE_MAN_MERGECAP): browser_open_data_file("mergecap.html"); break; case(LOCALPAGE_MAN_EDITCAP): browser_open_data_file("editcap.html"); break; case(LOCALPAGE_MAN_TEXT2PCAP): browser_open_data_file("text2pcap.html"); break; /* local help pages (User's Guide) */ case(HELP_CONTENT): help_topic_html( "index.html"); break; case(HELP_CAPTURE_OPTIONS_DIALOG): help_topic_html("ChCapCaptureOptions.html"); break; case(HELP_CAPTURE_FILTERS_DIALOG): help_topic_html("ChWorkDefineFilterSection.html"); break; case(HELP_DISPLAY_FILTERS_DIALOG): help_topic_html("ChWorkDefineFilterSection.html"); break; case(HELP_COLORING_RULES_DIALOG): help_topic_html("ChCustColorizationSection.html"); break; 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; case(HELP_FIND_DIALOG): help_topic_html("ChWorkFindPacketSection.html"); break; case(HELP_FIREWALL_DIALOG): help_topic_html("ChUseToolsMenuSection.html"); break; case(HELP_GOTO_DIALOG): help_topic_html("ChWorkGoToPacketSection.html"); break; case(HELP_CAPTURE_INTERFACES_DIALOG): help_topic_html("ChCapInterfaceSection.html"); break; case(HELP_CAPTURE_INFO_DIALOG): help_topic_html("ChCapRunningSection.html"); break; case(HELP_ENABLED_PROTOCOLS_DIALOG): help_topic_html("ChCustProtocolDissectionSection.html"); break; case(HELP_DECODE_AS_DIALOG): help_topic_html("ChCustProtocolDissectionSection.html"); break; case(HELP_DECODE_AS_SHOW_DIALOG): help_topic_html("ChCustProtocolDissectionSection.html"); break; case(HELP_FOLLOW_STREAM_DIALOG): help_topic_html("ChAdvFollowTCPSection.html"); break; case(HELP_EXPERT_INFO_DIALOG): help_topic_html("ChAdvExpert.html"); break; case(HELP_STATS_SUMMARY_DIALOG): help_topic_html("ChStatSummary.html"); break; case(HELP_STATS_PROTO_HIERARCHY_DIALOG): help_topic_html("ChStatHierarchy.html"); break; case(HELP_STATS_ENDPOINTS_DIALOG): help_topic_html("ChStatEndpoints.html"); break; case(HELP_STATS_CONVERSATIONS_DIALOG): help_topic_html("ChStatConversations.html"); break; 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("ChCustInterfaceOptionsSection.html"); break; case(HELP_CAPTURE_INTERFACES_DETAILS_DIALOG): help_topic_html("ChCapInterfaceDetailsSection.html"); break; case(HELP_PREFERENCES_DIALOG): help_topic_html("ChCustPreferencesSection.html"); break; case(HELP_EXPORT_FILE_DIALOG): case(HELP_EXPORT_FILE_WIN32_DIALOG): help_topic_html("ChIOExportSection.html"); break; case(HELP_EXPORT_BYTES_DIALOG): case(HELP_EXPORT_BYTES_WIN32_DIALOG): help_topic_html("ChIOExportSection.html#ChIOExportSelectedDialog"); break; case(HELP_EXPORT_OBJECT_LIST): help_topic_html("ChIOExportSection.html#ChIOExportObjectsDialog"); break; case(HELP_OPEN_DIALOG): case(HELP_OPEN_WIN32_DIALOG): help_topic_html("ChIOOpenSection.html"); break; case(HELP_MERGE_DIALOG): 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; default: g_assert_not_reached(); } }