Have the frame_tvbuff.c routines not use the global cfile.
[metze/wireshark/wip.git] / ui / gtk / edit_packet_comment_dlg.c
index 1cca02e0583d6b074046a58a2b95d48c581d800c..a1e6cba7ed51edd6f0d6d5abc9fc0e16fe993886 100644 (file)
@@ -2,8 +2,6 @@
  * Dialog box for editing or adding packet comments.
  * Copyright 2012 Anders Broman <anders.broman@ericsson.com>
  *
- * $Id$
- *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
 
 #include <gtk/gtk.h>
 
-#include <epan/epan.h>
-#include <epan/filesystem.h>
-
 #include "ui/main_statusbar.h"
-#include "ui/simple_dialog.h"
 
 #include "ui/gtk/dlg_utils.h"
 #include "ui/gtk/expert_comp_dlg.h"
 #include "ui/gtk/gui_utils.h"
-#include "ui/gtk/help_dlg.h"
 #include "ui/gtk/main.h"
 #include "ui/gtk/packet_list.h"
 #include "ui/gtk/edit_packet_comment_dlg.h"
-#include "ui/gtk/old-gtk-compat.h"
-#include "ui/gtk/summary_dlg.h"
+
+#include "globals.h"
 
 static GtkWidget *edit_or_add_pkt_comment_dlg = NULL;
 static GtkWidget *edit_or_add_capture_comment_dlg = NULL;
@@ -66,6 +59,7 @@ pkt_comment_text_buff_ok_cb(GtkWidget *w _U_, GtkWidget *view)
 
   packet_list_update_packet_comment(new_packet_comment);
   expert_comp_packet_comment_updated();
+  status_expert_update();
 
   window_destroy(edit_or_add_pkt_comment_dlg);
 
@@ -87,7 +81,7 @@ capture_comment_text_buff_ok_cb(GtkWidget *w _U_, GtkWidget *view)
   new_capture_comment = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE /* whether to include invisible text */);
 
   /*g_warning("The new comment is '%s'",new_capture_comment);*/
-  cf_update_capture_comment(&cfile, new_capture_comment);
+  cf_update_section_comment(&cfile, new_capture_comment);
 
   /* Update the main window as appropriate */
   main_update_for_unsaved_changes(&cfile);
@@ -109,8 +103,7 @@ edit_packet_comment_dlg (GtkAction *action _U_, gpointer data _U_)
   GtkWidget *bbox;
   GtkWidget *ok_bt, *cancel_bt, *help_bt;
   GtkTextBuffer *buffer;
-  const gchar *opt_comment;
-  gchar *buf_str;
+  gchar *opt_comment;
 
   edit_or_add_pkt_comment_dlg = dlg_window_new ("Edit or Add Packet Comments");
   gtk_widget_set_size_request (edit_or_add_pkt_comment_dlg, 500, 160);
@@ -138,9 +131,8 @@ edit_packet_comment_dlg (GtkAction *action _U_, gpointer data _U_)
   /*g_warning("Fetched comment '%s'",opt_comment);*/
 
   if(opt_comment){
-    buf_str = g_strdup_printf("%s", opt_comment);
-    gtk_text_buffer_set_text (buffer, buf_str, -1);
-    g_free(buf_str);
+    gtk_text_buffer_set_text(buffer, opt_comment, -1);
+    g_free(opt_comment);
   }
 
   /* Button row. */
@@ -177,9 +169,8 @@ edit_capture_comment_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
 }
 
 void
-edit_capture_comment_dlg_launch (void)
+edit_capture_comment_dlg_launch (GtkAction *action _U_, gpointer data _U_)
 {
-
   GtkWidget *vbox;
   GtkWidget *view;
   GtkWidget *scroll;
@@ -187,7 +178,6 @@ edit_capture_comment_dlg_launch (void)
   GtkWidget *ok_bt, *cancel_bt, *help_bt;
   GtkTextBuffer *buffer = NULL;
   const gchar *comment_str = NULL;
-  gchar *buf_str;
 
   if (edit_or_add_capture_comment_dlg != NULL) {
     /* There's already an "Edit Capture Comment" dialog box; reactivate it. */
@@ -220,13 +210,9 @@ edit_capture_comment_dlg_launch (void)
   gtk_box_pack_start(GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
 
   /* Get the comment */
-  comment_str = cf_read_shb_comment(&cfile);
-  /*g_warning("Fetched comment '%s'",opt_comment);*/
-
+  comment_str = cf_read_section_comment(&cfile);
   if(comment_str != NULL){
-    buf_str = g_strdup_printf("%s", comment_str);
-    gtk_text_buffer_set_text (buffer, buf_str, -1);
-    g_free(buf_str);
+    gtk_text_buffer_set_text (buffer, comment_str, -1);
   }
 
   /* Button row. */
@@ -249,14 +235,25 @@ edit_capture_comment_dlg_launch (void)
   gtk_widget_grab_default (ok_bt);
   g_signal_connect (edit_or_add_capture_comment_dlg, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
 
-
   gtk_widget_show (edit_or_add_capture_comment_dlg);
-
 }
-    
+
 
 void
 edit_capture_comment_dlg_hide(void)
 {
   window_destroy(edit_or_add_capture_comment_dlg);
 }
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */