fix statusbar messages by splitting into update and fixed messages between capture and main
svn path=/trunk/; revision=14044
This commit is contained in:
parent
adc2bf61a8
commit
163f2b61a8
17
capture.c
17
capture.c
|
@ -221,9 +221,12 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file)
|
|||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
cf_callback_invoke(cf_cb_live_capture_update_started, capture_opts->cf);
|
||||
} else {
|
||||
cf_callback_invoke(cf_cb_live_capture_fixed_started, capture_opts->cf);
|
||||
}
|
||||
|
||||
cf_callback_invoke(cf_cb_live_capture_started, capture_opts->cf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -269,6 +272,9 @@ capture_input_closed(capture_options *capture_opts)
|
|||
|
||||
|
||||
if(capture_opts->real_time_mode) {
|
||||
/* first of all, we are not doing a capture any more */
|
||||
cf_callback_invoke(cf_cb_live_capture_update_finished, capture_opts->cf);
|
||||
|
||||
/* Read what remains of the capture file, and finish the capture.
|
||||
XXX - do something if this fails? */
|
||||
switch (cf_finish_tail(capture_opts->cf, &err)) {
|
||||
|
@ -296,17 +302,14 @@ capture_input_closed(capture_options *capture_opts)
|
|||
}
|
||||
|
||||
} else {
|
||||
/* first of all, we are not doing a capture any more */
|
||||
cf_callback_invoke(cf_cb_live_capture_fixed_finished, capture_opts->cf);
|
||||
|
||||
/* this is a normal mode capture, read in the capture file data */
|
||||
capture_input_read_all(capture_opts, cf_is_tempfile(capture_opts->cf),
|
||||
cf_get_drops_known(capture_opts->cf), cf_get_drops(capture_opts->cf));
|
||||
}
|
||||
|
||||
/* if we have captured some packets, call cf_cb_live_capture_finished! */
|
||||
/* (otherwise we already have called cf_close) */
|
||||
if(cf_packet_count(capture_opts->cf) != 0) {
|
||||
cf_callback_invoke(cf_cb_live_capture_finished, capture_opts->cf);
|
||||
}
|
||||
|
||||
/* We're not doing a capture any more, so we don't have a save file. */
|
||||
g_assert(capture_opts->save_file);
|
||||
g_free(capture_opts->save_file);
|
||||
|
|
6
file.h
6
file.h
|
@ -61,8 +61,10 @@ typedef enum {
|
|||
cf_cb_file_read_finished,
|
||||
#ifdef HAVE_LIBPCAP
|
||||
cf_cb_live_capture_prepare,
|
||||
cf_cb_live_capture_started,
|
||||
cf_cb_live_capture_finished,
|
||||
cf_cb_live_capture_update_started,
|
||||
cf_cb_live_capture_fixed_started,
|
||||
cf_cb_live_capture_update_finished,
|
||||
cf_cb_live_capture_fixed_finished,
|
||||
#endif
|
||||
cf_cb_packet_selected,
|
||||
cf_cb_packet_unselected,
|
||||
|
|
70
gtk/main.c
70
gtk/main.c
|
@ -795,6 +795,7 @@ void resolve_name_cb(GtkWidget *widget _U_, gpointer data _U_) {
|
|||
void
|
||||
statusbar_push_file_msg(gchar *msg)
|
||||
{
|
||||
/*g_warning("statusbar_push: %s", msg);*/
|
||||
gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, msg);
|
||||
}
|
||||
|
||||
|
@ -804,6 +805,7 @@ statusbar_push_file_msg(gchar *msg)
|
|||
void
|
||||
statusbar_pop_file_msg(void)
|
||||
{
|
||||
/*g_warning("statusbar_pop");*/
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1294,7 @@ main_cf_cb_live_capture_prepare(capture_options *capture_opts)
|
|||
}
|
||||
|
||||
static void
|
||||
main_cf_cb_live_capture_started(capture_options *capture_opts)
|
||||
main_cf_cb_live_capture_update_started(capture_options *capture_opts)
|
||||
{
|
||||
gchar *capture_msg;
|
||||
|
||||
|
@ -1319,7 +1321,36 @@ main_cf_cb_live_capture_started(capture_options *capture_opts)
|
|||
}
|
||||
|
||||
static void
|
||||
main_cf_cb_live_capture_finished(capture_file *cf)
|
||||
main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
|
||||
{
|
||||
gchar *capture_msg;
|
||||
|
||||
/* Disable menu items that make no sense if you're currently running
|
||||
a capture. */
|
||||
set_menus_for_capture_in_progress(TRUE);
|
||||
|
||||
/* Enable menu items that make sense if you have some captured
|
||||
packets (yes, I know, we don't have any *yet*). */
|
||||
/*set_menus_for_captured_packets(TRUE);*/
|
||||
|
||||
if(capture_opts->iface) {
|
||||
capture_msg = g_strdup_printf(" %s: <live capture in progress>", get_interface_descriptive_name(capture_opts->iface));
|
||||
} else {
|
||||
capture_msg = g_strdup_printf(" <live capture in progress>");
|
||||
}
|
||||
|
||||
statusbar_push_file_msg(capture_msg);
|
||||
|
||||
g_free(capture_msg);
|
||||
|
||||
/* Set up main window for a capture file. */
|
||||
/* main_set_for_capture_file(TRUE);*/
|
||||
/* XXX: shouldn't be already set */
|
||||
main_set_for_capture_file(FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
main_cf_cb_live_capture_update_finished(capture_file *cf)
|
||||
{
|
||||
/* Pop the "<live capture in progress>" message off the status bar. */
|
||||
statusbar_pop_file_msg();
|
||||
|
@ -1338,6 +1369,27 @@ main_cf_cb_live_capture_finished(capture_file *cf)
|
|||
/* Set up main window for a capture file. */
|
||||
main_set_for_capture_file(TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
main_cf_cb_live_capture_fixed_finished(capture_file *cf)
|
||||
{
|
||||
/* Pop the "<live capture in progress>" message off the status bar. */
|
||||
statusbar_pop_file_msg();
|
||||
|
||||
/*set_display_filename(cf);*/
|
||||
|
||||
/* Enable menu items that make sense if you're not currently running
|
||||
a capture. */
|
||||
set_menus_for_capture_in_progress(FALSE);
|
||||
|
||||
/* Enable menu items that make sense if you have a capture file
|
||||
you've finished reading. */
|
||||
set_menus_for_capture_file(TRUE);
|
||||
set_menus_for_unsaved_capture_file(!cf->user_saved);
|
||||
|
||||
/* Set up main window for a capture file. */
|
||||
main_set_for_capture_file(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
|
@ -1422,11 +1474,17 @@ void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
|
|||
case(cf_cb_live_capture_prepare):
|
||||
main_cf_cb_live_capture_prepare(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_started):
|
||||
main_cf_cb_live_capture_started(data);
|
||||
case(cf_cb_live_capture_update_started):
|
||||
main_cf_cb_live_capture_update_started(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_finished):
|
||||
main_cf_cb_live_capture_finished(data);
|
||||
case(cf_cb_live_capture_fixed_started):
|
||||
main_cf_cb_live_capture_fixed_started(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_update_finished):
|
||||
main_cf_cb_live_capture_update_finished(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_fixed_finished):
|
||||
main_cf_cb_live_capture_fixed_finished(data);
|
||||
break;
|
||||
#endif
|
||||
case(cf_cb_packet_selected):
|
||||
|
|
Loading…
Reference in New Issue