Ethereal-dev: [ethereal-dev] Wish-List item #32
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: "Paul D. Walker" <pdwalker@xxxxxxxxxxxx>
Date: Sun, 5 Mar 2000 11:52:52 +0800
Hi Guys, This small patch allows you to sort the contents of the packet window by clicking on the appropriate header. If you like it, you can include it. Oh, the comment sucks. It's 4am and it seemed ok an hour ago. - Paul pdwalker@xxxxxxxxxxxx Index: main.c =================================================================== RCS file: /cvsroot/ethereal/gtk/main.c,v retrieving revision 1.108 diff -u -r1.108 main.c --- main.c 2000/03/02 07:05:56 1.108 +++ main.c 2000/03/04 19:49:34 @@ -823,6 +823,23 @@ filter_packets(&cf, NULL); } +/* Clicking on the heading of a column does this */ +static void +packet_list_click_column (GtkCList *packet_list, gint column, gpointer data) +{ + if (column == packet_list->sort_column) { + if (packet_list->sort_type == GTK_SORT_ASCENDING) + packet_list->sort_type = GTK_SORT_DESCENDING; + else + packet_list->sort_type = GTK_SORT_ASCENDING; + } + else { + gtk_clist_set_sort_column (packet_list, column); + } + + gtk_clist_sort (packet_list); +} + /* What to do when a list item is selected/unselected */ static void packet_list_select_cb(GtkWidget *w, gint row, gint col, gpointer evt) { @@ -1585,7 +1602,11 @@ packet_list = gtk_clist_new_with_titles(cf.cinfo.num_cols, cf.cinfo.col_title); gtk_container_add(GTK_CONTAINER(pkt_scrollw), packet_list); - gtk_clist_column_titles_passive(GTK_CLIST(packet_list)); + /* gtk_clist_column_titles_passive(GTK_CLIST(packet_list)); */ + gtk_clist_column_titles_active(GTK_CLIST(packet_list)); + gtk_signal_connect(GTK_OBJECT(packet_list),"click_column", + GTK_SIGNAL_FUNC(packet_list_click_column), NULL); + set_plist_sel_browse(prefs->gui_plist_sel_browse); pl_style = gtk_style_new(); gdk_font_unref(pl_style->font);
Index: main.c =================================================================== RCS file: /cvsroot/ethereal/gtk/main.c,v retrieving revision 1.108 diff -u -r1.108 main.c --- main.c 2000/03/02 07:05:56 1.108 +++ main.c 2000/03/04 19:49:34 @@ -823,6 +823,23 @@ filter_packets(&cf, NULL); } +/* Clicking on the heading of a column does this */ +static void +packet_list_click_column (GtkCList *packet_list, gint column, gpointer data) +{ + if (column == packet_list->sort_column) { + if (packet_list->sort_type == GTK_SORT_ASCENDING) + packet_list->sort_type = GTK_SORT_DESCENDING; + else + packet_list->sort_type = GTK_SORT_ASCENDING; + } + else { + gtk_clist_set_sort_column (packet_list, column); + } + + gtk_clist_sort (packet_list); +} + /* What to do when a list item is selected/unselected */ static void packet_list_select_cb(GtkWidget *w, gint row, gint col, gpointer evt) { @@ -1585,7 +1602,11 @@ packet_list = gtk_clist_new_with_titles(cf.cinfo.num_cols, cf.cinfo.col_title); gtk_container_add(GTK_CONTAINER(pkt_scrollw), packet_list); - gtk_clist_column_titles_passive(GTK_CLIST(packet_list)); + /* gtk_clist_column_titles_passive(GTK_CLIST(packet_list)); */ + gtk_clist_column_titles_active(GTK_CLIST(packet_list)); + gtk_signal_connect(GTK_OBJECT(packet_list),"click_column", + GTK_SIGNAL_FUNC(packet_list_click_column), NULL); + set_plist_sel_browse(prefs->gui_plist_sel_browse); pl_style = gtk_style_new(); gdk_font_unref(pl_style->font);
- Follow-Ups:
- Re: [ethereal-dev] Wish-List item #32
- From: Gilbert Ramirez
- Re: [ethereal-dev] Wish-List item #32
- Prev by Date: Re: [ethereal-dev] Re: Packet Sniffer Package
- Next by Date: Re: [ethereal-dev] Wish-List item #32
- Previous by thread: Re: [ethereal-dev] Re: Packet Sniffer Package
- Next by thread: Re: [ethereal-dev] Wish-List item #32
- Index(es):