diff options
-rw-r--r-- | column.c | 6 | ||||
-rw-r--r-- | dftest.c | 4 | ||||
-rw-r--r-- | epan/column-utils.c | 10 | ||||
-rw-r--r-- | epan/timestamp.h | 22 | ||||
-rw-r--r-- | gtk/display_opts.c | 99 | ||||
-rw-r--r-- | gtk/main.c | 14 | ||||
-rw-r--r-- | gtk/menu.c | 97 | ||||
-rw-r--r-- | gtk/packet_list.c | 6 | ||||
-rw-r--r-- | gtk/recent.c | 46 | ||||
-rw-r--r-- | gtk/recent.h | 9 | ||||
-rw-r--r-- | tethereal.c | 12 |
11 files changed, 172 insertions, 153 deletions
@@ -1,7 +1,7 @@ /* column.c * Routines for handling column preferences * - * $Id: column.c,v 1.44 2003/12/09 06:48:38 guy Exp $ + * $Id: column.c,v 1.45 2004/01/19 03:46:41 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -212,9 +212,9 @@ get_column_longest_string(gint format) return "0000000"; break; case COL_CLS_TIME: - if (timestamp_type == ABSOLUTE) + if (timestamp_type == TS_ABSOLUTE) return "00:00:00.000000"; - else if (timestamp_type == ABSOLUTE_WITH_DATE) + else if (timestamp_type == TS_ABSOLUTE_WITH_DATE) return "0000-00-00 00:00:00.000000"; else return "0000.000000"; @@ -1,6 +1,6 @@ /* dftest.c.c * - * $Id: dftest.c,v 1.6 2003/08/18 18:35:21 guy Exp $ + * $Id: dftest.c,v 1.7 2004/01/19 03:46:41 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -58,7 +58,7 @@ #include "register.h" packet_info pi; -ts_type timestamp_type = RELATIVE; +ts_type timestamp_type = TS_RELATIVE; int main(int argc, char **argv) diff --git a/epan/column-utils.c b/epan/column-utils.c index cebe7eb42d..95c759e817 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -1,7 +1,7 @@ /* column-utils.c * Routines for column utilities. * - * $Id: column-utils.c,v 1.41 2003/12/09 06:48:39 guy Exp $ + * $Id: column-utils.c,v 1.42 2004/01/19 03:46:41 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -479,19 +479,19 @@ void col_set_cls_time(frame_data *fd, column_info *cinfo, int col) { switch (timestamp_type) { - case ABSOLUTE: + case TS_ABSOLUTE: col_set_abs_time(fd, cinfo, col); break; - case ABSOLUTE_WITH_DATE: + case TS_ABSOLUTE_WITH_DATE: col_set_abs_date_time(fd, cinfo, col); break; - case RELATIVE: + case TS_RELATIVE: col_set_rel_time(fd, cinfo, col); break; - case DELTA: + case TS_DELTA: col_set_delta_time(fd, cinfo, col); break; } diff --git a/epan/timestamp.h b/epan/timestamp.h index 31067e0dce..291b71feb2 100644 --- a/epan/timestamp.h +++ b/epan/timestamp.h @@ -1,7 +1,7 @@ /* timestamp.h * Defines for packet timestamps * - * $Id: timestamp.h,v 1.2 2002/08/28 20:40:45 jmayer Exp $ + * $Id: timestamp.h,v 1.3 2004/01/19 03:46:42 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -26,25 +26,21 @@ #ifndef __TIMESTAMP_H__ #define __TIMESTAMP_H__ -/* MS VC has these macros */ -#ifdef RELATIVE -#undef RELATIVE -#endif - -#ifdef ABSOLUTE -#undef ABSOLUTE -#endif /* * Type of time-stamp shown in the summary display. */ typedef enum { - RELATIVE, - ABSOLUTE, - ABSOLUTE_WITH_DATE, - DELTA + TS_RELATIVE, + TS_ABSOLUTE, + TS_ABSOLUTE_WITH_DATE, + TS_DELTA } ts_type; extern ts_type timestamp_type; +static char *ts_type_text[] = + { "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", NULL }; + + #endif /* timestamp.h */ diff --git a/gtk/display_opts.c b/gtk/display_opts.c index 13060dc12c..92334425ef 100644 --- a/gtk/display_opts.c +++ b/gtk/display_opts.c @@ -1,7 +1,7 @@ /* display_opts.c * Routines for packet display windows * - * $Id: display_opts.c,v 1.34 2004/01/10 16:27:41 ulfl Exp $ + * $Id: display_opts.c,v 1.35 2004/01/19 03:46:42 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -41,10 +41,6 @@ extern capture_file cfile; /* Display callback data keys */ -#define E_DISPLAY_TIME_ABS_KEY "display_time_abs" -#define E_DISPLAY_DATE_TIME_ABS_KEY "display_date_time_abs" -#define E_DISPLAY_TIME_REL_KEY "display_time_rel" -#define E_DISPLAY_TIME_DELTA_KEY "display_time_delta" #ifdef HAVE_LIBPCAP #define E_DISPLAY_AUTO_SCROLL_KEY "display_auto_scroll" #endif @@ -55,7 +51,6 @@ extern capture_file cfile; static void display_opt_ok_cb(GtkWidget *, gpointer); static void display_opt_apply_cb(GtkWidget *, gpointer); static void get_display_options(GtkWidget *); -static void update_display(void); static void display_opt_close_cb(GtkWidget *, gpointer); static void display_opt_destroy_cb(GtkWidget *, gpointer); @@ -67,9 +62,6 @@ static void display_opt_destroy_cb(GtkWidget *, gpointer); */ static GtkWidget *display_opt_w; -static ts_type initial_timestamp_type; -static ts_type current_timestamp_type; - void display_opt_cb(GtkWidget *w _U_, gpointer d _U_) { GtkWidget *button, *main_vb, *bbox, *ok_bt, *apply_bt, *cancel_bt; @@ -83,17 +75,6 @@ display_opt_cb(GtkWidget *w _U_, gpointer d _U_) { return; } - /* Save the timestamp type value as of when the dialog box was first popped - up, so that "Cancel" can put it back if we've changed it with "Apply". */ - initial_timestamp_type = timestamp_type; - - /* Save the current timestamp type so that we know whether it has changed; - we don't want to redisplay the time fields unless we've changed the way - they should be displayed (as redisplaying the time fields could be - expensive - we have to scan through all the packets and rebuild the - packet list).*/ - current_timestamp_type = timestamp_type; - display_opt_w = dlg_window_new("Ethereal: View Options"); SIGNAL_CONNECT(display_opt_w, "destroy", display_opt_destroy_cb, NULL); @@ -111,39 +92,6 @@ display_opt_cb(GtkWidget *w _U_, gpointer d _U_) { gtk_container_add(GTK_CONTAINER(display_opt_w), main_vb); gtk_widget_show(main_vb); - button = RADIO_BUTTON_NEW_WITH_MNEMONIC(NULL, "_Time of day", - accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), - (timestamp_type == ABSOLUTE)); - OBJECT_SET_DATA(display_opt_w, E_DISPLAY_TIME_ABS_KEY, button); - gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0); - - gtk_widget_show(button); - - button = RADIO_BUTTON_NEW_WITH_MNEMONIC( - button, "_Date and time of day", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), - (timestamp_type == ABSOLUTE_WITH_DATE)); - OBJECT_SET_DATA(display_opt_w, E_DISPLAY_DATE_TIME_ABS_KEY, button); - gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = RADIO_BUTTON_NEW_WITH_MNEMONIC( - button, "Seconds since _beginning of capture", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), - (timestamp_type == RELATIVE)); - OBJECT_SET_DATA(display_opt_w, E_DISPLAY_TIME_REL_KEY, button); - gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = RADIO_BUTTON_NEW_WITH_MNEMONIC( - button, "Seconds since _previous packet", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), - (timestamp_type == DELTA)); - OBJECT_SET_DATA(display_opt_w, E_DISPLAY_TIME_DELTA_KEY, button); - gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0); - gtk_widget_show(button); - #ifdef HAVE_LIBPCAP button = CHECK_BUTTON_NEW_WITH_MNEMONIC( "_Automatic scrolling in live capture", accel_group); @@ -217,14 +165,12 @@ display_opt_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) { gtk_widget_destroy(GTK_WIDGET(parent_w)); - update_display(); } static void display_opt_apply_cb(GtkWidget *ok_bt _U_, gpointer parent_w) { get_display_options(GTK_WIDGET(parent_w)); - update_display(); } static void @@ -232,22 +178,6 @@ get_display_options(GtkWidget *parent_w) { GtkWidget *button; - button = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_DISPLAY_TIME_ABS_KEY); - if (GTK_TOGGLE_BUTTON (button)->active) - timestamp_type = ABSOLUTE; - - button = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_DISPLAY_DATE_TIME_ABS_KEY); - if (GTK_TOGGLE_BUTTON (button)->active) - timestamp_type = ABSOLUTE_WITH_DATE; - - button = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_DISPLAY_TIME_REL_KEY); - if (GTK_TOGGLE_BUTTON (button)->active) - timestamp_type = RELATIVE; - - button = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_DISPLAY_TIME_DELTA_KEY); - if (GTK_TOGGLE_BUTTON (button)->active) - timestamp_type = DELTA; - #ifdef HAVE_LIBPCAP button = (GtkWidget *)OBJECT_GET_DATA(parent_w, E_DISPLAY_AUTO_SCROLL_KEY); auto_scroll_live = (GTK_TOGGLE_BUTTON (button)->active); @@ -270,35 +200,8 @@ get_display_options(GtkWidget *parent_w) } static void -update_display(void) -{ - if (timestamp_type != current_timestamp_type) { - /* Time stamp format changed; update the display. - - XXX - redissecting the packets could actually be faster; - we have to find the row number for each frame, in order to - update the time stamp columns, and doing that is linear in - the row number, which means the whole process is N^2 in - the number of rows, whilst redissecting the packets is only - linear in the number of rows (assuming you're using our - CList code, or the GTK+ 1.2.8 CList code, or other CList - code which doesn't have to scan the entire list to find the - last element), even though the latter involves doing more work - per packet. */ - current_timestamp_type = timestamp_type; - change_time_formats(&cfile); - } -} - -static void display_opt_close_cb(GtkWidget *close_bt _U_, gpointer parent_w) { - /* Revert the timestamp type to the value it has when we started. */ - timestamp_type = initial_timestamp_type; - - /* Update the display if either of those changed. */ - update_display(); - gtk_grab_remove(GTK_WIDGET(parent_w)); gtk_widget_destroy(GTK_WIDGET(parent_w)); } diff --git a/gtk/main.c b/gtk/main.c index dd3dfcdf98..d6d40cb7bb 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.358 2004/01/19 00:42:09 ulfl Exp $ + * $Id: main.c,v 1.359 2004/01/19 03:46:42 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -155,7 +155,9 @@ static gboolean updated_last_open_dir = FALSE; static gint root_x = G_MAXINT, root_y = G_MAXINT, top_width, top_height; static gboolean updated_geometry = FALSE; -ts_type timestamp_type = RELATIVE; +/* init with an invalid value, so that "recent" can detect this and */ +/* distinguish it from a command line value */ +ts_type timestamp_type = -1; #if GTK_MAJOR_VERSION < 2 GtkStyle *item_style; @@ -1805,13 +1807,13 @@ main(int argc, char *argv[]) break; case 't': /* Time stamp type */ if (strcmp(optarg, "r") == 0) - timestamp_type = RELATIVE; + timestamp_type = TS_RELATIVE; else if (strcmp(optarg, "a") == 0) - timestamp_type = ABSOLUTE; + timestamp_type = TS_ABSOLUTE; else if (strcmp(optarg, "ad") == 0) - timestamp_type = ABSOLUTE_WITH_DATE; + timestamp_type = TS_ABSOLUTE_WITH_DATE; else if (strcmp(optarg, "d") == 0) - timestamp_type = DELTA; + timestamp_type = TS_DELTA; else { fprintf(stderr, "ethereal: Invalid time stamp type \"%s\"\n", optarg); diff --git a/gtk/menu.c b/gtk/menu.c index 6bbeb1c371..7a44d49e8b 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.137 2004/01/19 00:42:10 ulfl Exp $ + * $Id: menu.c,v 1.138 2004/01/19 03:46:42 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -85,6 +85,10 @@ static void packet_list_show_cb(GtkWidget *w _U_, gpointer d _U_); static void tree_view_show_cb(GtkWidget *w _U_, gpointer d _U_); static void byte_view_show_cb(GtkWidget *w _U_, gpointer d _U_); static void statusbar_show_cb(GtkWidget *w _U_, gpointer d _U_); +static void timestamp_absolute_cb(GtkWidget *w _U_, gpointer d _U_); +static void timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_); +static void timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_); +static void timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_); /* This is the GtkItemFactoryEntry structure used to generate new menus. Item 1: The menu path. The letter after the underscore indicates an @@ -183,15 +187,19 @@ static GtkItemFactoryEntry menu_items[] = ITEM_FACTORY_ENTRY("/View/Show/Packet Data", NULL, byte_view_show_cb, 0, "<CheckItem>", NULL), ITEM_FACTORY_ENTRY("/View/Show/<separator>", NULL, NULL, 0, "<Separator>", NULL), ITEM_FACTORY_ENTRY("/View/Show/Status Bar", NULL, statusbar_show_cb, 0, "<CheckItem>", NULL), -#if 0 /* XXX: the settings in the "Options" dialog could be seperated into the following menu items. */ /* before this, some effort must be taken to transfer the functionality of this dialog to the menu items */ /* (getting the current values, handling the radioitems, ...) */ ITEM_FACTORY_ENTRY("/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL), - ITEM_FACTORY_ENTRY("/View/Time Display Format/Time of day", NULL, NULL, 0, "<RadioItem>", NULL), - ITEM_FACTORY_ENTRY("/View/Time Display Format/Date and time of day", NULL, NULL, 0, "<RadioItem>", NULL), - ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds since beginning of capture", NULL, NULL, 0, "<RadioItem>", NULL), - ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds since previous capture", NULL, NULL, 0, "<RadioItem>", NULL), + ITEM_FACTORY_ENTRY("/View/Time Display Format/Time of day", NULL, timestamp_absolute_cb, + 0, "<RadioItem>", NULL), + ITEM_FACTORY_ENTRY("/View/Time Display Format/Date and time of day", NULL, timestamp_absolute_date_cb, + 0, "/View/Time Display Format/Time of day", NULL), + ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds since beginning of capture", NULL, timestamp_relative_cb, + 0, "/View/Time Display Format/Time of day", NULL), + ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds since previous capture", NULL, timestamp_delta_cb, + 0, "/View/Time Display Format/Time of day", NULL), +#if 0 ITEM_FACTORY_ENTRY("/View/_Name Resolution", NULL, NULL, 0, "<Branch>", NULL), ITEM_FACTORY_ENTRY("/View/Name Resolution/Enable MAC", NULL, NULL, 0, "<CheckItem>", NULL), ITEM_FACTORY_ENTRY("/View/Name Resolution/Enable Network", NULL, NULL, 0, "<CheckItem>", NULL), @@ -962,6 +970,47 @@ statusbar_show_cb(GtkWidget *w _U_, gpointer d _U_) } +static void +timestamp_absolute_cb(GtkWidget *w _U_, gpointer d _U_) +{ + if (recent.gui_time_format != TS_ABSOLUTE) { + timestamp_type = TS_ABSOLUTE; + recent.gui_time_format = timestamp_type; + change_time_formats(&cfile); + } +} + +static void +timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_) +{ + if (recent.gui_time_format != TS_ABSOLUTE_WITH_DATE) { + timestamp_type = TS_ABSOLUTE_WITH_DATE; + recent.gui_time_format = timestamp_type; + change_time_formats(&cfile); + } +} + +static void +timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_) +{ + if (recent.gui_time_format != TS_RELATIVE) { + timestamp_type = TS_RELATIVE; + recent.gui_time_format = timestamp_type; + change_time_formats(&cfile); + } +} + +static void +timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_) +{ + if (recent.gui_time_format != TS_DELTA) { + timestamp_type = TS_DELTA; + recent.gui_time_format = timestamp_type; + change_time_formats(&cfile); + } +} + + /* the recent file read has finished, update the menu corresponding */ void menu_recent_read_finished(void) { @@ -986,6 +1035,42 @@ menu_recent_read_finished(void) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show); main_widgets_rearrange(); + + /* don't change the time format, if we had a command line value */ + if (timestamp_type != -1) { + recent.gui_time_format = timestamp_type; + } + + switch(recent.gui_time_format) { + case(TS_ABSOLUTE): + menu = gtk_item_factory_get_widget(main_menu_factory, + "/View/Time Display Format/Time of day"); + /* set_active will not trigger the callback when activating an active item! */ + recent.gui_time_format = -1; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE); + break; + case(TS_ABSOLUTE_WITH_DATE): + menu = gtk_item_factory_get_widget(main_menu_factory, + "/View/Time Display Format/Date and time of day"); + recent.gui_time_format = -1; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE); + break; + case(TS_RELATIVE): + menu = gtk_item_factory_get_widget(main_menu_factory, + "/View/Time Display Format/Seconds since beginning of capture"); + recent.gui_time_format = -1; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE); + break; + case(TS_DELTA): + menu = gtk_item_factory_get_widget(main_menu_factory, + "/View/Time Display Format/Seconds since previous capture"); + recent.gui_time_format = -1; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE); + break; + default: + g_assert_not_reached(); + } } diff --git a/gtk/packet_list.c b/gtk/packet_list.c index 41d906dd79..f00df8dc6f 100644 --- a/gtk/packet_list.c +++ b/gtk/packet_list.c @@ -1,7 +1,7 @@ /* packet_list.c * packet list related functions 2002 Olivier Abad * - * $Id: packet_list.c,v 1.10 2004/01/19 00:42:10 ulfl Exp $ + * $Id: packet_list.c,v 1.11 2004/01/19 03:46:42 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -110,8 +110,8 @@ packet_list_compare(EthCList *clist, gconstpointer ptr1, gconstpointer ptr2) gint col_fmt = cfile.cinfo.col_fmt[clist->sort_column]; if ((col_fmt == COL_NUMBER) || (col_fmt == COL_REL_TIME) || (col_fmt == COL_DELTA_TIME) || - ((col_fmt == COL_CLS_TIME) && (timestamp_type == RELATIVE)) || - ((col_fmt == COL_CLS_TIME) && (timestamp_type == DELTA)) || + ((col_fmt == COL_CLS_TIME) && (timestamp_type == TS_RELATIVE)) || + ((col_fmt == COL_CLS_TIME) && (timestamp_type == TS_DELTA)) || (col_fmt == COL_UNRES_SRC_PORT) || (col_fmt == COL_UNRES_DST_PORT) || ((num1 != 0) && (num2 != 0) && ((col_fmt == COL_DEF_SRC_PORT) || (col_fmt == COL_RES_SRC_PORT) || (col_fmt == COL_DEF_DST_PORT) || (col_fmt == COL_RES_DST_PORT))) || diff --git a/gtk/recent.c b/gtk/recent.c index 4a75848162..26830c8ed4 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -2,7 +2,7 @@ * Recent "preference" handling routines * Copyright 2004, Ulf Lamping <ulf.lamping@web.de> * - * $Id: recent.c,v 1.2 2004/01/19 01:00:58 guy Exp $ + * $Id: recent.c,v 1.3 2004/01/19 03:46:43 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -49,6 +49,29 @@ extern void menu_recent_read_finished(void); recent_settings_t recent; + + +/* Takes an string and a pointer to an array of strings, and a default int value. + * The array must be terminated by a NULL string. If the string is found in the array + * of strings, the index of that string in the array is returned. Otherwise, the + * default value that was passed as the third argument is returned. + */ +static int +find_index_from_string_array(char *needle, char **haystack, int default_value) +{ + int i = 0; + + while (haystack[i] != NULL) { + if (strcmp(needle, haystack[i]) == 0) { + return i; + } + i++; + } + return default_value; +} + + + /* Write out "recent" to the user's recent file, and return 0. If we got an error, stuff a pointer to the path of the recent file into "*pf_path_return", and return the errno. */ @@ -116,6 +139,11 @@ write_recent(char **rf_path_return) fprintf(rf, RECENT_KEY_STATUSBAR_SHOW ": %s\n", recent.statusbar_show == TRUE ? "TRUE" : "FALSE"); + fprintf(rf, "\n# Timestamp display format.\n"); + fprintf(rf, "# One of: RELATIVE, ABSOLUTE, ABSOLUTE_WITH_DATE, DELTA\n"); + fprintf(rf, RECENT_GUI_TIME_FORMAT ": %s\n", + ts_type_text[recent.gui_time_format]); + fclose(rf); /* XXX - catch I/O errors (e.g. "ran out of disk space") and return @@ -177,6 +205,9 @@ read_set_recent_pair(gchar *key, gchar *value) else { recent.statusbar_show = FALSE; } + } else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) { + recent.gui_time_format = + find_index_from_string_array(value, ts_type_text, TS_RELATIVE); } return PREFS_SET_OK; @@ -192,12 +223,13 @@ read_recent(char **rf_path_return, int *rf_errno_return) /* set defaults */ - recent.main_toolbar_show = TRUE; - recent.filter_toolbar_show= TRUE; - recent.packet_list_show = TRUE; - recent.tree_view_show = TRUE; - recent.byte_view_show = TRUE; - recent.statusbar_show = TRUE; + recent.main_toolbar_show = TRUE; + recent.filter_toolbar_show = TRUE; + recent.packet_list_show = TRUE; + recent.tree_view_show = TRUE; + recent.byte_view_show = TRUE; + recent.statusbar_show = TRUE; + recent.gui_time_format = TS_RELATIVE; /* Construct the pathname of the user's recent file. */ rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE); diff --git a/gtk/recent.h b/gtk/recent.h index bf317f935c..1e603f98bf 100644 --- a/gtk/recent.h +++ b/gtk/recent.h @@ -2,7 +2,7 @@ * Definitions for recent "preference" handling routines * Copyright 2004, Ulf Lamping <ulf.lamping@web.de> * - * $Id: recent.h,v 1.1 2004/01/19 00:42:11 ulfl Exp $ + * $Id: recent.h,v 1.2 2004/01/19 03:46:43 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -37,17 +37,18 @@ #define RECENT_KEY_TREE_VIEW_SHOW "gui.tree_view_show" #define RECENT_KEY_BYTE_VIEW_SHOW "gui.byte_view_show" #define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show" - +#define RECENT_GUI_TIME_FORMAT "gui.time_format" typedef struct recent_settings_tag { gboolean main_toolbar_show; gboolean filter_toolbar_show; gboolean packet_list_show; - /*gboolean packet_list_height;*/ + /*gboolean packet_list_height;*/ gboolean tree_view_show; - /*gboolean tree_view_height;*/ + /*gboolean tree_view_height;*/ gboolean byte_view_show; gboolean statusbar_show; + gint gui_time_format; } recent_settings_t; extern recent_settings_t recent; diff --git a/tethereal.c b/tethereal.c index 2590be2025..17eff12468 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.221 2004/01/18 04:13:44 guy Exp $ + * $Id: tethereal.c,v 1.222 2004/01/19 03:46:41 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -182,7 +182,7 @@ static int pipe_dispatch(int, loop_data *, struct pcap_hdr *, \ #endif capture_file cfile; -ts_type timestamp_type = RELATIVE; +ts_type timestamp_type = TS_RELATIVE; #ifdef HAVE_LIBPCAP typedef struct { int snaplen; /* Maximum captured packet length */ @@ -1176,13 +1176,13 @@ main(int argc, char *argv[]) break; case 't': /* Time stamp type */ if (strcmp(optarg, "r") == 0) - timestamp_type = RELATIVE; + timestamp_type = TS_RELATIVE; else if (strcmp(optarg, "a") == 0) - timestamp_type = ABSOLUTE; + timestamp_type = TS_ABSOLUTE; else if (strcmp(optarg, "ad") == 0) - timestamp_type = ABSOLUTE_WITH_DATE; + timestamp_type = TS_ABSOLUTE_WITH_DATE; else if (strcmp(optarg, "d") == 0) - timestamp_type = DELTA; + timestamp_type = TS_DELTA; else { fprintf(stderr, "tethereal: Invalid time stamp type \"%s\"\n", optarg); |