diff options
-rw-r--r-- | Makefile.common | 1 | ||||
-rw-r--r-- | file.c | 13 | ||||
-rw-r--r-- | gtk/Makefile.common | 1 | ||||
-rw-r--r-- | gtk/filter_dlg.c | 6 | ||||
-rw-r--r-- | gtk/find_dlg.c | 17 | ||||
-rw-r--r-- | gtk/main.c | 2 | ||||
-rw-r--r-- | gtk/main_packet_list.c | 2 | ||||
-rw-r--r-- | gtk/main_statusbar.c | 14 | ||||
-rw-r--r-- | gtk/menus.c | 7 | ||||
-rw-r--r-- | gtk/new_packet_list.c | 2 | ||||
-rw-r--r-- | gtk/simple_dialog.c | 20 | ||||
-rw-r--r-- | main_statusbar.h (renamed from gtk/main_statusbar.h) | 8 | ||||
-rw-r--r-- | simple_dialog.h | 9 |
13 files changed, 41 insertions, 61 deletions
diff --git a/Makefile.common b/Makefile.common index 1840a24a81..e4345155b3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -167,6 +167,7 @@ wireshark_INCLUDES = \ g711.h \ globals.h \ log.h \ + main_statusbar.h \ merge.h \ progress_dlg.h \ proto_hier_stats.h \ @@ -60,6 +60,7 @@ #include "merge.h" #include "alert_box.h" #include "simple_dialog.h" +#include "main_statusbar.h" #include "progress_dlg.h" #include "ui_util.h" #include <epan/prefs.h> @@ -3931,12 +3932,12 @@ find_packet(capture_file *cf, if (prefs.gui_find_wrap) { - simple_status("Search reached the beginning. Continuing at end."); + statusbar_push_temporary_msg("Search reached the beginning. Continuing at end."); fdata = cf->plist_end; /* wrap around */ } else { - simple_status("Search reached the beginning."); + statusbar_push_temporary_msg("Search reached the beginning."); fdata = start_fd; /* stay on previous packet */ } } @@ -3946,12 +3947,12 @@ find_packet(capture_file *cf, if (fdata == NULL) { if (prefs.gui_find_wrap) { - simple_status("Search reached the end. Continuing at beginning."); + statusbar_push_temporary_msg("Search reached the end. Continuing at beginning."); fdata = cf->plist_start; /* wrap around */ } else { - simple_status("Search reached the end."); + statusbar_push_temporary_msg("Search reached the end."); fdata = start_fd; /* stay on previous packet */ } } @@ -4027,13 +4028,13 @@ cf_goto_frame(capture_file *cf, guint fnumber) if (fdata == NULL) { /* we didn't find a packet with that packet number */ - simple_status("There is no packet number %u.", fnumber); + statusbar_push_temporary_msg("There is no packet number %u.", fnumber); return FALSE; /* we failed to go to that packet */ } if (!fdata->flags.passed_dfilter) { /* that packet currently isn't displayed */ /* XXX - add it to the set of displayed packets? */ - simple_status("Packet number %u isn't displayed.", fnumber); + statusbar_push_temporary_msg("Packet number %u isn't displayed.", fnumber); return FALSE; /* we failed to go to that packet */ } diff --git a/gtk/Makefile.common b/gtk/Makefile.common index 26db07a527..794a95530e 100644 --- a/gtk/Makefile.common +++ b/gtk/Makefile.common @@ -283,7 +283,6 @@ noinst_HEADERS = \ menus.h \ main_packet_list.h \ main_proto_draw.h \ - main_statusbar.h \ main_statusbar_private.h \ main_toolbar.h \ main_welcome.h \ diff --git a/gtk/filter_dlg.c b/gtk/filter_dlg.c index 5a3f071045..f9dcd166c0 100644 --- a/gtk/filter_dlg.c +++ b/gtk/filter_dlg.c @@ -36,9 +36,9 @@ #include "../filters.h" #include "../simple_dialog.h" +#include "../main_statusbar.h" #include "gtk/main.h" -#include "gtk/main_statusbar.h" #include "gtk/filter_dlg.h" #include "gtk/dlg_utils.h" #include "gtk/gui_utils.h" @@ -1351,10 +1351,8 @@ filter_te_syntax_check_cb(GtkWidget *w, gpointer user_data _U_) * We're being lazy and only printing the first "problem" token. * Would it be better to print all of them? */ - msg = g_strdup_printf(" \"%s\" may have unexpected results (see the User's Guide)", + statusbar_push_temporary_msg(" \"%s\" may have unexpected results (see the User's Guide)", (const char *) g_ptr_array_index(depr, 0)); - statusbar_push_temporary_msg(msg); - g_free(msg); } } else { colorize_filter_te_as_valid(w); diff --git a/gtk/find_dlg.c b/gtk/find_dlg.c index 8b3b7a80f1..713186f4c8 100644 --- a/gtk/find_dlg.c +++ b/gtk/find_dlg.c @@ -39,6 +39,7 @@ #include "../globals.h" #include "../alert_box.h" #include "../simple_dialog.h" +#include "../main_statusbar.h" #include "gtk/gui_utils.h" #include "gtk/find_dlg.h" @@ -590,7 +591,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) */ bytes = convert_string_to_hex(filter_text, &nbytes); if (bytes == NULL) { - simple_status("That's not a valid hex string."); + statusbar_push_temporary_msg("That's not a valid hex string."); return; } } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (string_rb))) { @@ -599,7 +600,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) * Make sure we're searching for something, first. */ if (strcmp(filter_text, "") == 0) { - simple_status("You didn't specify any text for which to search."); + statusbar_push_temporary_msg("You didn't specify any text for which to search."); return; } @@ -613,7 +614,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) else if (string_type == SCS_UNICODE) scs_type = SCS_UNICODE; else { - simple_status("You didn't choose a valid character set."); + statusbar_push_temporary_msg("You didn't choose a valid character set."); return; } string = convert_string_case(filter_text, case_type); @@ -630,7 +631,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) /* Was it empty? */ if (sfcode == NULL) { /* Yes - complain. */ - simple_status("That filter doesn't test anything."); + statusbar_push_temporary_msg("That filter doesn't test anything."); return; } } @@ -653,7 +654,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) g_free(bytes); if (!found_packet) { /* We didn't find a packet */ - simple_status("No packet contained those bytes."); + statusbar_push_temporary_msg("No packet contained those bytes."); return; } } else if (cfile.string) { @@ -666,7 +667,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) } if (!found_packet) { /* We didn't find the packet. */ - simple_status("No packet contained that string in its dissected display."); + statusbar_push_temporary_msg("No packet contained that string in its dissected display."); return; } } else if (cfile.summary_data) { @@ -692,7 +693,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) } if (!found_packet) { /* We didn't find the packet. */ - simple_status("No packet contained that string in its data."); + statusbar_push_temporary_msg("No packet contained that string in its data."); return; } } @@ -701,7 +702,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) dfilter_free(sfcode); if (!found_packet) { /* We didn't find a packet */ - simple_status("No packet matched that filter."); + statusbar_push_temporary_msg("No packet matched that filter."); g_free(bytes); return; } diff --git a/gtk/main.c b/gtk/main.c index 9592955fc9..367f249e34 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -92,6 +92,7 @@ #include "../color_filters.h" #include "../print.h" #include "../simple_dialog.h" +#include "../main_statusbar.h" #include "../register.h" #include "../ringbuffer.h" #include "../ui_util.h" @@ -137,7 +138,6 @@ #include "gtk/menus.h" #include "gtk/macros_dlg.h" #include "gtk/main_packet_list.h" -#include "gtk/main_statusbar.h" #include "gtk/main_statusbar_private.h" #include "gtk/main_toolbar.h" #include "gtk/main_welcome.h" diff --git a/gtk/main_packet_list.c b/gtk/main_packet_list.c index fae0a0fd0d..4c45134048 100644 --- a/gtk/main_packet_list.c +++ b/gtk/main_packet_list.c @@ -44,6 +44,7 @@ #include "../color_filters.h" #include "../ui_util.h" #include "../progress_dlg.h" +#include "../main_statusbar.h" #include "gtk/gtkglobals.h" #include "gtk/gui_utils.h" @@ -56,7 +57,6 @@ #include "gtk/main.h" #include "gtk/menus.h" #include "gtk/main_packet_list.h" -#include "gtk/main_statusbar.h" #include "gtk/packet_win.h" #include "gtk/prefs_column.h" #include "gtk/prefs_dlg.h" diff --git a/gtk/main_statusbar.c b/gtk/main_statusbar.c index 5a55c4e726..eae9b22b20 100644 --- a/gtk/main_statusbar.c +++ b/gtk/main_statusbar.c @@ -48,7 +48,6 @@ #include "gtk/recent.h" #include "gtk/main.h" -#include "gtk/main_statusbar.h" #include "gtk/main_statusbar_private.h" #include "gtk/gui_utils.h" #include "gtk/gtkglobals.h" @@ -59,6 +58,8 @@ #include "gtk/keys.h" #include "gtk/menus.h" +#include "main_statusbar.h" + /* * The order below defines the priority of info bar contexts. */ @@ -231,14 +232,21 @@ statusbar_flash_temporary_msg(gpointer data _U_) } /* - * Push a temporary message onto the statusbar. + * Push a formatted temporary message onto the statusbar. */ void -statusbar_push_temporary_msg(const gchar *msg) +statusbar_push_temporary_msg(const gchar *msg_format, ...) { + va_list ap; + gchar *msg; guint msg_id; + va_start(ap, msg_format); + msg = g_strdup_vprintf(msg_format, ap); + va_end(ap); + msg_id = gtk_statusbar_push(GTK_STATUSBAR(info_bar), main_ctx, msg); + g_free(msg); flash_time = TEMPORARY_FLASH_TIMEOUT - 1; g_timeout_add(TEMPORARY_FLASH_INTERVAL, statusbar_flash_temporary_msg, NULL); diff --git a/gtk/menus.c b/gtk/menus.c index a2b47eea22..cc5608d8bd 100644 --- a/gtk/menus.c +++ b/gtk/menus.c @@ -48,6 +48,7 @@ #include "../print.h" #include "../ui_util.h" #include "../simple_dialog.h" +#include "../main_statusbar.h" #include "../color_filters.h" #include "../stat_menu.h" @@ -456,14 +457,14 @@ goto_conversation_frame(gboolean dir) if( filter == NULL ) filter = build_conversation_filter(CONV_IP,FALSE); if( filter == NULL ) { - simple_status("Unable to build conversation filter."); + statusbar_push_temporary_msg("Unable to build conversation filter."); g_free(filter); return; } if (!dfilter_compile(filter, &dfcode)) { /* The attempt failed; report an error. */ - simple_status("Error compiling filter for this conversation."); + statusbar_push_temporary_msg("Error compiling filter for this conversation."); g_free(filter); return; } @@ -472,7 +473,7 @@ goto_conversation_frame(gboolean dir) if (!found_packet) { /* We didn't find a packet */ - simple_status("No previous/next packet in conversation."); + statusbar_push_temporary_msg("No previous/next packet in conversation."); } dfilter_free(dfcode); diff --git a/gtk/new_packet_list.c b/gtk/new_packet_list.c index 29ac396bb2..1e02768e64 100644 --- a/gtk/new_packet_list.c +++ b/gtk/new_packet_list.c @@ -47,6 +47,7 @@ #include "../ui_util.h" #include "../progress_dlg.h" #include "../simple_dialog.h" +#include "../main_statusbar.h" #include "epan/emem.h" #include "globals.h" #include "gtk/gtkglobals.h" @@ -61,7 +62,6 @@ #include "color_filters.h" #include "gtk/color_utils.h" #include "gtk/capture_file_dlg.h" -#include "gtk/main_statusbar.h" #include "gtk/packet_win.h" #include "gtk/main.h" #include "gtk/prefs_column.h" diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c index ba1aaacd33..ff7d28343a 100644 --- a/gtk/simple_dialog.c +++ b/gtk/simple_dialog.c @@ -38,8 +38,6 @@ #include "gtk/gui_utils.h" #include "gtk/stock_icons.h" -#include "main_statusbar.h" - static void simple_dialog_cancel_cb(GtkWidget *, gpointer); #define CALLBACK_FCT_KEY "ESD_Callback_Fct" @@ -415,21 +413,3 @@ simple_dialog_format_message(const char *msg) } return str; } - -/* - * This doesn't create a window, but it falls into the realm of "telling the - * user what happened" and having it here means it can be called from file.c. - */ -void -simple_status(const gchar *msg_format, ...) -{ - va_list ap; - gchar *msg; - - va_start(ap, msg_format); - msg = g_strdup_vprintf(msg_format, ap); - va_end(ap); - - statusbar_push_temporary_msg(msg); - g_free(msg); -} diff --git a/gtk/main_statusbar.h b/main_statusbar.h index 119a6fdb26..6bf4d7ba7e 100644 --- a/gtk/main_statusbar.h +++ b/main_statusbar.h @@ -49,11 +49,11 @@ void statusbar_push_filter_msg(const gchar *msg); */ void statusbar_pop_filter_msg(void); -/** Push a temporary message onto the statusbar. The message is automatically - * removed at a later interval. +/** Push a formatted temporary message onto the statusbar. The message + * is automatically removed at a later interval. * - * @param msg The message + * @param msg_format The format string for the message */ -void statusbar_push_temporary_msg(const gchar *msg); +void statusbar_push_temporary_msg(const gchar *msg_format, ...); #endif /* __MAIN_STATUSBAR_H__ */ diff --git a/simple_dialog.h b/simple_dialog.h index 87f66791f7..40258cadb7 100644 --- a/simple_dialog.h +++ b/simple_dialog.h @@ -159,15 +159,6 @@ extern char *simple_dialog_format_message(const char *msg); */ extern void display_queued_messages(void); -/** Show a message in the status bar. - * - * @param msg_format Status message - */ -extern void simple_status(const gchar *msg_format, ...) - G_GNUC_PRINTF(1, 2); - - - #ifdef __cplusplus } #endif /* __cplusplus */ |