diff --git a/file.c b/file.c index 2a2f29cb78..fe971f4b96 100644 --- a/file.c +++ b/file.c @@ -189,6 +189,9 @@ cf_callback_remove(cf_callback_t func) void cf_timestamp_auto_precision(capture_file *cf) { +#ifdef NEW_PACKET_LIST + int i; +#endif int prec = timestamp_get_precision(); @@ -229,6 +232,15 @@ cf_timestamp_auto_precision(capture_file *cf) g_assert_not_reached(); } } +#ifdef NEW_PACKET_LIST + /* Set the column widths of those columns that show the time in + "command-line-specified" format. */ + for (i = 0; i < cf->cinfo.num_cols; i++) { + if (col_has_time_fmt(&cf->cinfo, i)) { + new_packet_list_set_time_width(cf->cinfo.col_fmt[i], i); + } + } +#endif } @@ -2976,7 +2988,9 @@ cf_change_time_formats(capture_file *cf) "command-line-specified" format. */ for (i = 0; i < cf->cinfo.num_cols; i++) { if (col_has_time_fmt(&cf->cinfo, i)) { -#ifndef NEW_PACKET_LIST +#ifdef NEW_PACKET_LIST + new_packet_list_set_time_width(cf->cinfo.col_fmt[i], i); +#else packet_list_set_time_width(cf->cinfo.col_fmt[i], i); #endif } diff --git a/gtk/new_packet_list.c b/gtk/new_packet_list.c index 2cf7ee65e5..2c5e9628a7 100644 --- a/gtk/new_packet_list.c +++ b/gtk/new_packet_list.c @@ -829,5 +829,19 @@ void new_packet_list_colorize_packets(void) packet_list_reset_colorized(packetlist); gtk_widget_queue_draw (packetlist->view); } + +void new_packet_list_set_time_width(gint col_fmt, gint col) +{ + PangoLayout *layout; + GtkTreeViewColumn *column; + gint col_width; + + column = gtk_tree_view_get_column (GTK_TREE_VIEW(packetlist->view), col); + layout = gtk_widget_create_pango_layout(packetlist->view, get_column_width_string(get_column_format(col), col)); + pango_layout_get_pixel_size(layout, &col_width, NULL); + gtk_tree_view_column_set_fixed_width(column, col_width); + g_object_unref(G_OBJECT(layout)); + +} #endif /* NEW_PACKET_LIST */ diff --git a/ui_util.h b/ui_util.h index 8a4dc37c5b..dd390abc28 100644 --- a/ui_util.h +++ b/ui_util.h @@ -77,6 +77,7 @@ void new_packet_list_select_last_row(void); void new_packet_list_moveto_end(void); gboolean new_packet_list_check_end(void); gint new_packet_list_find_row_from_data(gpointer data, gboolean select); +void new_packet_list_set_time_width(gint, gint); #else /* packet list related functions */ void packet_list_clear(void);