From Valerio Messina:
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 14 Dec 2009 22:05:29 +0000 (22:05 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 14 Dec 2009 22:05:29 +0000 (22:05 +0000)
As now, when Wireshark save capture files, it show "Loading" in status bar and
in the dialog box, warning many users of lost them packets. Saving work as expected.
Is simply a GUI use interaction problem.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31269 f5534014-38df-0310-8fa8-9805f1628bb7

capture.c
file.c
file.h
gtk/capture_file_dlg.c
gtk/drag_and_drop.c
gtk/file_dlg_win32.c
gtk/fileset_dlg.c
gtk/funnel_stat.c
gtk/main.c
gtk/main_statusbar.c
gtk/menus.c

index d6461eec7d87f5838ce492bc211b1ba2d6743414..c2352867f62269f145256f4588f19151278db9fc 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -289,7 +289,7 @@ guint32 drops)
   }
 
   /* read in the packet data */
-  switch (cf_read(capture_opts->cf)) {
+  switch (cf_read(capture_opts->cf, FALSE)) {
 
   case CF_READ_OK:
   case CF_READ_ERROR:
diff --git a/file.c b/file.c
index 4d19f10f6d5a6701fd22a13a91099c0dbcdb64af..feafb226a223245b4ae353a12bf9994a89f58953 100644 (file)
--- a/file.c
+++ b/file.c
@@ -484,7 +484,7 @@ static float calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos){
 }
 
 cf_read_status_t
-cf_read(capture_file *cf)
+cf_read(capture_file *cf, gboolean from_save)
 {
   int         err;
   gchar       *err_info;
@@ -524,10 +524,13 @@ cf_read(capture_file *cf)
 
   reset_tap_listeners();
 
-  cf_callback_invoke(cf_cb_file_read_start, cf);
-
   name_ptr = get_basename(cf->filename);
 
+  if (from_save == FALSE)
+    cf_callback_invoke(cf_cb_file_read_started, cf);
+  else
+    cf_callback_invoke(cf_cb_file_save_started, (gpointer)name_ptr);
+
   /* Find the size of the file. */
   size = wtap_file_size(cf->wth, NULL);
 
@@ -561,8 +564,12 @@ cf_read(capture_file *cf)
        */
       if ((progbar == NULL) && !(count % MIN_NUMBER_OF_PACKET)){
         progbar_val = calc_progbar_val( cf, size, data_offset);
-        progbar = delayed_create_progress_dlg("Loading", name_ptr,
-          TRUE, &stop_flag, &start_time, progbar_val);
+        if (from_save == FALSE)
+           progbar = delayed_create_progress_dlg("Loading", name_ptr,
+             TRUE, &stop_flag, &start_time, progbar_val);
+        else
+           progbar = delayed_create_progress_dlg("Saving", name_ptr,
+             TRUE, &stop_flag, &start_time, progbar_val);
       }
 
       /* Update the progress bar, but do it only N_PROGBAR_UPDATES times;
@@ -673,8 +680,10 @@ cf_read(capture_file *cf)
 #else
   packet_list_thaw();
 #endif
-
-  cf_callback_invoke(cf_cb_file_read_finished, cf);
+   if (from_save == FALSE)
+     cf_callback_invoke(cf_cb_file_read_finished, cf);
+   else
+     cf_callback_invoke(cf_cb_file_save_finished, cf);
 
   /* If we have any displayed packets to select, select the first of those
      packets by making the first row the selected row. */
@@ -4130,7 +4139,7 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
   wtap_dumper  *pdh;
   save_callback_args_t callback_args;
 
-  cf_callback_invoke(cf_cb_file_safe_started, (gpointer) fname);
+  cf_callback_invoke(cf_cb_file_save_started, (gpointer)fname);
 
   /* don't write over an existing file. */
   /* this should've been already checked by our caller, just to be sure... */
@@ -4144,7 +4153,6 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
 
   packet_range_process_init(range);
 
-
   if (packet_range_process_all(range) && save_format == cf->cd_t) {
     /* We're not filtering packets, and we're saving it in the format
        it's already in, so we can just move or copy the raw data. */
@@ -4243,7 +4251,7 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
     }
   }
 
-  cf_callback_invoke(cf_cb_file_safe_finished, NULL);
+  cf_callback_invoke(cf_cb_file_save_finished, NULL);
 
   if (packet_range_process_all(range)) {
     /* We saved the entire capture, not just some packets from it.
@@ -4261,7 +4269,8 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
     if ((cf_open(cf, fname, FALSE, &err)) == CF_OK) {
       /* XXX - report errors if this fails?
          What should we return if it fails or is aborted? */
-      switch (cf_read(cf)) {
+
+      switch (cf_read(cf, TRUE)) {
 
       case CF_READ_OK:
       case CF_READ_ERROR:
@@ -4277,13 +4286,13 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
        correctly for the "no capture file open" state). */
     break;
       }
-      cf_callback_invoke(cf_cb_file_safe_reload_finished, NULL);
+      cf_callback_invoke(cf_cb_file_save_reload_finished, NULL);
     }
   }
   return CF_OK;
 
 fail:
-  cf_callback_invoke(cf_cb_file_safe_failed, NULL);
+  cf_callback_invoke(cf_cb_file_save_failed, NULL);
   return CF_ERROR;
 }
 
@@ -4542,7 +4551,7 @@ cf_reload(capture_file *cf) {
   is_tempfile = cf->is_tempfile;
   cf->is_tempfile = FALSE;
   if (cf_open(cf, filename, is_tempfile, &err) == CF_OK) {
-    switch (cf_read(cf)) {
+    switch (cf_read(cf, FALSE)) {
 
     case CF_READ_OK:
     case CF_READ_ERROR:
diff --git a/file.h b/file.h
index 6c02b9e13a7f3b6bca8e886047ffa6524e6aefc7..97c478399b930cca609e056f2d7876158659889b 100644 (file)
--- a/file.h
+++ b/file.h
@@ -58,15 +58,15 @@ typedef enum {
 typedef enum {
     cf_cb_file_closing,
     cf_cb_file_closed,
-    cf_cb_file_read_start,
+    cf_cb_file_read_started,
     cf_cb_file_read_finished,
     cf_cb_packet_selected,
     cf_cb_packet_unselected,
     cf_cb_field_unselected,
-    cf_cb_file_safe_started,
-    cf_cb_file_safe_finished,
-    cf_cb_file_safe_reload_finished,
-    cf_cb_file_safe_failed
+    cf_cb_file_save_started,
+    cf_cb_file_save_finished,
+    cf_cb_file_save_reload_finished,
+    cf_cb_file_save_failed
 } cf_cbs;
 
 typedef void (*cf_callback_t) (gint event, gpointer data, gpointer user_data);
@@ -105,9 +105,10 @@ void cf_reload(capture_file *cf);
  * Read all packets of a capture file into the internal structures.
  * 
  * @param cf the capture file to be read
+ * @param from_save reread asked from cf_save
  * @return one of cf_read_status_t
  */
-cf_read_status_t cf_read(capture_file *cf);
+cf_read_status_t cf_read(capture_file *cf, gboolean from_save);
 
 /**
  * Start reading from the end of a capture file.
index 077646e647f1c99df239e9456e781f24843cc7f6..8a8f93434c71d67379b1926b16f2cbae800f15e9 100644 (file)
@@ -669,7 +669,7 @@ file_open_ok_cb(GtkWidget *w, gpointer fs) {
   /* We've crossed the Rubicon; get rid of the file selection box. */
   window_destroy(GTK_WIDGET (fs));
 
-  switch (cf_read(&cfile)) {
+  switch (cf_read(&cfile, FALSE)) {
 
   case CF_READ_OK:
   case CF_READ_ERROR:
@@ -1007,7 +1007,7 @@ file_merge_ok_cb(GtkWidget *w, gpointer fs) {
      previous read filter attached to "cf"). */
   cfile.rfcode = rfcode;
 
-  switch (cf_read(&cfile)) {
+  switch (cf_read(&cfile, FALSE)) {
 
   case CF_READ_OK:
   case CF_READ_ERROR:
index c0ca337f190ad9b91953b280fa2a03a1caa90b2a..971c9c4ebc2cdd11d4f3fabbb710d00df76dfb60 100644 (file)
@@ -177,7 +177,7 @@ dnd_merge_files(int in_file_count, char **in_filenames)
     }
     g_free(tmpname);
 
-    switch (cf_read(&cfile)) {
+    switch (cf_read(&cfile, FALSE)) {
 
     case CF_READ_OK:
     case CF_READ_ERROR:
@@ -252,7 +252,7 @@ dnd_open_file_cmd(gchar *cf_names_freeme)
         /* open and read the capture file (this will close an existing file) */
         if (cf_open(&cfile, in_filenames[0], FALSE, &err) == CF_OK) {
           /* XXX - add this to the menu if the read fails? */
-          cf_read(&cfile);
+          cf_read(&cfile, FALSE);
           add_menu_recent_capture_file(in_filenames[0]);
        } else {
           /* the capture file couldn't be read (doesn't exist, file format unknown, ...) */
index 65f41ce9b544332461affcfb60958ce647f2f0b4..a210dd0497abafe6c3db015fedbe32d5150cc86d 100644 (file)
@@ -230,7 +230,7 @@ win32_open_file (HWND h_wnd) {
             cf_set_rfcode(&cfile, dfp);
         }
 
-        switch (cf_read(&cfile)) {
+        switch (cf_read(&cfile, FALSE)) {
             case CF_READ_OK:
             case CF_READ_ERROR:
                 dirname = get_dirname(utf_16to8(file_name));
@@ -484,7 +484,7 @@ win32_merge_file (HWND h_wnd) {
             cf_set_rfcode(&cfile, dfp);
         }
 
-        switch (cf_read(&cfile)) {
+        switch (cf_read(&cfile, FALSE)) {
             case CF_READ_OK:
             case CF_READ_ERROR:
                 dirname = get_dirname(utf_16to8(file_name));
index 72167c982157dcc54afc02c9c64d1d1040538083..78709a7838c1fa298f90789f41644422a9d8e0c6 100644 (file)
@@ -84,7 +84,7 @@ fs_open_entry(fileset_entry *entry)
     /* close the old and open the new file */
     cf_close(&cfile);
     if (cf_open(&cfile, fname, FALSE, &err) == CF_OK) {
-        cf_read(&cfile);
+        cf_read(&cfile, FALSE);
     }
 
     g_free(fname);
index be0bdee611d39dc75d6ba3fefde361cd31b554cb..8060536f1cc3aa9238e8558dc4ca5c6712d47032 100644 (file)
@@ -515,7 +515,7 @@ static gboolean funnel_open_file(const char* fname, const char* filter, const ch
 
        cfile.rfcode = rfcode;
        
-       switch (cf_read(&cfile)) {
+       switch (cf_read(&cfile, FALSE)) {
                case CF_READ_OK:
                case CF_READ_ERROR:
                        break;
index 310a9be853c7e530246d469b90e70827a9f07ce1..a0f97057eecdacf31d62e231eba92a74750d936a 100644 (file)
@@ -1370,7 +1370,7 @@ main_cf_cb_file_closed(capture_file *cf _U_)
 
 
 static void
-main_cf_cb_file_read_start(capture_file *cf _U_)
+main_cf_cb_file_read_started(capture_file *cf _U_)
 {
   tap_dfilter_dlg_update();
 
@@ -1604,7 +1604,7 @@ main_cf_cb_field_unselected(capture_file *cf)
 }
 
 static void
-main_cf_cb_file_safe_reload_finished(gpointer data _U_)
+main_cf_cb_file_save_reload_finished(gpointer data _U_)
 {
     set_menus_for_capture_file(&cfile);
 }
@@ -1621,9 +1621,9 @@ main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
         g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closed");
         main_cf_cb_file_closed(data);
         break;
-    case(cf_cb_file_read_start):
-        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read start");
-        main_cf_cb_file_read_start(data);
+    case(cf_cb_file_read_started):
+        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read started");
+        main_cf_cb_file_read_started(data);
         break;
     case(cf_cb_file_read_finished):
         g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read finished");
@@ -1638,18 +1638,18 @@ main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
     case(cf_cb_field_unselected):
         main_cf_cb_field_unselected(data);
         break;
-    case(cf_cb_file_safe_started):
-        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe started");
+    case(cf_cb_file_save_started):
+        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Save started");
         break;
-    case(cf_cb_file_safe_finished):
-        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe finished");
+    case(cf_cb_file_save_finished):
+        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Save finished");
         break;
-    case(cf_cb_file_safe_reload_finished):
-        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: reload finished");
-        main_cf_cb_file_safe_reload_finished(data);
+    case(cf_cb_file_save_reload_finished):
+        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Reload finished");
+        main_cf_cb_file_save_reload_finished(data);
         break;
-    case(cf_cb_file_safe_failed):
-        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe failed");
+    case(cf_cb_file_save_failed):
+        g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Save failed");
         break;
     default:
         g_warning("main_cf_callback: event %u unknown", event);
@@ -2705,7 +2705,7 @@ main(int argc, char *argv[])
         start_requested_stats();
 
         /* Read the capture file. */
-        switch (cf_read(&cfile)) {
+        switch (cf_read(&cfile, FALSE)) {
 
         case CF_READ_OK:
         case CF_READ_ERROR:
index e6d50e4b29178b89ef0d8548f1cdb621a6fcab11..9d4a97224f9935bb9ab28213e2b6c6b2c6408a6d 100644 (file)
@@ -609,7 +609,7 @@ statusbar_cf_file_closed_cb(capture_file *cf _U_)
 
 
 static void
-statusbar_cf_file_read_start_cb(capture_file *cf)
+statusbar_cf_file_read_started_cb(capture_file *cf)
 {
   const gchar *name_ptr;
   gchar       *load_msg;
@@ -763,24 +763,25 @@ statusbar_cf_field_unselected_cb(capture_file *cf _U_)
 }
 
 static void
-statusbar_cf_file_safe_started_cb(gchar * filename)
+statusbar_cf_file_save_started_cb(gchar *filename)
 {
     gchar        *save_msg;
 
+    statusbar_pop_file_msg();
     save_msg = g_strdup_printf(" Saving: %s...", get_basename(filename));
     statusbar_push_file_msg(save_msg);
     g_free(save_msg);
 }
 
 static void
-statusbar_cf_file_safe_finished_cb(gpointer data _U_)
+statusbar_cf_file_save_finished_cb(gpointer data _U_)
 {
     /* Pop the "Saving:" message off the status bar. */
     statusbar_pop_file_msg();
 }
 
 static void
-statusbar_cf_file_safe_failed_cb(gpointer data _U_)
+statusbar_cf_file_save_failed_cb(gpointer data _U_)
 {
     /* Pop the "Saving:" message off the status bar. */
     statusbar_pop_file_msg();
@@ -798,8 +799,8 @@ statusbar_cf_callback(gint event, gpointer data, gpointer user_data _U_)
     case(cf_cb_file_closed):
         statusbar_cf_file_closed_cb(data);
         break;
-    case(cf_cb_file_read_start):
-        statusbar_cf_file_read_start_cb(data);
+    case(cf_cb_file_read_started):
+        statusbar_cf_file_read_started_cb(data);
         break;
     case(cf_cb_file_read_finished):
         statusbar_cf_file_read_finished_cb(data);
@@ -811,16 +812,16 @@ statusbar_cf_callback(gint event, gpointer data, gpointer user_data _U_)
     case(cf_cb_field_unselected):
         statusbar_cf_field_unselected_cb(data);
         break;
-    case(cf_cb_file_safe_started):
-        statusbar_cf_file_safe_started_cb(data);
+    case(cf_cb_file_save_started):
+        statusbar_cf_file_save_started_cb(data);
         break;
-    case(cf_cb_file_safe_finished):
-        statusbar_cf_file_safe_finished_cb(data);
+    case(cf_cb_file_save_finished):
+        statusbar_cf_file_save_finished_cb(data);
         break;
-    case(cf_cb_file_safe_reload_finished):
+    case(cf_cb_file_save_reload_finished):
         break;
-    case(cf_cb_file_safe_failed):
-        statusbar_cf_file_safe_failed_cb(data);
+    case(cf_cb_file_save_failed):
+        statusbar_cf_file_save_failed_cb(data);
         break;
     default:
         g_warning("statusbar_cf_callback: event %u unknown", event);
index c22e271e56f4627f03ca3e33bb8d26e62ebf59af..bd449d5a88a619dd8f64f680d645f42288e02e5f 100644 (file)
@@ -1858,7 +1858,7 @@ menu_open_filename(gchar *cf_name)
 
     /* open and read the capture file (this will close an existing file) */
     if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
-        cf_read(&cfile);
+        cf_read(&cfile, FALSE);
     } else {
         /* the capture file apparently no longer exists; remove menu item    */
         /* XXX: ask user to remove item, it's maybe only a temporary problem */
@@ -1886,7 +1886,7 @@ menu_open_recent_file_cmd(GtkWidget *w)
 
     /* open and read the capture file (this will close an existing file) */
     if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
-        cf_read(&cfile);
+        cf_read(&cfile, FALSE);
     } else {
         /* the capture file apparently no longer exists; remove menu item    */
         /* XXX: ask user to remove item, it's maybe only a temporary problem */