aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-06-19 01:47:43 +0000
committerGuy Harris <guy@alum.mit.edu>1999-06-19 01:47:43 +0000
commitfe725bec8cb78d9fbcb1fb9133b1c3ad65e0e400 (patch)
tree8546db05c76a039ea004809afc132b29fee38bf8
parent88e94a01867460d7c9bb9fd124daf0e0ee118e7f (diff)
downloadwireshark-fe725bec8cb78d9fbcb1fb9133b1c3ad65e0e400.tar.gz
wireshark-fe725bec8cb78d9fbcb1fb9133b1c3ad65e0e400.tar.bz2
wireshark-fe725bec8cb78d9fbcb1fb9133b1c3ad65e0e400.zip
Update the column widths if we change the time stamp format from the
"Display/Options" dialog box. "get_column_width()" should check "timestamp_type" against ABSOLUTE, not against COL_ABS_TIME. Clean up the code to check the state of the time stamp radio buttons in the "Display/Options" dialog box. Check in "timestamp.h", which we failed to check in on the previous commit. svn path=/trunk/; revision=318
-rw-r--r--column.c4
-rw-r--r--display.c43
-rw-r--r--timestamp.h40
3 files changed, 73 insertions, 14 deletions
diff --git a/column.c b/column.c
index 6ed6b5d8a5..60b43cdce6 100644
--- a/column.c
+++ b/column.c
@@ -1,7 +1,7 @@
/* column.c
* Routines for handling column preferences
*
- * $Id: column.c,v 1.11 1999/06/19 01:14:49 guy Exp $
+ * $Id: column.c,v 1.12 1999/06/19 01:47:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -178,7 +178,7 @@ get_column_width(gint format, GdkFont *font) {
return (gdk_string_width(font, "0") * 7);
break;
case COL_CLS_TIME:
- if (timestamp_type == COL_ABS_TIME)
+ if (timestamp_type == ABSOLUTE)
return (gdk_string_width(font, "00:00:00.000000"));
else
return (gdk_string_width(font, "0000.000000"));
diff --git a/display.c b/display.c
index 5c45a76de4..1f9c9ac920 100644
--- a/display.c
+++ b/display.c
@@ -1,7 +1,7 @@
/* display.c
* Routines for packet display windows
*
- * $Id: display.c,v 1.1 1999/06/19 01:14:47 guy Exp $
+ * $Id: display.c,v 1.2 1999/06/19 01:47:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -60,11 +60,13 @@
#endif
#include "timestamp.h"
+#include "column.h"
#include "packet.h"
#include "file.h"
#include "display.h"
extern capture_file cf;
+extern GtkWidget *packet_list;
/* Display callback data keys */
#define E_DISPLAY_TIME_ABS_KEY "display_time_abs"
@@ -142,27 +144,44 @@ display_opt_cb(GtkWidget *w, gpointer d) {
static void
display_opt_ok_cb(GtkWidget *w, gpointer data) {
- GtkWidget *abs_rb, *rel_rb, *delta_rb;
+ GtkWidget *button;
+ GtkStyle *pl_style;
+ int i;
+ gint col_fmt;
#ifdef GTK_HAVE_FEATURES_1_1_0
data = w;
#endif
- abs_rb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data),
- E_DISPLAY_TIME_ABS_KEY);
- rel_rb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data),
- E_DISPLAY_TIME_REL_KEY);
- delta_rb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data),
- E_DISPLAY_TIME_DELTA_KEY);
-
- if (GTK_TOGGLE_BUTTON (abs_rb)->active)
+
+ button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data),
+ E_DISPLAY_TIME_ABS_KEY);
+ if (GTK_TOGGLE_BUTTON (button)->active)
timestamp_type = ABSOLUTE;
- if (GTK_TOGGLE_BUTTON (rel_rb)->active)
+
+ button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data),
+ E_DISPLAY_TIME_REL_KEY);
+ if (GTK_TOGGLE_BUTTON (button)->active)
timestamp_type = RELATIVE;
- if (GTK_TOGGLE_BUTTON (delta_rb)->active)
+
+ button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(data),
+ E_DISPLAY_TIME_DELTA_KEY);
+ if (GTK_TOGGLE_BUTTON (button)->active)
timestamp_type = DELTA;
gtk_widget_destroy(GTK_WIDGET(data));
+ /* Recompute the column widths; we may have changed the format of the
+ time stamp column. */
+ pl_style = gtk_widget_get_style(packet_list);
+ for (i = 0; i < cf.cinfo.num_cols; i++) {
+ col_fmt = get_column_format(i);
+ gtk_clist_set_column_width(GTK_CLIST(packet_list), i,
+ get_column_width(col_fmt, pl_style->font));
+ if (col_fmt == COL_NUMBER)
+ gtk_clist_set_column_justification(GTK_CLIST(packet_list), i,
+ GTK_JUSTIFY_RIGHT);
+ }
+
redisplay_packets(&cf);
}
diff --git a/timestamp.h b/timestamp.h
new file mode 100644
index 0000000000..4721d2759f
--- /dev/null
+++ b/timestamp.h
@@ -0,0 +1,40 @@
+/* timestamp.h
+ * Defines for packet timestamps
+ *
+ * $Id: timestamp.h,v 1.1 1999/06/19 01:47:43 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * 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 __TIMESTAMP_H__
+#define __TIMESTAMP_H__
+
+/*
+ * Type of time-stamp shown in the summary display.
+ */
+typedef enum {
+ RELATIVE,
+ ABSOLUTE,
+ DELTA
+} ts_type;
+
+extern ts_type timestamp_type;
+
+#endif /* timestamp.h */