forked from osmocom/wireshark
Give the welcome screen its own set of callbacks.
Don't have the status bar code know about the welcome screen; instead, give the welcome screen its own callbacks, so that it can modify the welcome screen as appropriate. Change-Id: Id38d66edeaea085f114b47d6361312450435b58a Reviewed-on: https://code.wireshark.org/review/7927 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
afe9b9bbaf
commit
fd510bef34
|
@ -269,6 +269,7 @@ noinst_HEADERS = \
|
|||
main_toolbar.h \
|
||||
main_toolbar_private.h \
|
||||
main_welcome.h \
|
||||
main_welcome_private.h \
|
||||
manual_addr_resolv.h \
|
||||
mcast_stream_dlg.h \
|
||||
mtp3_stat.h \
|
||||
|
|
|
@ -170,6 +170,7 @@
|
|||
#include "ui/gtk/main_toolbar.h"
|
||||
#include "ui/gtk/main_toolbar_private.h"
|
||||
#include "ui/gtk/main_welcome.h"
|
||||
#include "ui/gtk/main_welcome_private.h"
|
||||
#include "ui/gtk/drag_and_drop.h"
|
||||
#include "ui/gtk/capture_file_dlg.h"
|
||||
#include "ui/gtk/packet_panes.h"
|
||||
|
@ -2445,11 +2446,17 @@ DIAG_ON(cast-qual)
|
|||
#ifdef HAVE_LIBPCAP
|
||||
capture_callback_add(main_capture_callback, NULL);
|
||||
#endif
|
||||
|
||||
cf_callback_add(statusbar_cf_callback, NULL);
|
||||
#ifdef HAVE_LIBPCAP
|
||||
capture_callback_add(statusbar_capture_callback, NULL);
|
||||
#endif
|
||||
|
||||
cf_callback_add(welcome_cf_callback, NULL);
|
||||
#ifdef HAVE_LIBPCAP
|
||||
capture_callback_add(welcome_capture_callback, NULL);
|
||||
#endif
|
||||
|
||||
set_console_log_handler();
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "ui/gtk/expert_comp_dlg.h"
|
||||
#include "ui/gtk/stock_icons.h"
|
||||
#include "ui/gtk/profile_dlg.h"
|
||||
#include "ui/gtk/main_welcome.h"
|
||||
#include "ui/gtk/expert_indicators.h"
|
||||
#include "ui/gtk/capture_comment_icons.h"
|
||||
#include "ui/gtk/keys.h"
|
||||
|
@ -807,7 +806,6 @@ statusbar_capture_prepared_cb(capture_session *cap_session _U_)
|
|||
{
|
||||
static const gchar msg[] = " Waiting for capture input data ...";
|
||||
statusbar_push_file_msg(msg);
|
||||
welcome_header_push_msg(msg);
|
||||
}
|
||||
|
||||
static GString *
|
||||
|
@ -846,7 +844,6 @@ statusbar_capture_update_started_cb(capture_session *cap_session)
|
|||
GString *interface_names;
|
||||
|
||||
statusbar_pop_file_msg();
|
||||
welcome_header_pop_msg();
|
||||
|
||||
interface_names = statusbar_get_interface_names(capture_opts);
|
||||
statusbar_push_file_msg("%s<live capture in progress> to file: %s",
|
||||
|
@ -939,7 +936,6 @@ statusbar_capture_fixed_finished_cb(capture_session *cap_session _U_)
|
|||
|
||||
/* Pop the "<live capture in progress>" message off the status bar. */
|
||||
statusbar_pop_file_msg();
|
||||
welcome_header_pop_msg();
|
||||
|
||||
/* Pop the "<capturing>" message off the status bar */
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
|
||||
|
@ -954,7 +950,6 @@ statusbar_capture_failed_cb(capture_session *cap_session _U_)
|
|||
|
||||
/* Pop the "<live capture in progress>" message off the status bar. */
|
||||
statusbar_pop_file_msg();
|
||||
welcome_header_pop_msg();
|
||||
|
||||
/* Pop the "<capturing>" message off the status bar */
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "ui/gtk/main.h"
|
||||
#include "ui/gtk/menus.h"
|
||||
#include "ui/gtk/main_welcome.h"
|
||||
#include "ui/gtk/main_welcome_private.h"
|
||||
#include "ui/gtk/main_toolbar.h"
|
||||
#include "ui/gtk/help_dlg.h"
|
||||
#include "ui/gtk/capture_file_dlg.h"
|
||||
|
@ -1435,6 +1436,120 @@ get_welcome_window(void)
|
|||
return welcome_hb;
|
||||
}
|
||||
|
||||
void
|
||||
welcome_cf_callback(gint event, gpointer data _U_, gpointer user_data _U_)
|
||||
{
|
||||
switch(event) {
|
||||
case(cf_cb_file_opened):
|
||||
break;
|
||||
case(cf_cb_file_closing):
|
||||
break;
|
||||
case(cf_cb_file_closed):
|
||||
break;
|
||||
case(cf_cb_file_read_started):
|
||||
break;
|
||||
case(cf_cb_file_read_finished):
|
||||
break;
|
||||
case(cf_cb_file_reload_started):
|
||||
break;
|
||||
case(cf_cb_file_reload_finished):
|
||||
break;
|
||||
case(cf_cb_file_rescan_started):
|
||||
break;
|
||||
case(cf_cb_file_rescan_finished):
|
||||
break;
|
||||
case(cf_cb_file_fast_save_finished):
|
||||
break;
|
||||
case(cf_cb_packet_selected):
|
||||
break;
|
||||
case(cf_cb_packet_unselected):
|
||||
break;
|
||||
case(cf_cb_field_unselected):
|
||||
break;
|
||||
case(cf_cb_file_save_started):
|
||||
break;
|
||||
case(cf_cb_file_save_finished):
|
||||
break;
|
||||
case(cf_cb_file_save_failed):
|
||||
break;
|
||||
case(cf_cb_file_save_stopped):
|
||||
break;
|
||||
case(cf_cb_file_export_specified_packets_started):
|
||||
break;
|
||||
case(cf_cb_file_export_specified_packets_finished):
|
||||
break;
|
||||
case(cf_cb_file_export_specified_packets_failed):
|
||||
break;
|
||||
case(cf_cb_file_export_specified_packets_stopped):
|
||||
break;
|
||||
default:
|
||||
g_warning("welcome_cf_callback: event %u unknown", event);
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
static void
|
||||
welcome_capture_update_started_cb(capture_session *cap_session _U_)
|
||||
{
|
||||
welcome_header_pop_msg();
|
||||
}
|
||||
|
||||
static void
|
||||
welcome_capture_fixed_finished_cb(capture_session *cap_session _U_)
|
||||
{
|
||||
welcome_header_pop_msg();
|
||||
}
|
||||
|
||||
static void
|
||||
welcome_capture_prepared_cb(capture_session *cap_session _U_)
|
||||
{
|
||||
static const gchar msg[] = " Waiting for capture input data ...";
|
||||
welcome_header_push_msg(msg);
|
||||
}
|
||||
|
||||
static void
|
||||
welcome_capture_failed_cb(capture_session *cap_session _U_)
|
||||
{
|
||||
welcome_header_pop_msg();
|
||||
}
|
||||
|
||||
void
|
||||
welcome_capture_callback(gint event, capture_session *cap_session,
|
||||
gpointer user_data _U_)
|
||||
{
|
||||
switch(event) {
|
||||
case(capture_cb_capture_prepared):
|
||||
welcome_capture_prepared_cb(cap_session);
|
||||
break;
|
||||
case(capture_cb_capture_update_started):
|
||||
welcome_capture_update_started_cb(cap_session);
|
||||
break;
|
||||
case(capture_cb_capture_update_continue):
|
||||
break;
|
||||
case(capture_cb_capture_update_finished):
|
||||
break;
|
||||
case(capture_cb_capture_fixed_started):
|
||||
break;
|
||||
case(capture_cb_capture_fixed_continue):
|
||||
break;
|
||||
case(capture_cb_capture_fixed_finished):
|
||||
welcome_capture_fixed_finished_cb(cap_session);
|
||||
break;
|
||||
case(capture_cb_capture_stopping):
|
||||
/* Beware: this state won't be called, if the capture child
|
||||
* closes the capturing on its own! */
|
||||
break;
|
||||
case(capture_cb_capture_failed):
|
||||
welcome_capture_failed_cb(cap_session);
|
||||
break;
|
||||
default:
|
||||
g_warning("welcome_capture_callback: event %u unknown", event);
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -38,8 +38,6 @@ typedef struct selected_name_s {
|
|||
gboolean activate;
|
||||
} selected_name_t;
|
||||
|
||||
GtkWidget *welcome_new(void);
|
||||
|
||||
/* reset the list of recently used files */
|
||||
void main_welcome_reset_recent_capture_files(void);
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* main_welcome_private.h
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_WELCOME_PRIVATE_H__
|
||||
#define __MAIN_WELCOME_PRIVATE_H__
|
||||
|
||||
/*** PRIVATE INTERFACE BETWEEN main.c AND main_welcome.c DON'T USE OR TOUCH :-)*/
|
||||
|
||||
GtkWidget *welcome_new(void);
|
||||
void welcome_cf_callback(gint event, gpointer data, gpointer user_data);
|
||||
#ifdef HAVE_LIBPCAP
|
||||
void welcome_capture_callback(gint event, capture_session *cap_session,
|
||||
gpointer user_data);
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_WELCOME_PRIVATE_H__ */
|
Loading…
Reference in New Issue