Don't have "set_menus_for_captured_packets()" call
authorGuy Harris <guy@alum.mit.edu>
Sun, 6 Feb 2005 23:16:05 +0000 (23:16 -0000)
committerGuy Harris <guy@alum.mit.edu>
Sun, 6 Feb 2005 23:16:05 +0000 (23:16 -0000)
"main_set_for_capture_file()"; it should only deal with menus, not
anything else - and it gets called while the menus are being set up,
which is before the main window has been completely created, so
"main_widgets_show_or_hide()", which is called by
"main_set_for_capture_file()", gets errors trying to show or hide
widgets the pointers to which are null.

svn path=/trunk/; revision=13328

Makefile.common
file.c
gtk/main.c
gtk/main.h
gtk/menu.c
main_window.h [new file with mode: 0644]

index 57bf1e8111af7b39ded4a73eb046883398ecd34a..11fbef7db16cbda679cc56671774143ee8ad2142 100644 (file)
@@ -161,6 +161,7 @@ ethereal_INCLUDES = \
        filters.h       \
        g711.h  \
        globals.h       \
+       main_window.h   \
        menu.h  \
        merge.h \
        progress_dlg.h  \
diff --git a/file.c b/file.c
index cd2212b9877b3950fb159bbdb915ec7da47b6335..8f7d7ba1e49658b8fc8b4cc45f922f784303039c 100644 (file)
--- a/file.c
+++ b/file.c
@@ -73,6 +73,7 @@
 #include "packet-range.h"
 #include "print.h"
 #include "file.h"
+#include "main_window.h"
 #include "menu.h"
 #include "util.h"
 #include "merge.h"
@@ -289,6 +290,9 @@ cf_close(capture_file *cf)
   set_menus_for_capture_in_progress(FALSE);
   set_menus_for_selected_tree_row(cf);
 
+  /* Set up main window for no capture file. */
+  main_set_for_capture_file(FALSE);
+
   reset_tap_listeners();
 
   /* We have no file open. */
@@ -475,6 +479,9 @@ cf_read(capture_file *cf)
   set_menus_for_capture_file(TRUE);
   set_menus_for_unsaved_capture_file(!cf->user_saved);
 
+  /* Set up main window for a capture file. */
+  main_set_for_capture_file(TRUE);
+
   /* Enable menu items that make sense if you have some captured packets. */
   set_menus_for_captured_packets(TRUE);
 
@@ -546,6 +553,9 @@ cf_start_tail(capture_file *cf, const char *fname, const char *iface, gboolean i
        packets (yes, I know, we don't have any *yet*). */
     set_menus_for_captured_packets(TRUE);
 
+    /* Set up main window for a capture file. */
+    main_set_for_capture_file(TRUE);
+
     capture_msg = g_strdup_printf(" %s: <live capture in progress>", get_interface_descriptive_name(iface));
 
     statusbar_push_file_msg(capture_msg);
@@ -673,6 +683,9 @@ cf_finish_tail(capture_file *cf, int *err)
   set_menus_for_capture_file(TRUE);
   set_menus_for_unsaved_capture_file(!cf->user_saved);
 
+  /* Set up main window for a capture file. */
+  main_set_for_capture_file(TRUE);
+
   if (*err != 0) {
     /* We got an error reading the capture file.
        XXX - pop up a dialog box? */
index 91b3703772b19ae3acded9651a94d212cbfc0004..aed7c2ed5d57d110d4bbec96f78dab229fc2419b 100644 (file)
 
 #include "main.h"
 #include "menu.h"
+#include "../main_window.h"
 #include "../menu.h"
 #include "file_dlg.h"
 #include <epan/column.h>
index 17cfb0610c6953082a45ed494764950d56229f1c..e3a0b2cfb7c4189a8cef216ef7c276d6a0fbbef0 100644 (file)
@@ -276,10 +276,6 @@ extern void dnd_open_file_cmd(GtkSelectionData *selection_data);
 /** Update the packets statusbar to the current values. */
 extern void packets_bar_update(void);
 
-/** Tell the main window that we have a capture file (or not) */
-extern void
-main_set_for_capture_file(gboolean have_capture_file_in);
-
 #ifdef _WIN32
 /** Win32 only: Create a console. Beware: cannot be closed again. */
 extern void create_console(void);
index 34eca34bfc9ea5be2edbf8b48f2f5f8025d412e2..8bab6c73bb7d3c1bc1998e1b7b0dbc4af513c3e4 100644 (file)
@@ -1632,7 +1632,6 @@ set_menus_for_captured_packets(gboolean have_captured_packets)
       have_captured_packets);
   set_toolbar_for_captured_packets(have_captured_packets);
   packets_bar_update();
-  main_set_for_capture_file(have_captured_packets);
 }
 
 /* Enable or disable menu items based on whether a packet is selected and,
diff --git a/main_window.h b/main_window.h
new file mode 100644 (file)
index 0000000..a5e4a54
--- /dev/null
@@ -0,0 +1,41 @@
+/* main_window.h
+ * Definitions for main window routines with toolkit-independent APIs but
+ * toolkit-dependent implementations.
+ *
+ * $Id$
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef __MAIN_WINDOW_H__
+#define __MAIN_WINDOW_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Tell the main window that we have a capture file (or not) */
+extern void
+main_set_for_capture_file(gboolean have_capture_file_in);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MAIN_WINDOW_H__ */