aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2007-12-05 23:50:28 +0000
committerGerald Combs <gerald@wireshark.org>2007-12-05 23:50:28 +0000
commite66660cd8458e00ef70d1cca90dc7882ff129720 (patch)
tree2b74e54c845ec2fbbd0b15b9b28c542ae9c77550
parent325b3355053c477c2877d10bf6721ead9c416e16 (diff)
downloadwireshark-e66660cd8458e00ef70d1cca90dc7882ff129720.tar.gz
wireshark-e66660cd8458e00ef70d1cca90dc7882ff129720.tar.bz2
wireshark-e66660cd8458e00ef70d1cca90dc7882ff129720.zip
Make sure the "auto scroll in live capture" toolbar button and menu item
correctly reflect the auto scroll state. Re-enable the ability to use the auto scroll toolbar button and menu item during a live capture. svn path=/trunk/; revision=23777
-rw-r--r--file.c28
-rw-r--r--gtk/packet_list.c22
-rw-r--r--gtk/packet_list.h5
-rw-r--r--ui_util.h2
4 files changed, 33 insertions, 24 deletions
diff --git a/file.c b/file.c
index 7fc172dc21..df6d6dcd22 100644
--- a/file.c
+++ b/file.c
@@ -393,7 +393,7 @@ cf_read(capture_file *cf)
dfilter_t *dfcode;
/* Compile the current display filter.
- * We assume this will not fail since cf->dfilter is only set in
+ * We assume this will not fail since cf->dfilter is only set in
* cf_filter IFF the filter was valid.
*/
dfcode=NULL;
@@ -628,10 +628,9 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
gchar *err_info;
volatile int newly_displayed_packets = 0;
dfilter_t *dfcode;
- gboolean at_end;
/* Compile the current display filter.
- * We assume this will not fail since cf->dfilter is only set in
+ * We assume this will not fail since cf->dfilter is only set in
* cf_filter IFF the filter was valid.
*/
dfcode=NULL;
@@ -641,7 +640,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
*err = 0;
- at_end = packet_list_at_end();
+ packet_list_check_end();
packet_list_freeze();
/*g_log(NULL, G_LOG_LEVEL_MESSAGE, "cf_continue_tail: %u new: %u", cf->count, to_read);*/
@@ -697,13 +696,13 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
/* XXX - this causes "flickering" of the list */
packet_list_thaw();
- /* moving to the end of the packet list - if the user requested so and
+ /* moving to the end of the packet list - if the user requested so and
we have some new packets.
this doesn't seem to work well with a frozen GTK_Clist, so do this after
packet_list_thaw() is done, see bugzilla 1188 */
/* XXX - this cheats and looks inside the packet list to find the final
row number. */
- if (newly_displayed_packets && auto_scroll_live && cf->plist_end != NULL && at_end)
+ if (newly_displayed_packets && auto_scroll_live && cf->plist_end != NULL)
packet_list_moveto_end();
if (cf->state == FILE_READ_ABORTED) {
@@ -730,10 +729,9 @@ cf_finish_tail(capture_file *cf, int *err)
gchar *err_info;
gint64 data_offset;
dfilter_t *dfcode;
- gboolean at_end;
/* Compile the current display filter.
- * We assume this will not fail since cf->dfilter is only set in
+ * We assume this will not fail since cf->dfilter is only set in
* cf_filter IFF the filter was valid.
*/
dfcode=NULL;
@@ -746,7 +744,7 @@ cf_finish_tail(capture_file *cf, int *err)
return CF_READ_ERROR;
}
- at_end = packet_list_at_end();
+ packet_list_check_end();
packet_list_freeze();
while ((wtap_read(cf->wth, err, &err_info, &data_offset))) {
@@ -776,7 +774,7 @@ cf_finish_tail(capture_file *cf, int *err)
return CF_READ_ABORTED;
}
- if (auto_scroll_live && cf->plist_end != NULL && at_end)
+ if (auto_scroll_live && cf->plist_end != NULL)
/* XXX - this cheats and looks inside the packet list to find the final
row number. */
packet_list_moveto_end();
@@ -1460,7 +1458,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
dfilter_t *dfcode;
/* Compile the current display filter.
- * We assume this will not fail since cf->dfilter is only set in
+ * We assume this will not fail since cf->dfilter is only set in
* cf_filter IFF the filter was valid.
*/
dfcode=NULL;
@@ -2835,7 +2833,7 @@ match_unicode(capture_file *cf, frame_data *fdata, void *criterion)
i++;
if (c_match == textlen) {
frame_matched = TRUE;
- cf->search_pos = i; /* Save the position of the last character
+ cf->search_pos = i; /* Save the position of the last character
for highlighting the field. */
break;
}
@@ -2863,7 +2861,7 @@ match_binary(capture_file *cf, frame_data *fdata, void *criterion)
c_match++;
if (c_match == datalen) {
frame_matched = TRUE;
- cf->search_pos = i; /* Save the position of the last character
+ cf->search_pos = i; /* Save the position of the last character
for highlighting the field. */
break;
}
@@ -3253,9 +3251,9 @@ cf_select_packet(capture_file *cf, int row)
epan_dissect_run(cf->edt, &cf->pseudo_header, cf->pd, cf->current_frame,
NULL);
-
+
dfilter_macro_build_ftv_cache(cf->edt->tree);
-
+
cf_callback_invoke(cf_cb_packet_selected, cf);
}
diff --git a/gtk/packet_list.c b/gtk/packet_list.c
index 2540102a3b..0279e0179b 100644
--- a/gtk/packet_list.c
+++ b/gtk/packet_list.c
@@ -107,6 +107,7 @@ typedef struct column_arrows {
} column_arrows;
GtkWidget *packet_list;
+static gboolean last_at_end = FALSE;
/* EthClist compare routine, overrides default to allow numeric comparison */
@@ -776,16 +777,25 @@ packet_list_moveto_end(void)
}
gboolean
-packet_list_at_end(void)
+packet_list_check_end(void)
{
+ gboolean at_end = FALSE;
+ GtkAdjustment *adj;
+
g_return_val_if_fail (packet_list != NULL, FALSE);
- g_return_val_if_fail (ETH_CLIST(packet_list) != NULL, FALSE);
+ adj = eth_clist_get_vadjustment(ETH_CLIST(packet_list));
+ g_return_val_if_fail (adj != NULL, FALSE);
- if (eth_clist_row_is_visible(ETH_CLIST(packet_list), ETH_CLIST(packet_list)->rows - 1) == GTK_VISIBILITY_NONE){
- return FALSE;
- } else {
- return TRUE;
+ if (adj->value >= adj->upper - adj->page_size) {
+ at_end = TRUE;
}
+
+ if (adj->value > 0 && at_end != last_at_end && at_end != auto_scroll_live) {
+ menu_auto_scroll_live_changed(at_end);
+ }
+
+ last_at_end = at_end;
+ return at_end;
}
gint
diff --git a/gtk/packet_list.h b/gtk/packet_list.h
index b00c7ca80f..87d3d06069 100644
--- a/gtk/packet_list.h
+++ b/gtk/packet_list.h
@@ -111,11 +111,12 @@ extern void packet_list_next(void);
*/
extern void packet_list_prev(void);
-/** Get if the packet list is at its end.
+/** Check to see if the packet list is at its end. Toggles automatic
+ * scrolling if needed.
*
* @return TRUE if packet list is scrolled to greater than 90% of its total length.
*/
-extern gboolean packet_list_at_end(void);
+extern gboolean packet_list_check_end(void);
/* Different modes of copying summary data */
typedef enum {
diff --git a/ui_util.h b/ui_util.h
index 69cfc10eb8..6c8d94d5b8 100644
--- a/ui_util.h
+++ b/ui_util.h
@@ -69,7 +69,7 @@ gpointer packet_list_get_row_data(gint);
void packet_list_set_selected_row(gint);
gint packet_list_get_sort_column(void);
void packet_list_set_sort_column(void);
-gboolean packet_list_at_end(void);
+gboolean packet_list_check_end(void);
#ifdef __cplusplus