* 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
#include <epan/expert.h>
#include <epan/prefs.h>
-#include "cfile.h"
-#include "file.h"
-#include "capture_opts.h"
-#include "capture_ui_utils.h"
-#include "recent.h"
-#include "main.h"
-#include "main_statusbar.h"
-#include "gui_utils.h"
-#include "gtkglobals.h"
-#include "expert_comp_dlg.h"
+#include "../cfile.h"
+#include "../file.h"
+#include "../capture_opts.h"
+#include "../capture_ui_utils.h"
+#ifdef HAVE_LIBPCAP
+#include "../capture.h"
+#endif
+
+#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"
+#include "gtk/expert_comp_dlg.h"
+#include "gtk/profile_dlg.h"
+#include "gtk/main_welcome.h"
#include "../image/expert_error.xpm"
#include "../image/expert_warn.xpm"
#endif
-GtkWidget *status_pane_left, *status_pane_right;
-GtkWidget *info_bar, *packets_bar, *profile_bar;
-GtkWidget *expert_info_error, *expert_info_warn, *expert_info_note;
-GtkWidget *expert_info_chat, *expert_info_none;
+static GtkWidget *status_pane_left, *status_pane_right;
+static GtkWidget *info_bar, *packets_bar, *profile_bar, *profile_bar_event;
+static GtkWidget *expert_info_error, *expert_info_warn, *expert_info_note;
+static GtkWidget *expert_info_chat, *expert_info_none;
static guint main_ctx, file_ctx, help_ctx, filter_ctx, packets_ctx, profile_ctx;
static guint status_levels[NUM_STATUS_LEVELS];
static gchar *profile_str = NULL;
-static GtkWidget *info_bar_new(void);
-static GtkWidget *packets_bar_new(void);
-static GtkWidget *profile_bar_new(void);
+static void info_bar_new(void);
+static void packets_bar_new(void);
+static void profile_bar_new(void);
static void status_expert_new(void);
{
GtkWidget *status_hbox;
+ /* Sstatus hbox */
+ status_hbox = gtk_hbox_new(FALSE, 1);
+ gtk_container_set_border_width(GTK_CONTAINER(status_hbox), 0);
+
/* info (main) statusbar */
- info_bar = info_bar_new();
- gtk_widget_show(info_bar);
+ info_bar_new();
/* packets statusbar */
- packets_bar = packets_bar_new();
- gtk_widget_show(packets_bar);
+ packets_bar_new();
/* profile statusbar */
- profile_bar = profile_bar_new();
- gtk_widget_show(profile_bar);
+ profile_bar_new();
/* expert info indicator */
status_expert_new();
- /* Filter/status hbox */
- status_hbox = gtk_hbox_new(FALSE, 1);
- gtk_container_border_width(GTK_CONTAINER(status_hbox), 0);
- gtk_widget_show(status_hbox);
-
/* Pane for the statusbar */
status_pane_left = gtk_hpaned_new();
gtk_widget_show(status_pane_left);
void
statusbar_widgets_emptying(GtkWidget *statusbar)
{
- gtk_widget_ref(info_bar);
- gtk_widget_ref(packets_bar);
- gtk_widget_ref(profile_bar);
- gtk_widget_ref(status_pane_left);
- gtk_widget_ref(status_pane_right);
- gtk_widget_ref(expert_info_error);
- gtk_widget_ref(expert_info_warn);
- gtk_widget_ref(expert_info_note);
- gtk_widget_ref(expert_info_chat);
- gtk_widget_ref(expert_info_none);
+ g_object_ref(G_OBJECT(info_bar));
+ g_object_ref(G_OBJECT(packets_bar));
+ g_object_ref(G_OBJECT(profile_bar));
+ g_object_ref(G_OBJECT(profile_bar_event));
+ g_object_ref(G_OBJECT(status_pane_left));
+ g_object_ref(G_OBJECT(status_pane_right));
+ g_object_ref(G_OBJECT(expert_info_error));
+ g_object_ref(G_OBJECT(expert_info_warn));
+ g_object_ref(G_OBJECT(expert_info_note));
+ g_object_ref(G_OBJECT(expert_info_chat));
+ g_object_ref(G_OBJECT(expert_info_none));
/* empty all containers participating */
gtk_container_foreach(GTK_CONTAINER(statusbar), foreach_remove_a_child, statusbar);
gtk_paned_pack1(GTK_PANED(status_pane_left), info_bar, FALSE, FALSE);
gtk_paned_pack2(GTK_PANED(status_pane_left), status_pane_right, TRUE, FALSE);
gtk_paned_pack1(GTK_PANED(status_pane_right), packets_bar, TRUE, FALSE);
- gtk_paned_pack2(GTK_PANED(status_pane_right), profile_bar, FALSE, FALSE);
+ gtk_paned_pack2(GTK_PANED(status_pane_right), profile_bar_event, FALSE, FALSE);
}
void
}
-static GtkWidget *
+static void
info_bar_new(void)
{
int i;
status_levels[i] = 0;
}
- return info_bar;
+ gtk_widget_show(info_bar);
}
-static GtkWidget *
+static void
packets_bar_new(void)
{
/* tip: tooltips don't work on statusbars! */
packets_bar_update();
gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(packets_bar), FALSE);
- return packets_bar;
+ gtk_widget_show(packets_bar);
}
-static GtkWidget *
+static void
profile_bar_new(void)
{
- /* tip: tooltips don't work on statusbars! */
+ GtkTooltips *tooltips;
+
+ tooltips = gtk_tooltips_new();
+
+ profile_bar_event = gtk_event_box_new();
profile_bar = gtk_statusbar_new();
+ gtk_container_add(GTK_CONTAINER(profile_bar_event), profile_bar);
+ g_signal_connect(profile_bar_event, "button_press_event", G_CALLBACK(profile_show_popup_cb), NULL);
profile_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(profile_bar), "profile");
+ gtk_tooltips_set_tip (tooltips, profile_bar_event,
+ "Click to change configuration profile", NULL);
profile_bar_update();
- return profile_bar;
+ gtk_widget_show(profile_bar);
+ gtk_widget_show(profile_bar_event);
}
gtk_widget_hide(expert_info_none);
}
-static void
+void
status_expert_update(void)
{
status_expert_hide();
#ifdef HAVE_LIBPCAP
static void
-statusbar_cf_live_capture_prepared_cb(capture_options *capture_opts _U_)
+statusbar_capture_prepared_cb(capture_options *capture_opts _U_)
{
- statusbar_push_file_msg(" Waiting for capture input data ...");
+ gchar *msg = " Waiting for capture input data ...";
+ statusbar_push_file_msg(msg);
+ welcome_header_push_msg(msg);
}
static void
-statusbar_cf_live_capture_update_started_cb(capture_options *capture_opts)
+statusbar_capture_update_started_cb(capture_options *capture_opts)
{
gchar *capture_msg;
statusbar_pop_file_msg();
+ welcome_header_pop_msg();
if(capture_opts->iface) {
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
}
static void
-statusbar_cf_live_capture_update_continue_cb(capture_file *cf)
+statusbar_capture_update_continue_cb(capture_options *capture_opts)
{
+ capture_file *cf = capture_opts->cf;
gchar *capture_msg;
}
static void
-statusbar_cf_live_capture_update_finished_cb(capture_file *cf)
+statusbar_capture_update_finished_cb(capture_options *capture_opts)
{
+ capture_file *cf = capture_opts->cf;
+
/* Pop the "<live capture in progress>" message off the status bar. */
statusbar_pop_file_msg();
statusbar_set_filename(cf->filename, cf->f_datalen, &(cf->elapsed_time));
}
static void
-statusbar_cf_live_capture_fixed_started_cb(capture_options *capture_opts)
+statusbar_capture_fixed_started_cb(capture_options *capture_opts)
{
gchar *capture_msg;
}
static void
-statusbar_cf_live_capture_fixed_continue_cb(capture_file *cf)
+statusbar_capture_fixed_continue_cb(capture_options *capture_opts)
{
+ capture_file *cf = capture_opts->cf;
gchar *capture_msg;
static void
-statusbar_cf_live_capture_fixed_finished_cb(capture_file *cf _U_)
+statusbar_capture_fixed_finished_cb(capture_options *capture_opts _U_)
{
+#if 0
+ capture_file *cf = capture_opts->cf;
+#endif
+
/* Pop the "<live capture in progress>" message off the status bar. */
statusbar_pop_file_msg();
case(cf_cb_file_read_finished):
statusbar_cf_file_read_finished_cb(data);
break;
-#ifdef HAVE_LIBPCAP
- case(cf_cb_live_capture_prepared):
- statusbar_cf_live_capture_prepared_cb(data);
- break;
- case(cf_cb_live_capture_update_started):
- statusbar_cf_live_capture_update_started_cb(data);
- break;
- case(cf_cb_live_capture_update_continue):
- statusbar_cf_live_capture_update_continue_cb(data);
- break;
- case(cf_cb_live_capture_update_finished):
- statusbar_cf_live_capture_update_finished_cb(data);
- break;
- case(cf_cb_live_capture_fixed_started):
- statusbar_cf_live_capture_fixed_started_cb(data);
- break;
- case(cf_cb_live_capture_fixed_continue):
- statusbar_cf_live_capture_fixed_continue_cb(data);
- break;
- case(cf_cb_live_capture_fixed_finished):
- statusbar_cf_live_capture_fixed_finished_cb(data);
- break;
- case(cf_cb_live_capture_stopping):
- /* Beware: this state won't be called, if the capture child
- * closes the capturing on it's own! */
- break;
-#endif
case(cf_cb_packet_selected):
break;
case(cf_cb_packet_unselected):
}
}
+#ifdef HAVE_LIBPCAP
+void
+statusbar_capture_callback(gint event, capture_options *capture_opts,
+ gpointer user_data _U_)
+{
+ switch(event) {
+ case(capture_cb_capture_prepared):
+ statusbar_capture_prepared_cb(capture_opts);
+ break;
+ case(capture_cb_capture_update_started):
+ statusbar_capture_update_started_cb(capture_opts);
+ break;
+ case(capture_cb_capture_update_continue):
+ statusbar_capture_update_continue_cb(capture_opts);
+ break;
+ case(capture_cb_capture_update_finished):
+ statusbar_capture_update_finished_cb(capture_opts);
+ break;
+ case(capture_cb_capture_fixed_started):
+ statusbar_capture_fixed_started_cb(capture_opts);
+ break;
+ case(capture_cb_capture_fixed_continue):
+ statusbar_capture_fixed_continue_cb(capture_opts);
+ break;
+ case(capture_cb_capture_fixed_finished):
+ statusbar_capture_fixed_finished_cb(capture_opts);
+ break;
+ case(capture_cb_capture_stopping):
+ /* Beware: this state won't be called, if the capture child
+ * closes the capturing on it's own! */
+ break;
+ default:
+ g_warning("statusbar_capture_callback: event %u unknown", event);
+ g_assert_not_reached();
+ }
+}
+#endif