summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--capture.c4
-rw-r--r--epan/proto.c53
-rw-r--r--epan/proto.h12
-rw-r--r--file.c74
-rw-r--r--file.h9
-rw-r--r--globals.h6
-rw-r--r--gtk/file_dlg.c7
-rw-r--r--gtk/gtkglobals.h8
-rw-r--r--gtk/main.c82
-rw-r--r--gtk/menu.c16
-rw-r--r--gtk/proto_draw.c35
-rw-r--r--gtk/proto_draw.h9
-rw-r--r--menu.h8
-rw-r--r--statusbar.h56
-rw-r--r--tethereal.c5
16 files changed, 272 insertions, 115 deletions
diff --git a/Makefile.am b/Makefile.am
index 56d3dcc217..f2b3de054f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.330 2001/06/02 06:21:12 guy Exp $
+# $Id: Makefile.am,v 1.331 2001/06/05 07:39:31 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@@ -400,6 +400,7 @@ ethereal_SOURCES = \
proto_hier_stats.h \
proto_hier_stats.c \
simple_dialog.h \
+ statusbar.h \
summary.c \
summary.h \
ui_util.h
diff --git a/capture.c b/capture.c
index 0e2768d93c..9453fbbc57 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.150 2001/06/02 06:26:52 guy Exp $
+ * $Id: capture.c,v 1.151 2001/06/05 07:38:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -299,7 +299,7 @@ do_capture(char *capfile_name)
}
return;
}
- close_cap_file(&cfile, info_bar);
+ close_cap_file(&cfile);
g_assert(cfile.save_file == NULL);
cfile.save_file = capfile_name;
diff --git a/epan/proto.c b/epan/proto.c
index 2c6915d6bc..f6d5f1464c 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1,12 +1,11 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.28 2001/05/31 07:15:23 guy Exp $
+ * $Id: proto.c,v 1.29 2001/06/05 07:38:35 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -2832,6 +2831,54 @@ hfinfo_numeric_format(header_field_info *hfinfo)
return format;
}
+/*
+ * Returns TRUE if we can do a "match selected" on the field, FALSE
+ * otherwise.
+ */
+gboolean
+proto_can_match_selected(field_info *finfo)
+{
+ header_field_info *hfinfo;
+
+ hfinfo = finfo->hfinfo;
+ g_assert(hfinfo);
+
+ switch(hfinfo->type) {
+
+ case FT_BOOLEAN:
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ case FT_IPv4:
+ case FT_IPXNET:
+ case FT_IPv6:
+ case FT_DOUBLE:
+ case FT_ETHER:
+ case FT_ABSOLUTE_TIME:
+ case FT_RELATIVE_TIME:
+ case FT_STRING:
+ case FT_BYTES:
+ /*
+ * These all have values, so we can match.
+ */
+ return TRUE;
+
+ default:
+ /*
+ * This doesn't have a value, so we'd match
+ * on the raw bytes at this address;
+ * however, if the length is 0, there's nothing
+ * to match, so we can't match.
+ */
+ return (finfo->length != 0);
+ }
+}
+
char*
proto_alloc_dfilter_string(field_info *finfo, guint8 *pd)
{
diff --git a/epan/proto.h b/epan/proto.h
index 5bf1b2c5d9..e3be5efb61 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -1,12 +1,11 @@
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.11 2001/04/02 00:38:34 hagbard Exp $
+ * $Id: proto.h,v 1.12 2001/06/05 07:38:35 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -559,6 +558,13 @@ extern int num_tree_types;
int
hfinfo_bitwidth(header_field_info *hfinfo);
+/*
+ * Returns TRUE if we can do a "match selected" on the field, FALSE
+ * otherwise.
+ */
+gboolean
+proto_can_match_selected(field_info *finfo);
+
char*
proto_alloc_dfilter_string(field_info *finfo, guint8 *pd);
diff --git a/file.c b/file.c
index 9e506d8d5e..83397b236f 100644
--- a/file.c
+++ b/file.c
@@ -1,12 +1,11 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.237 2001/05/27 21:33:16 guy Exp $
+ * $Id: file.c,v 1.238 2001/06/05 07:38:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -83,6 +82,7 @@
#include "simple_dialog.h"
#include "progress_dlg.h"
#include "ui_util.h"
+#include "statusbar.h"
#include "prefs.h"
#include "gtk/proto_draw.h"
#include "gtk/packet_win.h"
@@ -91,8 +91,7 @@
#include "globals.h"
#include "gtk/colors.h"
-extern GtkWidget *packet_list, *info_bar, *byte_nb_ptr, *tree_view;
-extern guint file_ctx;
+extern GtkWidget *packet_list, *byte_nb_ptr, *tree_view;
static guint32 firstsec, firstusec;
static guint32 prevsec, prevusec;
@@ -142,7 +141,7 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
/* The open succeeded. Close whatever capture file we had open,
and fill in the information for this file. */
- close_cap_file(cf, info_bar);
+ close_cap_file(cf);
/* Initialize the table of conversations. */
epan_conversation_init();
@@ -196,7 +195,7 @@ fail:
/* Reset everything to a pristine state */
void
-close_cap_file(capture_file *cf, void *w)
+close_cap_file(capture_file *cf)
{
/* Die if we're in the middle of reading a file. */
g_assert(cf->state != FILE_READ_IN_PROGRESS);
@@ -242,7 +241,7 @@ close_cap_file(capture_file *cf, void *w)
/* Clear any file-related status bar messages.
XXX - should be "clear *ALL* file-related status bar messages;
will there ever be more than one on the stack? */
- gtk_statusbar_pop(GTK_STATUSBAR(w), file_ctx);
+ statusbar_pop_file_msg();
/* Restore the standard title bar message. */
set_main_window_name("The Ethereal Network Analyzer");
@@ -291,7 +290,7 @@ set_display_filename(capture_file *cf)
done_msg = g_malloc(msg_len);
snprintf(done_msg, msg_len, done_fmt_nodrops, name_ptr);
}
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, done_msg);
+ statusbar_push_file_msg(done_msg);
g_free(done_msg);
msg_len = strlen(name_ptr) + strlen(win_name_fmt) + 1;
@@ -320,7 +319,7 @@ read_cap_file(capture_file *cf, int *err)
msg_len = strlen(name_ptr) + strlen(load_fmt) + 2;
load_msg = g_malloc(msg_len);
snprintf(load_msg, msg_len, load_fmt, name_ptr);
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, load_msg);
+ statusbar_push_file_msg(load_msg);
/* Update the progress bar when it gets to this value. */
cf->progbar_nextstep = 0;
@@ -358,7 +357,7 @@ read_cap_file(capture_file *cf, int *err)
destroy_progress_dlg(progbar);
cf->state = FILE_READ_ABORTED; /* so that we're allowed to close it */
gtk_clist_thaw(GTK_CLIST(packet_list)); /* undo our freeze */
- close_cap_file(cf, info_bar);
+ close_cap_file(cf);
return (READ_ABORTED);
}
read_packet(cf, data_offset);
@@ -382,7 +381,7 @@ read_cap_file(capture_file *cf, int *err)
cf->current_frame = cf->first_displayed;
thaw_clist(cf);
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
+ statusbar_pop_file_msg();
set_display_filename(cf);
/* Enable menu items that make sense if you have a capture file you've
@@ -464,8 +463,7 @@ start_tail_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
}
}
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx,
- " <live capture in progress>");
+ statusbar_push_file_msg(" <live capture in progress>");
}
return err;
}
@@ -534,7 +532,7 @@ finish_tail_cap_file(capture_file *cf, int *err)
it's probably exited), so we can just close the capture
file; we return READ_ABORTED so our caller can do whatever
is appropriate when that happens. */
- close_cap_file(cf, info_bar);
+ close_cap_file(cf);
return READ_ABORTED;
}
@@ -559,7 +557,7 @@ finish_tail_cap_file(capture_file *cf, int *err)
cf->lnk_t = wtap_file_encap(cf->wth);
/* Pop the "<live capture in progress>" message off the status bar. */
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
+ statusbar_pop_file_msg();
set_display_filename(cf);
@@ -1368,34 +1366,6 @@ change_time_formats(capture_file *cf)
thaw_clist(cf);
}
-static void
-clear_tree_and_hex_views(void)
-{
- /* Clear the hex dump. */
-
- GtkWidget *byte_view;
- int i;
-
-/* Get the current tab scroll window, then get the text widget */
-/* from the E_BYTE_VIEW_TEXT_INFO_KEY data field */
-
- i = gtk_notebook_get_current_page( GTK_NOTEBOOK(byte_nb_ptr));
-
- if ( i >= 0){
- byte_view = gtk_notebook_get_nth_page( GTK_NOTEBOOK(byte_nb_ptr), i);
- byte_view = gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_TEXT_INFO_KEY);
-
- gtk_text_freeze(GTK_TEXT(byte_view));
- gtk_text_set_point(GTK_TEXT(byte_view), 0);
- gtk_text_forward_delete(GTK_TEXT(byte_view),
- gtk_text_get_length(GTK_TEXT(byte_view)));
- gtk_text_thaw(GTK_TEXT(byte_view));
- }
- /* Remove all nodes in ctree. This is how it's done in testgtk.c in GTK+ */
- gtk_clist_clear ( GTK_CLIST(tree_view) );
-
-}
-
gboolean
find_packet(capture_file *cf, dfilter_t *sfcode)
{
@@ -1624,13 +1594,14 @@ unselect_packet(capture_file *cf)
cf->edt = NULL;
}
- finfo_selected = NULL;
-
/* Clear out the display of that packet. */
clear_tree_and_hex_views();
/* No packet is selected. */
set_menus_for_selected_packet(FALSE);
+
+ /* No protocol tree means no selected field. */
+ unselect_field();
}
/* Set the selected row and the focus row of the packet list to the specified
@@ -1654,6 +1625,15 @@ set_selected_row(int row)
gtk_clist_select_row(GTK_CLIST(packet_list), row, -1);
}
+/* Unset the selected protocol tree field, if any. */
+void
+unselect_field(void)
+{
+ statusbar_pop_field_msg();
+ finfo_selected = NULL;
+ set_menus_for_selected_tree_row(FALSE);
+}
+
static void
freeze_clist(capture_file *cf)
{
@@ -1711,7 +1691,7 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered, gboolean sa
msg_len = strlen(name_ptr) + strlen(save_fmt) + 2;
save_msg = g_malloc(msg_len);
snprintf(save_msg, msg_len, save_fmt, name_ptr);
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, save_msg);
+ statusbar_push_file_msg(save_msg);
g_free(save_msg);
if (!save_filtered && !save_marked && save_format == cf->cd_t) {
@@ -1823,7 +1803,7 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered, gboolean sa
done:
/* Pop the "Saving:" message off the status bar. */
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
+ statusbar_pop_file_msg();
if (err == 0) {
if (!save_filtered && !save_marked) {
/* We saved the entire capture, not just some packets from it.
diff --git a/file.h b/file.h
index 3429dfae83..ea3e1bd0f1 100644
--- a/file.h
+++ b/file.h
@@ -1,12 +1,11 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.82 2001/04/18 05:45:57 guy Exp $
+ * $Id: file.h,v 1.83 2001/06/05 07:38:33 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -111,7 +110,7 @@ typedef enum {
} read_status_t;
int open_cap_file(char *, gboolean, capture_file *);
-void close_cap_file(capture_file *, void *);
+void close_cap_file(capture_file *);
read_status_t read_cap_file(capture_file *, int *);
int start_tail_cap_file(char *, gboolean, capture_file *);
read_status_t continue_tail_cap_file(capture_file *, int, int *);
@@ -136,6 +135,8 @@ goto_result_t goto_frame(capture_file *cf, guint fnumber);
void select_packet(capture_file *, int);
void unselect_packet(capture_file *);
+void unselect_field(void);
+
/* Moves or copies a file. Returns 0 on failure, 1 on success */
int file_mv(char *from, char *to);
diff --git a/globals.h b/globals.h
index b9fd5be655..5bb3dd4ba9 100644
--- a/globals.h
+++ b/globals.h
@@ -1,12 +1,11 @@
/* globals.h
* Global defines, etc.
*
- * $Id: globals.h,v 1.25 2001/05/01 00:18:46 guy Exp $
+ * $Id: globals.h,v 1.26 2001/06/05 07:38:33 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,7 +32,6 @@
#define MIN_PACKET_SIZE 68 /* minimum amount of packet data we can read */
extern capture_file cfile;
-extern guint main_ctx, file_ctx;
extern gchar *ethereal_path;
extern gchar *last_open_dir;
extern field_info *finfo_selected;
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index d2d3906480..8f89941b0a 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -1,12 +1,11 @@
/* file_dlg.c
* Dialog boxes for handling files
*
- * $Id: file_dlg.c,v 1.39 2001/05/31 08:36:46 guy Exp $
+ * $Id: file_dlg.c,v 1.40 2001/06/05 07:38:37 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -282,7 +281,7 @@ file_open_destroy_cb(GtkWidget *win, gpointer user_data)
/* Close a file */
void
file_close_cmd_cb(GtkWidget *widget, gpointer data) {
- close_cap_file(&cfile, info_bar);
+ close_cap_file(&cfile);
}
void
diff --git a/gtk/gtkglobals.h b/gtk/gtkglobals.h
index f9d4bed5fa..947be5e19b 100644
--- a/gtk/gtkglobals.h
+++ b/gtk/gtkglobals.h
@@ -1,12 +1,11 @@
/* gtkglobals.h
* GTK-related Global defines, etc.
*
- * $Id: gtkglobals.h,v 1.15 2001/04/25 06:33:41 guy Exp $
+ * $Id: gtkglobals.h,v 1.16 2001/06/05 07:38:37 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -30,8 +29,7 @@
#include <gtk/gtk.h>
#endif
-extern GtkWidget *top_level, *packet_list, *tree_view,
- *byte_nb_ptr, *info_bar;
+extern GtkWidget *top_level, *packet_list, *tree_view, *byte_nb_ptr;
extern GdkFont *m_r_font, *m_b_font;
extern guint m_font_height, m_font_width;
diff --git a/gtk/main.c b/gtk/main.c
index 774ad399bb..230f4b441f 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.199 2001/05/31 08:36:46 guy Exp $
+ * $Id: main.c,v 1.200 2001/06/05 07:38:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -126,6 +126,7 @@
#include "print.h"
#include "resolv.h"
#include "util.h"
+#include "statusbar.h"
#include "simple_dialog.h"
#include "proto_draw.h"
#include "dfilter/dfilter.h"
@@ -146,11 +147,11 @@
packet_info pi;
capture_file cfile;
GtkWidget *top_level, *packet_list, *tree_view, *byte_nb_ptr,
- *info_bar, *tv_scrollw, *pkt_scrollw;
-static GtkWidget *bv_scrollw;
+ *tv_scrollw, *pkt_scrollw;
+static GtkWidget *info_bar, *bv_scrollw;
GdkFont *m_r_font, *m_b_font;
guint m_font_height, m_font_width;
-guint main_ctx, file_ctx, help_ctx;
+static guint main_ctx, file_ctx, help_ctx;
static GString *comp_info_str;
gchar *ethereal_path = NULL;
gchar *last_open_dir = NULL;
@@ -211,14 +212,6 @@ match_selected_cb(GtkWidget *w, gpointer data)
filter_te = gtk_object_get_data(GTK_OBJECT(w), E_DFILTER_TE_KEY);
- if (!finfo_selected) {
- simple_dialog(ESD_TYPE_CRIT, NULL,
- "Error determining selected bytes. Please make\n"
- "sure you have selected a field within the tree\n"
- "view to be matched.");
- return;
- }
-
buf = proto_alloc_dfilter_string(finfo_selected, cfile.pd);
/* create a new one and set the display filter entry accordingly */
@@ -463,7 +456,6 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
g_assert(byte_data);
finfo_selected = finfo;
-
set_menus_for_selected_tree_row(TRUE);
if (finfo->hfinfo) {
@@ -474,13 +466,14 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
} else {
length = strlen(finfo->hfinfo->name);
}
+ statusbar_pop_field_msg(); /* get rid of current help msg */
if (length) {
length += strlen(finfo->hfinfo->abbrev) + 10;
help_str = g_malloc(sizeof(gchar) * length);
sprintf(help_str, "%s (%s)",
(has_blurb) ? finfo->hfinfo->blurb : finfo->hfinfo->name,
finfo->hfinfo->abbrev);
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), help_ctx, help_str);
+ statusbar_push_field_msg(help_str);
g_free(help_str);
} else {
/*
@@ -489,6 +482,9 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
* a field, and we don't want "Text (text)" showing up
* on the status line if you've selected such a field.
*
+ * XXX - there are zero-length fields for which we *do*
+ * want to show the field name.
+ *
* XXX - perhaps the name and abbrev field should be null
* pointers rather than null strings for that pseudo-field,
* but we'd have to add checks for null pointers in some
@@ -499,7 +495,7 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
* with no pseudo-field being used, but that might also
* require special checks for -1 to be added.
*/
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), help_ctx, "");
+ statusbar_push_field_msg("");
}
}
@@ -513,16 +509,16 @@ tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer us
GtkWidget *byte_view;
guint8 *data;
gint len;
- field_info* fi;
-
- fi = (field_info*)user_data;
+ /*
+ * Which byte view is displaying the current protocol tree
+ * row's data?
+ */
len = get_byte_view_and_data( byte_nb_ptr, &byte_view, &data);
+ if ( len < 0)
+ return; /* none */
- if ( len < 0) return;
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), help_ctx);
- finfo_selected = NULL;
- set_menus_for_selected_tree_row(FALSE);
+ unselect_field();
packet_hex_print(GTK_TEXT(byte_view), data, cfile.current_frame,
NULL, len);
}
@@ -663,6 +659,46 @@ set_plist_font(GdkFont *font)
}
}
+/*
+ * Push a message referring to file access onto the statusbar.
+ */
+void
+statusbar_push_file_msg(gchar *msg)
+{
+ gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, msg);
+}
+
+/*
+ * Pop a message referring to file access off the statusbar.
+ */
+void
+statusbar_pop_file_msg(void)
+{
+ gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
+}
+
+/*
+ * XXX - do we need multiple statusbar contexts?
+ */
+
+/*
+ * Push a message referring to the currently-selected field onto the statusbar.
+ */
+void
+statusbar_push_field_msg(gchar *msg)
+{
+ gtk_statusbar_push(GTK_STATUSBAR(info_bar), help_ctx, msg);
+}
+
+/*
+ * Pop a message referring to the currently-selected field off the statusbar.
+ */
+void
+statusbar_pop_field_msg(void)
+{
+ gtk_statusbar_pop(GTK_STATUSBAR(info_bar), help_ctx);
+}
+
static gboolean
main_window_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
{
@@ -716,7 +752,7 @@ file_quit_cmd_cb (GtkWidget *widget, gpointer data)
which we'd call here, and another routine that
calls that routine and also cleans up the UI, which
we'd call elsewhere? */
- close_cap_file(&cfile, info_bar);
+ close_cap_file(&cfile);
/* Exit by leaving the main loop, so that any quit functions
we registered get called. */
diff --git a/gtk/menu.c b/gtk/menu.c
index 183a84496c..793abf184e 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -1,12 +1,11 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.52 2001/04/15 03:37:16 guy Exp $
+ * $Id: menu.c,v 1.53 2001/06/05 07:38:37 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -378,7 +377,6 @@ set_menus_for_captured_packets(gboolean have_captured_packets)
set_menu_sensitivity("/File/Print...", have_captured_packets);
set_menu_sensitivity("/Edit/Find Frame...", have_captured_packets);
set_menu_sensitivity("/Edit/Go To Frame...", have_captured_packets);
- set_menu_sensitivity("/Display/Match Selected", have_captured_packets);
set_menu_sensitivity("/Display/Colorize Display...", have_captured_packets);
set_menu_sensitivity("/Tools/Summary", have_captured_packets);
set_menu_sensitivity("/Tools/Protocol Hierarchy Statistics", have_captured_packets);
@@ -403,11 +401,13 @@ set_menus_for_selected_packet(gboolean have_selected_packet)
have_selected_packet && !prefs.name_resolve);
}
-/* Enable or disable menu items based on whether a tree row is selected. */
+/* Enable or disable menu items based on whether a tree row is selected
+ and and on whether a "Match Selected" can be done. */
void
set_menus_for_selected_tree_row(gboolean have_selected_tree)
{
gboolean properties = FALSE;
+
if (finfo_selected) {
header_field_info *hfinfo = finfo_selected->hfinfo;
if (hfinfo->parent == -1) {
@@ -415,6 +415,10 @@ set_menus_for_selected_tree_row(gboolean have_selected_tree)
} else {
properties = prefs_is_registered_protocol(proto_registrar_get_abbrev(hfinfo->parent));
}
- }
+ set_menu_sensitivity("/Display/Match Selected",
+ proto_can_match_selected(finfo_selected));
+ } else
+ set_menu_sensitivity("/Display/Match Selected", FALSE);
+
set_menu_sensitivity("/Protocol Properties...", have_selected_tree && properties);
}
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index d5637dbeb0..5c153d6b88 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1,10 +1,10 @@
/* proto_draw.c
* Routines for GTK+ packet display
*
- * $Id: proto_draw.c,v 1.34 2001/05/27 07:50:28 guy Exp $
+ * $Id: proto_draw.c,v 1.35 2001/06/05 07:38:37 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* Jeff Foster, 2001/03/12, added support for displaying named
@@ -937,3 +937,34 @@ proto_tree_draw_node(GNode *node, gpointer data)
proto_tree_draw_node, &info);
}
}
+
+/*
+ * Clear the hex dump and protocol tree panes.
+ */
+void
+clear_tree_and_hex_views(void)
+{
+ /* Clear the hex dump. */
+
+ GtkWidget *byte_view;
+ int i;
+
+/* Get the current tab scroll window, then get the text widget */
+/* from the E_BYTE_VIEW_TEXT_INFO_KEY data field */
+
+ i = gtk_notebook_get_current_page( GTK_NOTEBOOK(byte_nb_ptr));
+
+ if ( i >= 0){
+ byte_view = gtk_notebook_get_nth_page( GTK_NOTEBOOK(byte_nb_ptr), i);
+ byte_view = gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_TEXT_INFO_KEY);
+
+ gtk_text_freeze(GTK_TEXT(byte_view));
+ gtk_text_set_point(GTK_TEXT(byte_view), 0);
+ gtk_text_forward_delete(GTK_TEXT(byte_view),
+ gtk_text_get_length(GTK_TEXT(byte_view)));
+ gtk_text_thaw(GTK_TEXT(byte_view));
+ }
+ /* Remove all nodes in ctree. This is how it's done in testgtk.c in GTK+ */
+ gtk_clist_clear ( GTK_CLIST(tree_view) );
+
+}
diff --git a/gtk/proto_draw.h b/gtk/proto_draw.h
index 371ca75627..efd3fd1696 100644
--- a/gtk/proto_draw.h
+++ b/gtk/proto_draw.h
@@ -1,12 +1,11 @@
-/* gtkpacket.h
+/* proto_draw.h
* Definitions for GTK+ packet display structures and routines
*
- * $Id: proto_draw.h,v 1.11 2001/03/23 14:44:04 jfoster Exp $
+ * $Id: proto_draw.h,v 1.12 2001/06/05 07:38:37 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -64,4 +63,6 @@ void set_ptree_line_style_all(gint style);
void set_ptree_expander_style_all(gint style);
void set_ptree_font_all(GdkFont *font);
+void clear_tree_and_hex_views(void);
+
#endif
diff --git a/menu.h b/menu.h
index b55454a7d6..83b756c25b 100644
--- a/menu.h
+++ b/menu.h
@@ -2,12 +2,11 @@
* Definitions for menu routines with toolkit-independent APIs but
* toolkit-dependent implementations.
*
- * $Id: menu.h,v 1.8 2000/08/15 20:42:09 deniel Exp $
+ * $Id: menu.h,v 1.9 2001/06/05 07:38:33 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -52,7 +51,8 @@ void set_menus_for_captured_packets(gboolean);
/* Enable or disable menu items based on whether a packet is selected. */
void set_menus_for_selected_packet(gboolean);
-/* Enable or disable menu items based on whether a tree row is selected. */
+/* Enable or disable menu items based on whether a tree row is selected
+ and and on whether a "Match Selected" can be done. */
void set_menus_for_selected_tree_row(gboolean);
#ifdef __cplusplus
diff --git a/statusbar.h b/statusbar.h
new file mode 100644
index 0000000000..a7b3b4903b
--- /dev/null
+++ b/statusbar.h
@@ -0,0 +1,56 @@
+/* statusbar.h
+ * Definitions for status bar UI routines
+ *
+ * $Id: statusbar.h,v 1.1 2001/06/05 07:39:31 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __STATUSBAR_H__
+#define __STATUSBAR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Push a message referring to file access onto the statusbar.
+ */
+void statusbar_push_file_msg(gchar *msg);
+
+/*
+ * Pop a message referring to file access off the statusbar.
+ */
+void statusbar_pop_file_msg(void);
+
+/*
+ * Push a message referring to the currently-selected field onto the statusbar.
+ */
+void statusbar_push_field_msg(gchar *msg);
+
+/*
+ * Pop a message referring to the currently-selected field off the statusbar.
+ */
+void statusbar_pop_field_msg(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __STATUSBAR_H__ */
diff --git a/tethereal.c b/tethereal.c
index 6a6fc71b7c..e4f9df5ba6 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,9 +1,9 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.83 2001/05/31 08:36:41 guy Exp $
+ * $Id: tethereal.c,v 1.84 2001/06/05 07:38:33 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* Text-mode variant, by Gilbert Ramirez <gram@xiexie.org>.
@@ -137,7 +137,6 @@ static void wtap_dispatch_cb_print(u_char *, const struct wtap_pkthdr *, int,
packet_info pi;
capture_file cfile;
FILE *data_out_file = NULL;
-guint main_ctx, file_ctx;
ts_type timestamp_type = RELATIVE;
#ifdef HAVE_LIBPCAP
static int promisc_mode = TRUE;