#include "gtk/main.h"
#include "gtk/main_airpcap_toolbar.h"
#include "gtk/main_filter_toolbar.h"
-#include "gtk/main_menu.h"
+#include "gtk/menus.h"
#include "gtk/main_packet_list.h"
#include "gtk/main_statusbar.h"
#include "gtk/main_statusbar_private.h"
#include "airpcap_loader.h"
#include "airpcap_dlg.h"
#include "airpcap_gui_utils.h"
-
-#include "./image/toolbar/wep_closed_24.xpm"
#endif
#ifdef HAVE_AIRPDCAP
}
static gchar *
-get_text_from_packet_list(gpointer data)
+get_filter_from_packet_list_row_and_column(gpointer data)
{
gint row = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(data), E_MPACKET_LIST_ROW_KEY));
gint column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(data), E_MPACKET_LIST_COL_KEY));
{
match_selected_cb_do(data,
action,
- get_text_from_packet_list(data));
+ get_filter_from_packet_list_row_and_column(data));
}
/* This function allows users to right click in the details window and copy the text
* fails we display a message to the user to indicate the copy could not be completed.
*/
void
-copy_selected_plist_cb(GtkWidget *w _U_, gpointer data _U_)
+copy_selected_plist_cb(GtkWidget *w _U_, gpointer data _U_, COPY_SELECTED_E action)
{
GString *gtk_text_str = g_string_new("");
char labelstring[256];
char *stringpointer = labelstring;
- if (cfile.finfo_selected->rep->representation != 0) {
- g_string_append(gtk_text_str, cfile.finfo_selected->rep->representation); /* Get the represented data */
+ switch(action)
+ {
+ case COPY_SELECTED_DESCRIPTION:
+ if (cfile.finfo_selected->rep->representation != 0) {
+ g_string_append(gtk_text_str, cfile.finfo_selected->rep->representation);
+ }
+ break;
+ case COPY_SELECTED_FIELDNAME:
+ if (cfile.finfo_selected->hfinfo->abbrev != 0) {
+ g_string_append(gtk_text_str, cfile.finfo_selected->hfinfo->abbrev);
+ }
+ break;
+ case COPY_SELECTED_VALUE:
+ if (cfile.edt !=0 ) {
+ g_string_append(gtk_text_str,
+ get_node_field_value(cfile.finfo_selected, cfile.edt));
+ }
+ break;
+ default:
+ break;
}
- if (gtk_text_str->len == 0) { /* If no representation then... */
- proto_item_fill_label(cfile.finfo_selected, stringpointer); /* Try to read the value */
+
+ if (gtk_text_str->len == 0) {
+ /* If no representation then... Try to read the value */
+ proto_item_fill_label(cfile.finfo_selected, stringpointer);
g_string_append(gtk_text_str, stringpointer);
}
- if (gtk_text_str->len == 0) { /* Could not get item so display error msg */
+
+ if (gtk_text_str->len == 0) {
+ /* Could not get item so display error msg */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to copy, try expanding or choosing another item");
- }
- else
- {
- copy_to_clipboard(gtk_text_str); /* Copy string to clipboard */
+ } else {
+ /* Copy string to clipboard */
+ copy_to_clipboard(gtk_text_str);
}
g_string_free(gtk_text_str, TRUE); /* Free the memory */
}
if (finfo->hfinfo->blurb != NULL &&
finfo->hfinfo->blurb[0] != '\0') {
has_blurb = TRUE;
- length = strlen(finfo->hfinfo->blurb);
+ length = (guint) strlen(finfo->hfinfo->blurb);
} else {
- length = strlen(finfo->hfinfo->name);
+ length = (guint) strlen(finfo->hfinfo->name);
}
finfo_length = finfo->length + finfo->appendix_length;
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
gtk_window_present(GTK_WINDOW(top_level));
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL,
"%sSave capture file before program quit?%s\n\n"
"If you quit the program without saving, your capture data will be discarded.",
simple_dialog_primary_start(), simple_dialog_primary_end());
/* save file first */
file_save_as_cmd(after_save_exit, NULL);
break;
- case(ESD_BTN_DONT_SAVE):
+ case(ESD_BTN_QUIT_DONT_SAVE):
main_do_quit();
break;
case(ESD_BTN_CANCEL):
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL,
"%sSave capture file before program quit?%s\n\n"
"If you quit the program without saving, your capture data will be discarded.",
simple_dialog_primary_start(), simple_dialog_primary_end());
{
/* if we have more than 10000 packets, show a splash screen while closing */
- /* XXX - don't know a better way to decide wether to show or not,
+ /* XXX - don't know a better way to decide whether to show or not,
* as most of the time is spend in a single eth_clist_clear function,
* so we can't use a progress bar here! */
if(cf->count > 10000) {
extern char *optarg;
gboolean arg_error = FALSE;
+ extern int splash_register_freq; /* Found in about_dlg.c */
+ const gchar *filter;
+
#ifdef _WIN32
WSADATA wsaData;
#endif /* _WIN32 */
int status;
gchar *cur_user, *cur_group;
+#ifdef _WIN32
#ifdef HAVE_AIRPCAP
char *err_str;
#endif
+#endif
#define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:kK:lLm:nN:o:P:pQr:R:Ss:t:vw:X:y:z:"
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0]);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
/* initialize the funnel mini-api */
initialize_funnel_ops();
/* Initialize whatever we need to allocate colors for GTK+ */
colors_init();
+ /* Non-blank filter means we're remote. Throttle splash screen updates. */
+ filter = get_conn_cfilter();
+ if ( *filter != '\0' )
+ splash_register_freq = 1000; /* Milliseconds */
+
/* We won't come till here, if we had a "console only" command line parameter. */
splash_win = splash_new("Loading Wireshark ...");
if (init_progfile_dir_error != NULL) {
tap_update_timer_id = g_timeout_add(prefs->tap_update_interval, update_cb, NULL);
#endif /* !_WIN32 && G_THREADS_ENABLED && USE_THREADS */
-#if HAVE_GNU_ADNS
+#if HAVE_GNU_ADNS || HAVE_C_ARES
g_timeout_add(750, host_name_lookup_process, NULL);
#endif
case CF_READ_ABORTED:
/* Exit now. */
- gtk_exit(0);
+ exit(0);
break;
}
/* Save the name of the containing directory specified in the
destroy_console();
#endif
- gtk_exit(0);
-
- /* This isn't reached, but we need it to keep GCC from complaining
- that "main()" returns without returning a value - it knows that
- "exit()" never returns, but it doesn't know that "gtk_exit()"
- doesn't, as GTK+ doesn't declare it with the attribute
- "noreturn". */
- return 0; /* not reached */
+ exit(0);
}
#ifdef _WIN32
gtk_widget_hide(main_vbox);
/* be sure we don't lose a widget while rearranging */
- gtk_widget_ref(menubar);
- gtk_widget_ref(main_tb);
- gtk_widget_ref(filter_tb);
+ g_object_ref(G_OBJECT(menubar));
+ g_object_ref(G_OBJECT(main_tb));
+ g_object_ref(G_OBJECT(filter_tb));
#ifdef HAVE_AIRPCAP
- gtk_widget_ref(airpcap_tb);
-#endif
- gtk_widget_ref(pkt_scrollw);
- gtk_widget_ref(tv_scrollw);
- gtk_widget_ref(byte_nb_ptr);
- gtk_widget_ref(statusbar);
- gtk_widget_ref(main_pane_v1);
- gtk_widget_ref(main_pane_v2);
- gtk_widget_ref(main_pane_h1);
- gtk_widget_ref(main_pane_h2);
- gtk_widget_ref(welcome_pane);
+ g_object_ref(G_OBJECT(airpcap_tb));
+#endif
+ g_object_ref(G_OBJECT(pkt_scrollw));
+ g_object_ref(G_OBJECT(tv_scrollw));
+ g_object_ref(G_OBJECT(byte_nb_ptr));
+ g_object_ref(G_OBJECT(statusbar));
+ g_object_ref(G_OBJECT(main_pane_v1));
+ g_object_ref(G_OBJECT(main_pane_v2));
+ g_object_ref(G_OBJECT(main_pane_h1));
+ g_object_ref(G_OBJECT(main_pane_h2));
+ g_object_ref(G_OBJECT(welcome_pane));
/* empty all containers participating */
gtk_container_foreach(GTK_CONTAINER(main_vbox), foreach_remove_a_child, main_vbox);
/* Set promiscuous mode from the preferences setting. */
/* the same applies to other preferences settings as well. */
global_capture_opts.promisc_mode = prefs.capture_prom_mode;
+ global_capture_opts.use_pcapng = prefs.capture_pcap_ng;
global_capture_opts.show_info = prefs.capture_show_info;
global_capture_opts.real_time_mode = prefs.capture_real_time;
auto_scroll_live = prefs.capture_auto_scroll;
/* Reset current preferences and apply the new */
prefs_reset();
+ menu_prefs_reset();
+
(void) read_configuration_files (&gdp_path, &dp_path);
recent_read_profile_static(&rf_path, &rf_open_errno);
/* Recreate the packet list according to new preferences */
packet_list_recreate ();
- status_expert_update();
cfile.cinfo.columns_changed = FALSE; /* Reset value */
user_font_apply();
}
+
+/** redissect packets and update UI */
+void redissect_packets(void)
+{
+ cf_redissect_packets(&cfile);
+ status_expert_update();
+}