/* capture_dlg.c
* Routines for packet capture windows
*
- * $Id: capture_dlg.c,v 1.137 2004/06/30 18:24:56 ulfl Exp $
+ * $Id: capture_dlg.c,v 1.138 2004/07/13 07:15:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
capture_prep_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
{
switch(btn) {
- case(ESD_BTN_YES):
+ case(ESD_BTN_SAVE):
/* save file first */
file_save_as_cmd(after_save_capture_dialog, data);
break;
- case(ESD_BTN_NO):
+ case(ESD_BTN_DONT_SAVE):
capture_prep();
break;
case(ESD_BTN_CANCEL):
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
PRIMARY_TEXT_START "Save capture file before starting a new capture?" PRIMARY_TEXT_END "\n\n"
- "If you start a new capture without saving, your current capture data will be discarded.");
+ "If you start a new capture without saving, your current capture data will\nbe discarded.");
simple_dialog_set_cb(dialog, capture_prep_answered_cb, NULL);
} else {
/* unchanged file, just capture a new one */
/* compat_macros.h
* GTK-related Global defines, etc.
*
- * $Id: compat_macros.h,v 1.20 2004/06/17 16:35:23 ulfl Exp $
+ * $Id: compat_macros.h,v 1.21 2004/07/13 07:15:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#define ETHEREAL_STOCK_IMPORT "Import..."
#define ETHEREAL_STOCK_EDIT "Edit..."
#define ETHEREAL_STOCK_ADD_EXPRESSION "Add Expression..."
+#define ETHEREAL_STOCK_DONT_SAVE "Continue without Saving"
/** Create a stock button. Will create a "normal" button for GTK1.
*
#define ETHEREAL_STOCK_LABEL_IMPORT "_Import..."
#define ETHEREAL_STOCK_LABEL_EDIT "_Edit..."
#define ETHEREAL_STOCK_LABEL_ADD_EXPRESSION "_Expression..." /* plus sign coming from icon */
+#define ETHEREAL_STOCK_LABEL_DONT_SAVE "Continue _without Saving"
#ifdef HAVE_LIBPCAP
#define ETHEREAL_STOCK_CAPTURE_START "Ethereal_Stock_CaptureStart"
#define ETHEREAL_STOCK_IMPORT "Ethereal_Stock_Import"
#define ETHEREAL_STOCK_EDIT "Ethereal_Stock_Edit"
#define ETHEREAL_STOCK_ADD_EXPRESSION "Ethereal_Stock_Edit_Add_Expression"
+#define ETHEREAL_STOCK_DONT_SAVE "Ethereal_Stock_Continue_without_Saving"
#define BUTTON_NEW_FROM_STOCK(stock_id) \
gtk_button_new_from_stock(stock_id);
/* dlg_utils.c
* Utilities to use when constructing dialogs
*
- * $Id: dlg_utils.c,v 1.41 2004/07/12 20:01:41 ulfl Exp $
+ * $Id: dlg_utils.c,v 1.42 2004/07/13 07:15:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
gchar *ok = NULL;
gchar *apply = NULL;
gchar *save = NULL;
+ gchar *dont_save = NULL;
gchar *cancel = NULL;
gchar *close = NULL;
gchar *clear = NULL;
apply = stock_id;
} else if (strcmp(stock_id, GTK_STOCK_SAVE) == 0) {
save = stock_id;
+ } else if (strcmp(stock_id, ETHEREAL_STOCK_DONT_SAVE) == 0) {
+ dont_save = stock_id;
} else if (strcmp(stock_id, GTK_STOCK_CANCEL) == 0) {
cancel = stock_id;
} else if (strcmp(stock_id, GTK_STOCK_CLOSE) == 0) {
return hbox;
}
if (yes && no && cancel) {
- dlg_button_new(hbox, button_hbox, yes);
dlg_button_new(hbox, button_hbox, no);
dlg_button_new(hbox, button_hbox, cancel);
+ dlg_button_new(hbox, button_hbox, yes);
return hbox;
}
+ if (save && dont_save && cancel) {
+ dlg_button_new(hbox, button_hbox, dont_save);
+ dlg_button_new(hbox, button_hbox, cancel);
+ dlg_button_new(hbox, button_hbox, save);
+ return hbox;
+ }
}
if (buttons == 4) {
if (ok && apply && save && cancel) {
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 (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);
/* file_dlg.c
* Dialog boxes for handling files
*
- * $Id: file_dlg.c,v 1.127 2004/06/30 07:12:25 guy Exp $
+ * $Id: file_dlg.c,v 1.128 2004/07/13 07:15:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
static void file_open_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
{
switch(btn) {
- case(ESD_BTN_YES):
+ case(ESD_BTN_SAVE):
/* save file first */
file_save_as_cmd(after_save_open_dialog, data);
break;
- case(ESD_BTN_NO):
+ case(ESD_BTN_DONT_SAVE):
cf_close(&cfile);
file_open_cmd(data);
break;
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
PRIMARY_TEXT_START "Save capture file before opening a new one?" PRIMARY_TEXT_END "\n\n"
"If you open a new capture file without saving, your capture data will be discarded.");
simple_dialog_set_cb(dialog, file_open_answered_cb, widget);
void file_close_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
{
switch(btn) {
- case(ESD_BTN_YES):
+ case(ESD_BTN_SAVE):
/* save file first */
file_save_as_cmd(after_save_close_file, NULL);
break;
- case(ESD_BTN_NO):
+ case(ESD_BTN_DONT_SAVE):
cf_close(&cfile);
break;
case(ESD_BTN_CANCEL):
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
PRIMARY_TEXT_START "Save capture file before closing it?" PRIMARY_TEXT_END "\n\n"
"If you close without saving, your capture data will be discarded.");
/* main.c
*
- * $Id: main.c,v 1.457 2004/07/12 19:10:58 ulfl Exp $
+ * $Id: main.c,v 1.458 2004/07/13 07:15:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
gtk_window_present(GTK_WINDOW(top_level));
#endif
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
PRIMARY_TEXT_START "Save capture file before program quit?" PRIMARY_TEXT_END "\n\n"
"If you quit the program without saving, your capture data will be discarded.");
simple_dialog_set_cb(dialog, file_quit_answered_cb, NULL);
return TRUE;
} else {
/* unchanged file, just exit */
- /* "main_do_quit()" indicates whether the main window should be deleted. */
- return main_do_quit();
+ /* "main_do_quit()" indicates whether the main window should be deleted. */
+ return main_do_quit();
}
}
static void file_quit_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
{
switch(btn) {
- case(ESD_BTN_YES):
+ case(ESD_BTN_SAVE):
/* save file first */
file_save_as_cmd(after_save_exit, NULL);
break;
- case(ESD_BTN_NO):
- main_do_quit();
+ case(ESD_BTN_DONT_SAVE):
+ main_do_quit();
break;
case(ESD_BTN_CANCEL):
break;
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
PRIMARY_TEXT_START "Save capture file before program quit?" PRIMARY_TEXT_END "\n\n"
"If you quit the program without saving, your capture data will be discarded.");
simple_dialog_set_cb(dialog, file_quit_answered_cb, NULL);
} else {
/* unchanged file, just exit */
- main_do_quit();
+ main_do_quit();
}
}
dnd_save_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
{
switch(btn) {
- case(ESD_BTN_YES):
+ case(ESD_BTN_SAVE):
/* save file first */
file_save_as_cmd(after_save_open_dnd_file, data);
break;
- case(ESD_BTN_NO):
+ case(ESD_BTN_DONT_SAVE):
cf_close(&cfile);
dnd_open_file_cmd(data);
break;
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
dialog = simple_dialog(ESD_TYPE_CONFIRMATION,
- ESD_BTNS_YES_NO_CANCEL,
+ ESD_BTNS_SAVE_DONTSAVE_CANCEL,
PRIMARY_TEXT_START "Save capture file before opening a new one?" PRIMARY_TEXT_END "\n\n"
"If you open a new capture file without saving, your current capture data will be discarded.");
simple_dialog_set_cb(dialog, dnd_save_file_answered_cb, selection_data);
/* simple_dialog.c
* Simple message dialog box routines.
*
- * $Id: simple_dialog.c,v 1.39 2004/06/29 22:21:04 ulfl Exp $
+ * $Id: simple_dialog.c,v 1.40 2004/07/13 07:15:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
display_simple_dialog(gint type, gint btn_mask, char *message)
{
GtkWidget *win, *main_vb, *top_hb, *type_pm, *msg_label,
- *bbox, *ok_bt, *yes_bt, *bt;
+ *bbox, *ok_bt, *yes_bt, *bt, *save_bt, *dont_save_bt;
GdkPixmap *pixmap;
GdkBitmap *mask;
GtkStyle *style;
case(ESD_BTNS_YES_NO_CANCEL):
bbox = dlg_button_row_new(GTK_STOCK_YES, GTK_STOCK_NO, GTK_STOCK_CANCEL, NULL);
break;
+ case(ESD_BTNS_SAVE_DONTSAVE_CANCEL):
+ bbox = dlg_button_row_new(GTK_STOCK_SAVE, ETHEREAL_STOCK_DONT_SAVE, GTK_STOCK_CANCEL, NULL);
+ break;
case(ESD_BTNS_YES_NO):
bbox = dlg_button_row_new(GTK_STOCK_YES, GTK_STOCK_NO, NULL);
break;
SIGNAL_CONNECT(ok_bt, "clicked", simple_dialog_cancel_cb, win);
}
+ save_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_SAVE);
+ if (save_bt) {
+ OBJECT_SET_DATA(save_bt, CALLBACK_BTN_KEY, GINT_TO_POINTER(ESD_BTN_SAVE));
+ SIGNAL_CONNECT(save_bt, "clicked", simple_dialog_cancel_cb, win);
+ }
+
+ dont_save_bt = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_DONT_SAVE);
+ if (dont_save_bt) {
+ OBJECT_SET_DATA(dont_save_bt, CALLBACK_BTN_KEY, GINT_TO_POINTER(ESD_BTN_DONT_SAVE));
+ SIGNAL_CONNECT(dont_save_bt, "clicked", simple_dialog_cancel_cb, win);
+ }
bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLEAR);
if(bt) {
OBJECT_SET_DATA(bt, CALLBACK_BTN_KEY, GINT_TO_POINTER(ESD_BTN_CLEAR));
* The main toolbar
* Copyright 2003, Ulf Lamping <ulf.lamping@web.de>
*
- * $Id: toolbar.c,v 1.28 2004/02/09 18:32:41 ulfl Exp $
+ * $Id: toolbar.c,v 1.29 2004/07/13 07:15:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
{ ETHEREAL_STOCK_IMPORT, ETHEREAL_STOCK_LABEL_IMPORT, 0, 0, NULL },
{ ETHEREAL_STOCK_EDIT, ETHEREAL_STOCK_LABEL_EDIT, 0, 0, NULL },
{ ETHEREAL_STOCK_ADD_EXPRESSION, ETHEREAL_STOCK_LABEL_ADD_EXPRESSION, 0, 0, NULL },
+ { ETHEREAL_STOCK_DONT_SAVE, ETHEREAL_STOCK_LABEL_DONT_SAVE, 0, 0, NULL }
};
static const stock_pixmap_t pixmaps[] = {
* Definitions for alert box routines with toolkit-independent APIs but
* toolkit-dependent implementations.
*
- * $Id: simple_dialog.h,v 1.15 2004/06/04 21:12:01 guy Exp $
+ * $Id: simple_dialog.h,v 1.16 2004/07/13 07:15:42 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
/** display a "No" button */
#define ESD_BTN_NO 0x08
/** display a "Clear" button */
-#define ESD_BTN_CLEAR 0x10
+#define ESD_BTN_CLEAR 0x10
+/** display a "Save" button */
+#define ESD_BTN_SAVE 0x20
+/** display a "Continue without Saving" button */
+#define ESD_BTN_DONT_SAVE 0x40
/** Standard button combination "Ok" + "Cancel". */
#define ESD_BTNS_OK_CANCEL (ESD_BTN_OK|ESD_BTN_CANCEL)
#define ESD_BTNS_YES_NO (ESD_BTN_YES|ESD_BTN_NO)
/** Standard button combination "Yes" + "No" + "Cancel". */
#define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
+/** Standard button combination "No" + "Cancel" + "Save". */
+#define ESD_BTNS_SAVE_DONTSAVE_CANCEL (ESD_BTN_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
#if __GNUC__ >= 2
/** Create and show a simple dialog.