capture interfaces dialog: use capture stock icons instead of plain text buttons

capture info dialog: add a "Help" and use stock buttons

svn path=/trunk/; revision=19020
This commit is contained in:
Ulf Lamping 2006-08-24 21:40:53 +00:00
parent 0bcced5d2e
commit 0fcfd360e9
7 changed files with 54 additions and 15 deletions

View File

@ -532,7 +532,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
if_lb = gtk_label_new(" Packets/s ");
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_lb, 5, 6, row, row+1);
stop_bt = BUTTON_NEW_FROM_STOCK(GTK_STOCK_STOP);
stop_bt = BUTTON_NEW_FROM_STOCK(WIRESHARK_STOCK_CAPTURE_STOP);
gtk_tooltips_set_tip(tooltips, stop_bt,
"Stop a running capture.", NULL);
#ifdef _WIN32
@ -629,7 +629,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->last_lb, 5, 6, row, row+1);
/* capture button */
if_dlg_data->capture_bt = gtk_button_new_with_label("Capture");
if_dlg_data->capture_bt = BUTTON_NEW_FROM_STOCK(WIRESHARK_STOCK_CAPTURE_START);
SIGNAL_CONNECT(if_dlg_data->capture_bt, "clicked", capture_do_cb, if_dlg_data);
tmp_str = g_strdup_printf("Immediately start a capture from this interface:\n\n%s", if_tool_str->str);
gtk_tooltips_set_tip(tooltips, if_dlg_data->capture_bt,
@ -638,7 +638,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->capture_bt, 6, 7, row, row+1);
/* prepare button */
if_dlg_data->prepare_bt = gtk_button_new_with_label("Prepare");
if_dlg_data->prepare_bt = BUTTON_NEW_FROM_STOCK(WIRESHARK_STOCK_CAPTURE_OPTIONS);
SIGNAL_CONNECT(if_dlg_data->prepare_bt, "clicked", capture_prepare_cb, if_dlg_data);
gtk_tooltips_set_tip(tooltips, if_dlg_data->prepare_bt,
"Open the capture options dialog with this interface selected.", NULL);
@ -646,7 +646,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
/* details button */
#ifdef _WIN32
if_dlg_data->details_bt = gtk_button_new_with_label("Details");
if_dlg_data->details_bt = BUTTON_NEW_FROM_STOCK(WIRESHARK_STOCK_CAPTURE_DETAILS);
gtk_container_add (GTK_CONTAINER (if_dlg_data->details_bt), xpm_box(capture_details_16_xpm));
SIGNAL_CONNECT(if_dlg_data->details_bt, "clicked", capture_details_cb, if_dlg_data);
gtk_tooltips_set_tip(tooltips, if_dlg_data->details_bt,
@ -687,8 +687,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_widget_size_request(GTK_WIDGET(close_bt), &requisition);
/* height + static offset + what GTK-Wimp needs in addition per interface */
/* XXX - Modify or the window will become huge with many interfaces! */
height += requisition.height + 26 + 16;
height += requisition.height + 16 + ifs;
gtk_window_set_default_size(GTK_WINDOW(cap_if_w), -1, height);
gtk_widget_grab_default(close_bt);

View File

@ -44,6 +44,7 @@
#include "gui_utils.h"
#include "main.h"
#include "capture-pcap-util.h"
#include "help_dlg.h"
#ifdef HAVE_AIRPCAP
#include <airpcap.h>
@ -113,11 +114,14 @@ const gchar *iface)
{
unsigned int i;
GtkWidget *main_vb, *stop_bt, *counts_tb;
GtkWidget *counts_fr, *running_tb, *running_label, *bbox;
GtkWidget *counts_fr, *running_tb, *running_label, *bbox, *ci_help;
capture_info_ui_t *info;
gchar *cap_w_title;
gchar *title_iface;
gchar *descr;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
info = g_malloc0(sizeof(capture_info_ui_t));
info->counts[0].title = "Total";
@ -245,17 +249,27 @@ const gchar *iface)
/* allow user to either click a stop button, or the close button on
the window to stop a capture in progress. */
bbox = dlg_button_row_new(GTK_STOCK_STOP, NULL);
if(topic_available(HELP_CAPTURE_INFO_DIALOG)) {
bbox = dlg_button_row_new(WIRESHARK_STOCK_CAPTURE_STOP, GTK_STOCK_HELP, NULL);
} else{
bbox = dlg_button_row_new(WIRESHARK_STOCK_CAPTURE_STOP, NULL);
}
gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 3);
gtk_widget_show(bbox);
stop_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_STOP);
stop_bt = OBJECT_GET_DATA(bbox, WIRESHARK_STOCK_CAPTURE_STOP);
window_set_cancel_button(info->cap_w, stop_bt, NULL);
SIGNAL_CONNECT(stop_bt, "clicked", capture_info_delete_cb, capture_opts);
SIGNAL_CONNECT(info->cap_w, "delete_event", capture_info_delete_cb,
capture_opts);
if(topic_available(HELP_CAPTURE_INFO_DIALOG)) {
ci_help = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP);
gtk_tooltips_set_tip (tooltips, ci_help, ("Get help about this dialog"), NULL);
SIGNAL_CONNECT(ci_help, "clicked", topic_cb, HELP_CAPTURE_INFO_DIALOG);
}
gtk_widget_show(info->cap_w);
window_present(info->cap_w);

View File

@ -194,6 +194,7 @@ gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), name)
#define WIRESHARK_STOCK_CAPTURE_RESTART "Restart"
#define WIRESHARK_STOCK_CAPTURE_FILTER "CFilter"
#define WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY "Capture Filter:"
#define WIRESHARK_STOCK_CAPTURE_DETAILS "Details"
#endif
#define WIRESHARK_STOCK_DISPLAY_FILTER "Filter"
#define WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY "Filter:"
@ -328,6 +329,7 @@ g_signal_stop_emission_by_name(G_OBJECT(widget), name)
#define WIRESHARK_STOCK_LABEL_CAPTURE_RESTART "_Restart"
#define WIRESHARK_STOCK_LABEL_CAPTURE_FILTER "_CFilter"
#define WIRESHARK_STOCK_LABEL_CAPTURE_FILTER_ENTRY "_Capture Filter:"
#define WIRESHARK_STOCK_LABEL_CAPTURE_DETAILS "_Details"
#endif
#define WIRESHARK_STOCK_LABEL_DISPLAY_FILTER "_Filter"
#define WIRESHARK_STOCK_LABEL_DISPLAY_FILTER_ENTRY "_Filter:"
@ -367,6 +369,7 @@ g_signal_stop_emission_by_name(G_OBJECT(widget), name)
#define WIRESHARK_STOCK_CAPTURE_RESTART "Wireshark_Stock_CaptureRestart"
#define WIRESHARK_STOCK_CAPTURE_FILTER "Wireshark_Stock_CaptureFilter"
#define WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY "Wireshark_Stock_CaptureFilter_Entry"
#define WIRESHARK_STOCK_CAPTURE_DETAILS "Wireshark_Stock_CaptureDetails"
#endif
#define WIRESHARK_STOCK_DISPLAY_FILTER "Wireshark_Stock_DisplayFilter"
#define WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY "Wireshark_Stock_DisplayFilter_Entry"

View File

@ -97,7 +97,8 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
const gchar *cancel = NULL;
const gchar *close = NULL;
const gchar *clear = NULL;
const gchar *start = NULL;
const gchar *cap_start = NULL;
const gchar *cap_stop = NULL;
const gchar *stop = NULL;
const gchar *create_stat = NULL;
const gchar *help = NULL;
@ -106,6 +107,7 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
const gchar *jump = NULL;
const gchar *yes = NULL;
const gchar *no = NULL;
const gchar *filter_stream= NULL;
va_start(stock_id_list, stock_id_first);
@ -130,7 +132,9 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
clear = stock_id;
#ifdef HAVE_LIBPCAP
} else if (strcmp(stock_id, WIRESHARK_STOCK_CAPTURE_START) == 0) {
start = stock_id;
cap_start = stock_id;
} else if (strcmp(stock_id, WIRESHARK_STOCK_CAPTURE_STOP) == 0) {
cap_stop = stock_id;
#endif /* HAVE_LIBPCAP */
} else if (strcmp(stock_id, GTK_STOCK_STOP) == 0) {
stop = stock_id;
@ -147,7 +151,7 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
} else if (strcmp(stock_id, GTK_STOCK_NO) == 0) {
no = stock_id;
} else if (strcmp(stock_id, WIRESHARK_STOCK_FILTER_OUT_STREAM) == 0) {
start = stock_id;
filter_stream = stock_id;
} else {
/* we don't know that button! */
g_assert_not_reached();
@ -245,6 +249,16 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
dlg_button_new(hbox, button_hbox, start);
return hbox;
}
if (cap_start && cancel) {
dlg_button_new(hbox, button_hbox, cancel);
dlg_button_new(hbox, button_hbox, cap_start);
return hbox;
}
if (cap_stop && cancel) {
dlg_button_new(hbox, button_hbox, cancel);
dlg_button_new(hbox, button_hbox, cap_stop);
return hbox;
}
}
if (buttons == 3) {
if (ok && save && close) {
@ -306,12 +320,14 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
if (yes != NULL) dlg_button_new(hbox, button_hbox, yes);
if (no != NULL) dlg_button_new(hbox, button_hbox, no);
if (save != NULL) dlg_button_new(hbox, button_hbox, save);
if (dont_save != NULL) dlg_button_new(hbox, button_hbox, dont_save);
if (start != NULL) dlg_button_new(hbox, button_hbox, start);
if (dont_save != NULL) dlg_button_new(hbox, button_hbox, dont_save);
if (cap_start != NULL) dlg_button_new(hbox, button_hbox, cap_start);
if (cap_stop != NULL) dlg_button_new(hbox, button_hbox, cap_stop);
if (stop != NULL) dlg_button_new(hbox, button_hbox, stop);
if (close != NULL) dlg_button_new(hbox, button_hbox, close);
if (clear != NULL) dlg_button_new(hbox, button_hbox, clear);
if (cancel != NULL) dlg_button_new(hbox, button_hbox, cancel);
if (filter_stream!= NULL) dlg_button_new(hbox, button_hbox, filter_stream);
/* GTK2: we don't know that button combination, add it to the above list! */
/* g_assert_not_reached(); */

View File

@ -408,6 +408,9 @@ topic_action(topic_action_e action)
case(HELP_CAPTURE_INTERFACES_DIALOG):
ONLINE_HELP_CALL(ONLINE_HELP_PREFIX "ChCapInterfaceSection.html");
break;
case(HELP_CAPTURE_INFO_DIALOG):
ONLINE_HELP_CALL(ONLINE_HELP_PREFIX "ChCapRunningSection.html");
break;
case(HELP_ENABLED_PROTOCOLS_DIALOG):
ONLINE_HELP_CALL(ONLINE_HELP_PREFIX "ChCustProtocolDissectionSection.html");
break;

View File

@ -72,7 +72,8 @@ typedef enum {
HELP_STATS_CONVERSATIONS_DIALOG,
HELP_STATS_IO_GRAPH_DIALOG,
HELP_CAPTURE_INTERFACES_DETAILS_DIALOG,
HELP_PREFERENCES_DIALOG
HELP_PREFERENCES_DIALOG,
HELP_CAPTURE_INFO_DIALOG
} topic_action_e;

View File

@ -106,6 +106,7 @@
#include "../image/toolbar/capture_stop_24.xpm"
#include "../image/toolbar/capture_restart_24.xpm"
#include "../image/toolbar/capture_filter_24.xpm"
#include "../image/toolbar/capture_details_24.xpm"
#endif /* HAVE_LIBPCAP */
#include "../image/toolbar/display_filter_24.xpm"
/* these icons are standard stock icons, but used for Wireshark specific stock icon labels */
@ -181,6 +182,7 @@ static void wireshark_stock_icons(void) {
{ WIRESHARK_STOCK_CAPTURE_RESTART, WIRESHARK_STOCK_LABEL_CAPTURE_RESTART, 0, 0, NULL },
{ WIRESHARK_STOCK_CAPTURE_FILTER, WIRESHARK_STOCK_LABEL_CAPTURE_FILTER, 0, 0, NULL },
{ WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY, WIRESHARK_STOCK_LABEL_CAPTURE_FILTER_ENTRY, 0, 0, NULL },
{ WIRESHARK_STOCK_CAPTURE_DETAILS, WIRESHARK_STOCK_LABEL_CAPTURE_DETAILS, 0, 0, NULL },
#endif
{ WIRESHARK_STOCK_DISPLAY_FILTER, WIRESHARK_STOCK_LABEL_DISPLAY_FILTER, 0, 0, NULL },
{ WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY, WIRESHARK_STOCK_LABEL_DISPLAY_FILTER_ENTRY, 0, 0, NULL },
@ -221,6 +223,7 @@ static void wireshark_stock_icons(void) {
{ WIRESHARK_STOCK_CAPTURE_RESTART, capture_restart_24_xpm },
{ WIRESHARK_STOCK_CAPTURE_FILTER, capture_filter_24_xpm },
{ WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY, capture_filter_24_xpm },
{ WIRESHARK_STOCK_CAPTURE_DETAILS, capture_details_24_xpm },
#endif
{ WIRESHARK_STOCK_DISPLAY_FILTER, display_filter_24_xpm },
{ WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY, display_filter_24_xpm },