diff options
author | Michael Tüxen <tuexen@fh-muenster.de> | 2011-05-19 16:11:02 +0000 |
---|---|---|
committer | Michael Tüxen <tuexen@fh-muenster.de> | 2011-05-19 16:11:02 +0000 |
commit | 79f53d1fdca2b4f675aee5752afd03f567f94490 (patch) | |
tree | d32e8d48e338fb00c7906b900cfa6f3c7f056a44 | |
parent | 60822702bbbed16fea95cc0045f44c2081393f0a (diff) |
When capturing from multiple interface, indicate this in the main status bar.
This patch is, as all other patches related to capturing from multiple interfaces,
based on work of Irene Ruengeler.
svn path=/trunk/; revision=37296
-rw-r--r-- | gtk/main_statusbar.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/gtk/main_statusbar.c b/gtk/main_statusbar.c index 8d9f136121..9e246191f1 100644 --- a/gtk/main_statusbar.c +++ b/gtk/main_statusbar.c @@ -688,16 +688,44 @@ statusbar_capture_prepared_cb(capture_options *capture_opts _U_) welcome_header_push_msg(msg); } +static GString * +statusbar_get_interface_names(capture_options *capture_opts) +{ + guint i; + GString *interface_names; + + interface_names = g_string_new(""); +#ifdef _WIN32 + if (capture_opts->ifaces->len < 2) { +#else + if (capture_opts->ifaces->len < 4) { +#endif + for (i = 0; i < capture_opts->ifaces->len; i++) { + if (i > 0) { + g_string_append_printf(interface_names, ", "); + } + g_string_append_printf(interface_names, "%s", get_iface_description_for_interface(capture_opts, i)); + } + } else { + g_string_append_printf(interface_names, "%u interfaces", capture_opts->ifaces->len); + } + return (interface_names); +} + static void statusbar_capture_update_started_cb(capture_options *capture_opts) { statusbar_pop_file_msg(); welcome_header_pop_msg(); - if(capture_opts->iface) { + if (capture_opts->ifaces->len > 0) { + GString *interface_names; + + interface_names = statusbar_get_interface_names(capture_opts); statusbar_push_file_msg(" %s: <live capture in progress> to file: %s", - get_iface_description(capture_opts), + interface_names->str, (capture_opts->save_file) ? capture_opts->save_file : ""); + g_string_free(interface_names, TRUE); } else { statusbar_push_file_msg(" <live capture in progress> to file: %s", (capture_opts->save_file) ? capture_opts->save_file : ""); @@ -707,28 +735,31 @@ statusbar_capture_update_started_cb(capture_options *capture_opts) static void statusbar_capture_update_continue_cb(capture_options *capture_opts) { + GString *interface_names; capture_file *cf = capture_opts->cf; status_expert_update(); statusbar_pop_file_msg(); + interface_names = statusbar_get_interface_names(capture_opts); if (cf->f_datalen/1024/1024 > 10) { statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB", - get_iface_description(capture_opts), + interface_names->str, capture_opts->save_file, cf->f_datalen/1024/1024); } else if (cf->f_datalen/1024 > 10) { statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB", - get_iface_description(capture_opts), + interface_names->str, capture_opts->save_file, cf->f_datalen/1024); } else { statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes", - get_iface_description(capture_opts), + interface_names->str, capture_opts->save_file, cf->f_datalen); } + g_string_free(interface_names, TRUE); } static void @@ -745,13 +776,17 @@ statusbar_capture_update_finished_cb(capture_options *capture_opts) static void statusbar_capture_fixed_started_cb(capture_options *capture_opts) { + GString *interface_names; + statusbar_pop_file_msg(); + interface_names = statusbar_get_interface_names(capture_opts); statusbar_push_file_msg(" %s: <live capture in progress> to file: %s", - get_iface_description(capture_opts), + interface_names->str, (capture_opts->save_file) ? capture_opts->save_file : ""); gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " Packets: 0"); + g_string_free(interface_names, TRUE); } static void |