diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-06-05 18:04:23 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-06-06 01:04:55 +0000 |
commit | f9be95c4c8ab3484e6cf396e0cf4242b18ff8841 (patch) | |
tree | de6b8561e7ed4519aab54e029fc15d84a5fb1885 /ui/gtk | |
parent | adee6850898a5469850a157c5816996691855ed2 (diff) |
Add a routine to get an array of all instances of a string option.
Use it for OPT_COMMENT in the SHB, as there may be ore than one instance
of OPT_COMMENT in an SHB.
Also, use wtap_optionblock_get_option_string for OPT_SHB_HARDWARE,
OPT_SHB_OS, and OPT_SHB_USERAPPL; they're specified as "only one
instance allowed".
Change-Id: I23ad87e41e40b7ae1155e96c0523a6f8caad5204
Reviewed-on: https://code.wireshark.org/review/15750
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/summary_dlg.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index 03b8d31d8c..8bb85774ab 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -190,6 +190,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) iface_options iface; wtap_optionblock_t shb_inf; unsigned int i; + GArray *opts; if (summary_dlg != NULL) { /* There's already a Summary dialog box; reactivate it. */ @@ -292,11 +293,14 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (comment_view)); gtk_text_buffer_set_text (buffer, "", -1); if (shb_inf != NULL) { - char *str; - - wtap_optionblock_get_option_string(shb_inf, OPT_COMMENT, &str); - if (str != NULL && str[0] != '\0') - gtk_text_buffer_set_text (buffer, str, -1); + wtap_optionblock_get_string_options(shb_inf, OPT_COMMENT, &opts); + for (i = 0; i < opts->len; i++) { + /* XXX - this only shows the last comment */ + char *opt_comment = g_array_index(opts, char *, i); + if (opt_comment != NULL && opt_comment[0] != '\0') + gtk_text_buffer_set_text (buffer, opt_comment, -1); + } + g_array_free(opts, TRUE); } gtk_box_pack_start(GTK_BOX(comment_vbox), comment_view, TRUE, TRUE, 0); gtk_widget_show (comment_view); @@ -661,6 +665,7 @@ summary_to_texbuff(GtkTextBuffer *buffer) gchar string_buff[SUM_STR_MAX]; gchar tmp_buff[SUM_STR_MAX]; wtap_optionblock_t shb_inf; + GArray *opts; unsigned int i; unsigned int elapsed_time; iface_options iface; @@ -896,11 +901,13 @@ summary_to_texbuff(GtkTextBuffer *buffer) /* Trace file comments from SHB */ shb_inf = wtap_file_get_shb(cfile.wth); if (shb_inf != NULL) { - char *str; - - wtap_optionblock_get_option_string(shb_inf, OPT_COMMENT, &str); - if (str != NULL && str[0] != '\0') - gtk_text_buffer_insert_at_cursor(buffer, str, -1); + wtap_optionblock_get_string_options(shb_inf, OPT_COMMENT, &opts); + for (i = 0; i < opts->len; i++) { + /* XXX - separator between comments? */ + char *opt_comment = g_array_index(opts, char *, i); + if (opt_comment != NULL && opt_comment[0] != '\0') + gtk_text_buffer_insert_at_cursor(buffer, opt_comment, -1); + } } |