aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/proto_draw.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-08-21 15:23:48 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-08-21 15:23:48 +0000
commit06c86303e792bb97df53fafd7029f7eb4207b3e2 (patch)
tree0d7c6cbf6b75941eb3a62fa3c173695b64ecaaca /gtk/proto_draw.c
parent808b6d48d0e365dd8790c01d8c9d5a32545d9ba5 (diff)
The protocol item in the protocol tree will have a gray background now, which makes it much better visible.
Add some more optional flags to the protocol items, so more "special cases" can be marked in the protocol tree. New flags: /** The protocol field has a bad checksum */ FI_CHECKSUM_ERROR /** The protocol field has an unusual sequence (e.g. TCP window is zero) */ FI_SEQUENCE_WARNING /** The protocol field has a bad sequence (e.g. TCP segment is lost) */ FI_SEQUENCE_ERROR svn path=/trunk/; revision=15499
Diffstat (limited to 'gtk/proto_draw.c')
-rw-r--r--gtk/proto_draw.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index bc5632da63..b2fd2340b3 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1613,9 +1613,23 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
gtk_tree_model_get(tree_model, iter, 1, &fi, -1);
+ /* for the various possible attributes, see:
+ * http://developer.gnome.org/doc/API/2.0/gtk/GtkCellRendererText.html
+ *
+ * color definitions can be found at:
+ * http://cvs.gnome.org/viewcvs/gtk+/gdk-pixbuf/io-xpm.c?rev=1.42
+ *
+ * some experiences:
+ * background-gdk: doesn't seem to work (probably the GdkColor must be allocated)
+ * weight/style: doesn't take any effect
+ */
+
/* for each field, we have to reset the renderer attributes */
g_object_set (cell, "foreground-set", FALSE, NULL);
+ g_object_set (cell, "background", "white", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+
g_object_set (cell, "underline", PANGO_UNDERLINE_NONE, NULL);
g_object_set (cell, "underline-set", FALSE, NULL);
@@ -1625,6 +1639,21 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
/*g_object_set (cell, "weight", PANGO_WEIGHT_NORMAL, NULL);
g_object_set (cell, "weight-set", FALSE, NULL);*/
+ if(FI_GET_FLAG(fi, FI_CHECKSUM_ERROR)) {
+ g_object_set (cell, "background", "red", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ }
+
+ if(FI_GET_FLAG(fi, FI_SEQUENCE_WARNING)) {
+ g_object_set (cell, "background", "yellow", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ }
+
+ if(FI_GET_FLAG(fi, FI_SEQUENCE_ERROR)) {
+ g_object_set (cell, "background", "red", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ }
+
if(FI_GET_FLAG(fi, FI_GENERATED)) {
/* as some fonts don't support italic, don't use this */
/*g_object_set (cell, "style", PANGO_STYLE_ITALIC, NULL);
@@ -1634,6 +1663,13 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
g_object_set (cell, "weight-set", TRUE, NULL);*/
}
+ if(fi->hfinfo->type == FT_PROTOCOL) {
+ g_object_set (cell, "background", "gray90", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ /*g_object_set (cell, "weight", PANGO_WEIGHT_BOLD, NULL);
+ g_object_set (cell, "weight-set", TRUE, NULL);*/
+ }
+
if(fi->hfinfo->type == FT_FRAMENUM) {
g_object_set (cell, "foreground", "blue", NULL);
g_object_set (cell, "foreground-set", TRUE, NULL);
@@ -1899,6 +1935,7 @@ tree_view_select(GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
+/* fill the whole protocol tree with the string values */
void
proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view)
{
@@ -1937,6 +1974,8 @@ proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view)
#endif
}
+
+/* fill a single protocol tree item with the string value */
static void
proto_tree_draw_node(proto_node *node, gpointer data)
{