aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-09-12 06:11:51 +0000
committerGuy Harris <guy@alum.mit.edu>1999-09-12 06:11:51 +0000
commit55dff94484c61dce121553db3e0b0a709b7fa89b (patch)
tree54d4019a09a818e5bb4040336fd2a36bd0e9a2f3 /gtk
parent0041a76bfcd5098595c7991001b09665a36943cd (diff)
Add summary-vs-detail radio buttons to the print dialog box; detail
prints the protocol tree, and summary prints the fields in the summary clist, with a header line at the beginning of the printout. Print only packets selected by the current packet filter. Just have "ARP" and "RARP" in the "Protocol" field for ARP packets; whether it's a request or a reply can be seen in the "Info" field. Add to the "Frame" section of the protocol tree the time between the current packet and the previous displayed packet, and the packet number. Have FT_RELATIVE_TIME fields be a "struct timeval", and display them as seconds and fractional seconds (we didn't have any fields of that type, and that type of time fits the delta time above). Add an FT_DOUBLE field type (although we don't yet have anything using it). svn path=/trunk/; revision=666
Diffstat (limited to 'gtk')
-rw-r--r--gtk/keys.h18
-rw-r--r--gtk/main.c12
-rw-r--r--gtk/print_dlg.c46
3 files changed, 45 insertions, 31 deletions
diff --git a/gtk/keys.h b/gtk/keys.h
index c28599b48b..514e602856 100644
--- a/gtk/keys.h
+++ b/gtk/keys.h
@@ -1,7 +1,7 @@
/* keys.h
* Key definitions for various objects
*
- * $Id: keys.h,v 1.2 1999/09/09 04:25:49 guy Exp $
+ * $Id: keys.h,v 1.3 1999/09/12 06:11:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -28,14 +28,14 @@
/* Keys for gtk_object_set_data */
-#define E_DFILTER_TE_KEY "display_filter_te"
-#define E_RFILTER_TE_KEY "read_filter_te"
-
-#define PRINT_CMD_LB_KEY "printer_command_label"
-#define PRINT_CMD_TE_KEY "printer_command_entry"
-#define PRINT_FILE_BT_KEY "printer_file_button"
-#define PRINT_FILE_TE_KEY "printer_file_entry"
-#define PRINT_DEST_RB_KEY "printer_destination_radio_button"
+#define E_DFILTER_TE_KEY "display_filter_te"
+#define E_RFILTER_TE_KEY "read_filter_te"
+#define PRINT_CMD_LB_KEY "printer_command_label"
+#define PRINT_CMD_TE_KEY "printer_command_entry"
+#define PRINT_FILE_BT_KEY "printer_file_button"
+#define PRINT_FILE_TE_KEY "printer_file_entry"
+#define PRINT_DEST_RB_KEY "printer_destination_radio_button"
+#define PRINT_SUMMARY_RB_KEY "printer_summary_radio_button"
#endif
diff --git a/gtk/main.c b/gtk/main.c
index 5ee848eeda..07af23a40d 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.3 1999/09/11 12:36:14 deniel Exp $
+ * $Id: main.c,v 1.4 1999/09/12 06:11:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -501,7 +501,6 @@ main(int argc, char *argv[])
dfilter *rfcode = NULL;
gboolean rfilter_parse_failed = FALSE;
e_prefs *prefs;
- gchar **col_title;
ethereal_path = argv[0];
@@ -553,8 +552,9 @@ main(int argc, char *argv[])
cf.cinfo.num_cols = prefs->num_cols;
cf.cinfo.col_fmt = (gint *) g_malloc(sizeof(gint) * cf.cinfo.num_cols);
cf.cinfo.fmt_matx = (gboolean **) g_malloc(sizeof(gboolean *) * cf.cinfo.num_cols);
- cf.cinfo.col_data = (gchar **) g_malloc(sizeof(gchar *) * cf.cinfo.num_cols);
cf.cinfo.col_width = (gint *) g_malloc(sizeof(gint) * cf.cinfo.num_cols);
+ cf.cinfo.col_title = (gchar **) g_malloc(sizeof(gchar *) * cf.cinfo.num_cols);
+ cf.cinfo.col_data = (gchar **) g_malloc(sizeof(gchar *) * cf.cinfo.num_cols);
/* Assemble the compile-time options */
snprintf(comp_info_str, 256,
@@ -695,11 +695,9 @@ main(int argc, char *argv[])
#endif
/* Build the column format array */
- col_title = (gchar **) g_malloc(sizeof(gchar *) * cf.cinfo.num_cols);
-
for (i = 0; i < cf.cinfo.num_cols; i++) {
cf.cinfo.col_fmt[i] = get_column_format(i);
- col_title[i] = g_strdup(get_column_title(i));
+ cf.cinfo.col_title[i] = g_strdup(get_column_title(i));
cf.cinfo.fmt_matx[i] = (gboolean *) g_malloc0(sizeof(gboolean) *
NUM_COL_FMTS);
get_column_format_matches(cf.cinfo.fmt_matx[i], cf.cinfo.col_fmt[i]);
@@ -761,7 +759,7 @@ main(int argc, char *argv[])
gtk_widget_show(l_pane);
/* Packet list */
- packet_list = gtk_clist_new_with_titles(cf.cinfo.num_cols, col_title);
+ packet_list = gtk_clist_new_with_titles(cf.cinfo.num_cols, cf.cinfo.col_title);
gtk_clist_column_titles_passive(GTK_CLIST(packet_list));
packet_sw = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(packet_sw);
diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c
index 468410a6a1..302653d94b 100644
--- a/gtk/print_dlg.c
+++ b/gtk/print_dlg.c
@@ -1,7 +1,7 @@
/* print_dlg.c
* Dialog boxes for printing
*
- * $Id: print_dlg.c,v 1.3 1999/09/09 04:25:49 guy Exp $
+ * $Id: print_dlg.c,v 1.4 1999/09/12 06:11:51 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -77,6 +77,8 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
GtkWidget *cmd_lb, *cmd_te;
GtkWidget *file_bt_hb, *file_bt, *file_te;
GSList *dest_grp;
+ GtkWidget *summary_rb, *detail_rb;
+ GSList *summary_grp;
GtkWidget *bbox, *ok_bt, *cancel_bt;
/* XXX - don't pop up one if there's already one open; instead,
@@ -188,6 +190,17 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
gtk_signal_connect(GTK_OBJECT(file_bt), "clicked",
GTK_SIGNAL_FUNC(print_file_cb), GTK_OBJECT(file_te));
+ /* "Print summary"/"Print detail" radio buttons */
+ summary_rb = gtk_radio_button_new_with_label(NULL, "Print summary");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(summary_rb), FALSE);
+ summary_grp = gtk_radio_button_group(GTK_RADIO_BUTTON(summary_rb));
+ gtk_container_add(GTK_CONTAINER(main_vb), summary_rb);
+ gtk_widget_show(summary_rb);
+ detail_rb = gtk_radio_button_new_with_label(summary_grp, "Print detail");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(detail_rb), TRUE);
+ gtk_container_add(GTK_CONTAINER(main_vb), detail_rb);
+ gtk_widget_show(detail_rb);
+
/* Button row: OK and Cancel buttons */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
@@ -199,6 +212,7 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_DEST_RB_KEY, dest_rb);
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_CMD_TE_KEY, cmd_te);
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_FILE_TE_KEY, file_te);
+ gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_SUMMARY_RB_KEY, summary_rb);
gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked",
GTK_SIGNAL_FUNC(print_ok_cb), GTK_OBJECT(print_w));
GTK_WIDGET_SET_FLAGS(ok_bt, GTK_CAN_DEFAULT);
@@ -284,38 +298,40 @@ static void
print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
{
GtkWidget *button;
- char *dest;
+ print_args_t print_args;
button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(ok_bt),
PRINT_DEST_RB_KEY);
- if (GTK_TOGGLE_BUTTON (button)->active)
- print_to_file = TRUE;
- else
- print_to_file = FALSE;
+ print_to_file = GTK_TOGGLE_BUTTON (button)->active;
+ print_args.to_file = print_to_file;
- if (print_to_file)
- dest = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(ok_bt),
+ if (print_args.to_file)
+ print_args.dest = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(ok_bt),
PRINT_FILE_TE_KEY))));
else
- dest = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(ok_bt),
+ print_args.dest = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(ok_bt),
PRINT_CMD_TE_KEY))));
+ button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(ok_bt),
+ PRINT_SUMMARY_RB_KEY);
+ print_args.print_summary = GTK_TOGGLE_BUTTON (button)->active;
+
gtk_widget_destroy(GTK_WIDGET(parent_w));
#if 0
display_opt_window_active = FALSE;
#endif
/* Now print the packets */
- if (!print_packets(&cf, print_to_file, dest)) {
- if (print_to_file)
+ if (!print_packets(&cf, &print_args)) {
+ if (print_args.to_file)
simple_dialog(ESD_TYPE_WARN, NULL,
- file_write_error_message(errno), dest);
+ file_write_error_message(errno), print_args.dest);
else
simple_dialog(ESD_TYPE_WARN, NULL, "Couldn't run print command %s.",
- prefs.pr_cmd);
+ print_args.dest);
}
- g_free(dest);
+ g_free(print_args.dest);
}
static void
@@ -365,7 +381,7 @@ file_print_packet_cmd_cb(GtkWidget *widget, gpointer data) {
}
print_preamble(fh);
- proto_tree_print(-1, (GNode*) cf.protocol_tree, cf.pd, cf.fd, fh);
+ proto_tree_print(TRUE, (GNode*) cf.protocol_tree, cf.pd, cf.fd, fh);
print_finale(fh);
close_print_dest(prefs.pr_dest == PR_DEST_FILE, fh);
}