Show the comment area only if we could write out the comments were the
authorGuy Harris <guy@alum.mit.edu>
Tue, 2 Apr 2013 20:01:10 +0000 (20:01 -0000)
committerGuy Harris <guy@alum.mit.edu>
Tue, 2 Apr 2013 20:01:10 +0000 (20:01 -0000)
user to enter any.

svn path=/trunk/; revision=48707

ui/gtk/summary_dlg.c

index 5807f2691cb05fbb60e68e2590acc019881a3801..8d65af20d0612e7977e33bd0f0997af14b29d9c7 100644 (file)
@@ -290,27 +290,29 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
   }
 
   /* Capture file comment area */
-  comment_frame = gtk_frame_new("Capture file comments");
-  gtk_frame_set_shadow_type(GTK_FRAME(comment_frame), GTK_SHADOW_ETCHED_IN);
-  gtk_box_pack_start(GTK_BOX(main_vb), comment_frame, TRUE, TRUE, 0);
-  gtk_widget_show(comment_frame);
-
-  comment_vbox = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
-  gtk_container_add(GTK_CONTAINER(comment_frame), comment_vbox);
-  gtk_widget_show(comment_vbox);
-
-  comment_view = gtk_text_view_new();
-  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(comment_view), GTK_WRAP_WORD);
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (comment_view));
-  if(summary.opt_comment == NULL) {
-    gtk_text_buffer_set_text (buffer, "", -1);
-  } else {
-    buf_str = g_strdup_printf("%s", summary.opt_comment);
-    gtk_text_buffer_set_text (buffer, buf_str, -1);
-    g_free(buf_str);
+  if (wtap_dump_can_write(cfile.linktypes, WTAP_COMMENT_PER_SECTION)) {
+    comment_frame = gtk_frame_new("Capture file comments");
+    gtk_frame_set_shadow_type(GTK_FRAME(comment_frame), GTK_SHADOW_ETCHED_IN);
+    gtk_box_pack_start(GTK_BOX(main_vb), comment_frame, TRUE, TRUE, 0);
+    gtk_widget_show(comment_frame);
+
+    comment_vbox = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
+    gtk_container_add(GTK_CONTAINER(comment_frame), comment_vbox);
+    gtk_widget_show(comment_vbox);
+
+    comment_view = gtk_text_view_new();
+    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(comment_view), GTK_WRAP_WORD);
+    buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (comment_view));
+    if(summary.opt_comment == NULL) {
+      gtk_text_buffer_set_text (buffer, "", -1);
+    } else {
+      buf_str = g_strdup_printf("%s", summary.opt_comment);
+      gtk_text_buffer_set_text (buffer, buf_str, -1);
+      g_free(buf_str);
+    }
+    gtk_box_pack_start(GTK_BOX(comment_vbox), comment_view, TRUE, TRUE, 0);
+    gtk_widget_show (comment_view);
   }
-  gtk_box_pack_start(GTK_BOX(comment_vbox), comment_view, TRUE, TRUE, 0);
-  gtk_widget_show (comment_view);
 
   /*
    * We must have no un-time-stamped packets (i.e., the number of