diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-08-06 19:22:04 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-08-06 19:22:04 +0000 |
commit | b104e6e3eb9d6027f578d287613cfc12742ddb50 (patch) | |
tree | 01bd31ca30bb2dd482d6febb727a17d6b9cff785 /gtk | |
parent | 2cd81cb109a420fbadbadfe7ea23dd77b84437a4 (diff) |
From Ian Schorr: fix a bug where addresses were drawn to the wrong rows
in the clist, and get rid of some duplicated code.
svn path=/trunk/; revision=11613
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/conversations_table.c | 81 | ||||
-rw-r--r-- | gtk/hostlist_table.c | 51 |
2 files changed, 14 insertions, 118 deletions
diff --git a/gtk/conversations_table.c b/gtk/conversations_table.c index 1db081879d..009fea679c 100644 --- a/gtk/conversations_table.c +++ b/gtk/conversations_table.c @@ -948,6 +948,9 @@ draw_ct_table_address(conversations_table *ct, int conversation_idx) char *port; address_type at; guint32 pt; + int rownum; + + rownum=gtk_clist_find_row_from_data(ct->table, (gpointer)conversation_idx); at = ct->conversations[conversation_idx].src_address.type; if(!ct->resolve_names) at = AT_NONE; @@ -961,7 +964,7 @@ draw_ct_table_address(conversations_table *ct, int conversation_idx) default: entry=address_to_str(&ct->conversations[conversation_idx].src_address); } - gtk_clist_set_text(ct->table, conversation_idx, 0, entry); + gtk_clist_set_text(ct->table, rownum, 0, entry); pt = ct->conversations[conversation_idx].port_type; if(!ct->resolve_names) pt = PT_NONE; @@ -976,7 +979,7 @@ draw_ct_table_address(conversations_table *ct, int conversation_idx) port=ct_port_to_str(ct->conversations[conversation_idx].port_type, ct->conversations[conversation_idx].src_port); entry=port?port:""; } - gtk_clist_set_text(ct->table, conversation_idx, 1, entry); + gtk_clist_set_text(ct->table, rownum, 1, entry); at = ct->conversations[conversation_idx].dst_address.type; if(!ct->resolve_names) at = AT_NONE; @@ -990,7 +993,7 @@ draw_ct_table_address(conversations_table *ct, int conversation_idx) default: entry=address_to_str(&ct->conversations[conversation_idx].dst_address); } - gtk_clist_set_text(ct->table, conversation_idx, 2, entry); + gtk_clist_set_text(ct->table, rownum, 2, entry); switch(pt) { case(PT_TCP): @@ -1003,7 +1006,7 @@ draw_ct_table_address(conversations_table *ct, int conversation_idx) port=ct_port_to_str(ct->conversations[conversation_idx].port_type, ct->conversations[conversation_idx].dst_port); entry=port?port:""; } - gtk_clist_set_text(ct->table, conversation_idx, 3, entry); + gtk_clist_set_text(ct->table, rownum, 3, entry); } /* Refresh the address fields of all entries in the list */ @@ -1011,77 +1014,9 @@ static void draw_ct_table_addresses(conversations_table *ct) { guint32 i; - int j; - for(i=0;i<ct->num_conversations;i++){ -#if 0 - char *entry; - char *port; - address_type at; - guint32 pt; -#endif - - j=gtk_clist_find_row_from_data(ct->table, (gpointer)i); - - draw_ct_table_address(ct, j); -#if 0 - at = ct->conversations[i].src_address.type; - if(!ct->resolve_names) at = AT_NONE; - switch(at) { - case(AT_IPv4): - entry=get_hostname((*(guint *)ct->conversations[i].src_address.data)); - break; - case(AT_ETHER): - entry=get_ether_name(ct->conversations[i].src_address.data); - break; - default: - entry=address_to_str(&ct->conversations[i].src_address); - } - gtk_clist_set_text(ct->table, j, 0, entry); - - pt = ct->conversations[i].port_type; - if(!ct->resolve_names) pt = PT_NONE; - switch(pt) { - case(PT_TCP): - entry=get_tcp_port(ct->conversations[i].src_port); - break; - case(PT_UDP): - entry=get_udp_port(ct->conversations[i].src_port); - break; - default: - port=ct_port_to_str(ct->conversations[i].port_type, ct->conversations[i].src_port); - entry=port?port:""; - } - gtk_clist_set_text(ct->table, j, 1, entry); - - at = ct->conversations[i].dst_address.type; - if(!ct->resolve_names) at = AT_NONE; - switch(at) { - case(AT_IPv4): - entry=get_hostname((*(guint *)ct->conversations[i].dst_address.data)); - break; - case(AT_ETHER): - entry=get_ether_name(ct->conversations[i].dst_address.data); - break; - default: - entry=address_to_str(&ct->conversations[i].dst_address); - } - gtk_clist_set_text(ct->table, j, 2, entry); - - switch(pt) { - case(PT_TCP): - entry=get_tcp_port(ct->conversations[i].dst_port); - break; - case(PT_UDP): - entry=get_udp_port(ct->conversations[i].dst_port); - break; - default: - port=ct_port_to_str(ct->conversations[i].port_type, ct->conversations[i].dst_port); - entry=port?port:""; - } - gtk_clist_set_text(ct->table, j, 3, entry); -#endif + draw_ct_table_address(ct, i); } } diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c index cdc51d75d0..6ec42c1859 100644 --- a/gtk/hostlist_table.c +++ b/gtk/hostlist_table.c @@ -461,6 +461,9 @@ draw_hostlist_table_address(hostlist_table *hl, int hostlist_idx) char *port; address_type at; guint32 pt; + int rownum; + + rownum=gtk_clist_find_row_from_data(hl->table, (gpointer)hostlist_idx); at = hl->hosts[hostlist_idx].address.type; if(!hl->resolve_names) at = AT_NONE; @@ -474,7 +477,7 @@ draw_hostlist_table_address(hostlist_table *hl, int hostlist_idx) default: entry=address_to_str(&hl->hosts[hostlist_idx].address); } - gtk_clist_set_text(hl->table, hostlist_idx, 0, entry); + gtk_clist_set_text(hl->table, rownum, 0, entry); pt = hl->hosts[hostlist_idx].port_type; if(!hl->resolve_names) pt = PT_NONE; @@ -489,7 +492,7 @@ draw_hostlist_table_address(hostlist_table *hl, int hostlist_idx) port=hostlist_port_to_str(hl->hosts[hostlist_idx].port_type, hl->hosts[hostlist_idx].port); entry=port?port:""; } - gtk_clist_set_text(hl->table, hostlist_idx, 1, entry); + gtk_clist_set_text(hl->table, rownum, 1, entry); } /* Refresh the address fields of all entries in the list */ @@ -497,51 +500,9 @@ static void draw_hostlist_table_addresses(hostlist_table *hl) { guint32 i; - int j; - for(i=0;i<hl->num_hosts;i++){ -#if 0 - char *entry; - char *port; - address_type at; - guint32 pt; -#endif - - j=gtk_clist_find_row_from_data(hl->table, (gpointer)i); - - draw_hostlist_table_address(hl, j); - -#if 0 - at = hl->hosts[i].address.type; - if(!hl->resolve_names) at = AT_NONE; - switch(at) { - case(AT_IPv4): - entry=get_hostname((*(guint *)hl->hosts[i].address.data)); - break; - case(AT_ETHER): - entry=get_ether_name(hl->hosts[i].address.data); - break; - default: - entry=address_to_str(&hl->hosts[i].address); - } - gtk_clist_set_text(hl->table, j, 0, entry); - - pt = hl->hosts[i].port_type; - if(!hl->resolve_names) pt = PT_NONE; - switch(pt) { - case(PT_TCP): - entry=get_tcp_port(hl->hosts[i].port); - break; - case(PT_UDP): - entry=get_udp_port(hl->hosts[i].port); - break; - default: - port=hostlist_port_to_str(hl->hosts[i].port_type, hl->hosts[i].port); - entry=port?port:""; - } - gtk_clist_set_text(hl->table, j, 1, entry); -#endif + draw_hostlist_table_address(hl, i); } } |