diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-11-27 21:50:49 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-11-27 21:50:49 +0000 |
commit | a4cc25f84d04835a8283176ba4a058b5ac2966e2 (patch) | |
tree | 7ffed53d8b537c9a207f28b5438525b428cc21d5 /gtk | |
parent | 52b99dc1918626e758f4c3ef2566dfb49958db1b (diff) |
Move main_statusbar.h to the top-level directory; none of its routines
use GTK+ data types, so, at least in theory, it could be implemented
atop another toolkit.
Make statusbar_push_temporary_msg() take a format string and format
arguments. Use it instead of simple_status(), and change one call to
just take a format string and arguments rather than to take the result
of using that format string and arguments with g_strdup_printf() and
passing the result to statusbar_push_temporary_msg().
svn path=/trunk/; revision=35041
Diffstat (limited to 'gtk')
-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/main_statusbar.h | 59 | ||||
-rw-r--r-- | gtk/menus.c | 7 | ||||
-rw-r--r-- | gtk/new_packet_list.c | 2 | ||||
-rw-r--r-- | gtk/simple_dialog.c | 20 |
10 files changed, 29 insertions, 101 deletions
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/main_statusbar.h b/gtk/main_statusbar.h deleted file mode 100644 index 119a6fdb26..0000000000 --- a/gtk/main_statusbar.h +++ /dev/null @@ -1,59 +0,0 @@ -/* main_statusbar.h - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __MAIN_STATUSBAR_H__ -#define __MAIN_STATUSBAR_H__ - - -void profile_bar_update(void); -void packets_bar_update(void); -void status_expert_update(void); - -/** Push a message referring to the currently-selected field onto the statusbar. - * - * @param msg The message - */ -void statusbar_push_field_msg(const gchar *msg); - -/** Pop a message referring to the currently-selected field off the statusbar. - */ -void statusbar_pop_field_msg(void); - -/** Push a message referring to the current filter onto the statusbar. - * - * @param msg The message - */ -void statusbar_push_filter_msg(const gchar *msg); - -/** Pop a message referring to the current filter off the statusbar. - */ -void statusbar_pop_filter_msg(void); - -/** Push a temporary message onto the statusbar. The message is automatically - * removed at a later interval. - * - * @param msg The message - */ -void statusbar_push_temporary_msg(const gchar *msg); - -#endif /* __MAIN_STATUSBAR_H__ */ 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); -} |