Part 2 of the "unmarking a packet matching a color filter does not apply
authorobiot <obiot@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 9 Jan 2004 20:20:42 +0000 (20:20 +0000)
committerobiot <obiot@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 9 Jan 2004 20:20:42 +0000 (20:20 +0000)
the color filter's colors" bug: keep a list of removed color filters, so
there's no problem if we delete a color filter for which there are one or
more packets that have its colors. Only get rid of the lists when they
ar no longer needed.

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

color.h
gtk/color_dlg.c
gtk/color_filters.c

diff --git a/color.h b/color.h
index cc71915cd090df4a83f7e2338efd7705ec877f84..4c99dde9d8968d6ff63f4387e92a40b076942358 100644 (file)
--- a/color.h
+++ b/color.h
@@ -1,7 +1,7 @@
 /* color.h
  * Definitions for "toolkit-independent" colors
  *
- * $Id: color.h,v 1.4 2003/08/18 21:27:07 sahlberg Exp $
+ * $Id: color.h,v 1.5 2004/01/09 20:19:34 obiot Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -58,6 +58,7 @@ typedef struct _color_filter {
 
 /* List of all color filters. */
 extern GSList *filter_list;
+extern GSList *removed_filter_list;
 
 void
 filter_list_prime_edt(epan_dissect_t *edt);
index 34cfdb0b3e54652d46d84984b14b83801154f04f..e0fc72513050a316615037643ddf04fdebee169a 100644 (file)
@@ -1,7 +1,7 @@
 /* color_dlg.c
  * Definitions for dialog boxes for color filters
  *
- * $Id: color_dlg.c,v 1.29 2004/01/02 00:19:59 sharpe Exp $
+ * $Id: color_dlg.c,v 1.30 2004/01/09 20:20:41 obiot Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1045,7 +1045,7 @@ color_delete(gint row, GtkWidget  *color_filters)
     gtk_widget_destroy(colorf->edit_dialog);
     
     /* Remove the color filter from the list of color filters. */
-    delete_color_filter(colorf);
+    remove_color_filter(colorf);
     
     /* If we grab the focus after updating the selection, the first
     * row is always selected, so we do it before */
@@ -1063,7 +1063,7 @@ color_delete(gint row, GtkWidget  *color_filters)
         gtk_widget_destroy(colorf->edit_dialog);
 
     /* Remove the color filter from the list of color filters. */
-    delete_color_filter(colorf);
+    remove_color_filter(colorf);
 
 #endif
 }
index a3efb3e32394d403c9c5327d1b34ba6ea5674174..0dbd0a49816d10acf2cc1ab7b76ff8343eff2f06 100644 (file)
@@ -1,7 +1,7 @@
 /* color_filters.c
  * Routines for color filters
  *
- * $Id: color_filters.c,v 1.4 2003/08/27 22:55:51 guy Exp $
+ * $Id: color_filters.c,v 1.5 2004/01/09 20:20:42 obiot Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -49,6 +49,20 @@ static gboolean read_filters(void);
 static gboolean read_global_filters(void);
 
 GSList *filter_list;
+GSList *removed_filter_list;
+
+/* Remove the specified filter from the list of existing color filters,
+ * and add it to the list of removed color filters.
+ * This way, unmarking and marking a packet which matches a now removed
+ * color filter will still be colored correctly as the color filter is
+ * still reachable. */
+void remove_color_filter(color_filter_t *colorf)
+{
+       /* Remove colorf from the list of color filters */
+       filter_list = g_slist_remove(filter_list, colorf);
+       /* Add colorf to the list of removed color filters */
+       removed_filter_list = g_slist_prepend(removed_filter_list, colorf);
+}
 
 /* delete the specified filter */
 void
@@ -79,6 +93,7 @@ static void
 delete_all_color_filters (void)
 {
         g_slist_foreach(filter_list, delete_color_filter_it, NULL);
+        g_slist_foreach(removed_filter_list, delete_color_filter_it, NULL);
 }
 
 /* Initialize the filter structures (reading from file) for general running, including app startup */