Add some comments about the types of alert boxes you get with the
authorGuy Harris <guy@alum.mit.edu>
Wed, 4 Feb 2004 01:10:37 +0000 (01:10 -0000)
committerGuy Harris <guy@alum.mit.edu>
Wed, 4 Feb 2004 01:10:37 +0000 (01:10 -0000)
simple_dialog routines (which are really just message box/alert box
routines).

Add some macros for combinations of buttons (corresponding to
combinations that some GUI toolkits, which only support some
combinations, allow).

svn path=/trunk/; revision=9977

gtk/capture_dlg.c
gtk/file_dlg.c
gtk/main.c
gtk/menu.c
gtk/simple_dialog.c
simple_dialog.h

index 123e1aaf564004f6a6ebd8b615ebf7a15482f987..26f613ee016d3cff370eb2e6c3895ca3f9560657 100644 (file)
@@ -1,7 +1,7 @@
 /* capture_dlg.c
  * Routines for packet capture windows
  *
- * $Id: capture_dlg.c,v 1.101 2004/01/31 12:13:22 ulfl Exp $
+ * $Id: capture_dlg.c,v 1.102 2004/02/04 01:10:36 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -786,7 +786,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
   if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
     /* user didn't saved his current file, ask him */
     dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                ESD_BTNS_YES_NO_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.");
     simple_dialog_set_cb(dialog, capture_prep_answered_cb, NULL);
index 06ec93e1b6a77c4ddfac026d566129d344ebe238..52aadc82ac73d56b3e86b6c987ffea3c55402d68 100644 (file)
@@ -1,7 +1,7 @@
 /* file_dlg.c
  * Dialog boxes for handling files
  *
- * $Id: file_dlg.c,v 1.92 2004/02/03 17:59:01 ulfl Exp $
+ * $Id: file_dlg.c,v 1.93 2004/02/04 01:10:36 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -364,7 +364,7 @@ file_open_cmd_cb(GtkWidget *widget, gpointer data _U_) {
   if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
     /* user didn't saved his current file, ask him */
     dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                ESD_BTNS_YES_NO_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);
@@ -491,7 +491,7 @@ file_close_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) {
   if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
     /* user didn't saved his current file, ask him */
     dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                ESD_BTNS_YES_NO_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.");
 
index d0602e452f3324af5390835c0b777e7d284150f1..4dbac7660dc36e01aa73036adfb629b76b018cfa 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
- * $Id: main.c,v 1.389 2004/02/03 17:59:01 ulfl Exp $
+ * $Id: main.c,v 1.390 2004/02/04 01:10:36 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1211,7 +1211,7 @@ main_window_delete_event_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer
   if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
     /* user didn't saved his current file, ask him */
     dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                ESD_BTNS_YES_NO_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);
@@ -1333,7 +1333,7 @@ file_quit_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
   if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
     /* user didn't saved his current file, ask him */
     dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                ESD_BTNS_YES_NO_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);
@@ -1764,7 +1764,7 @@ GtkSelectionData *selection_data, guint info, guint t _U_, gpointer data _U_)
         if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
             /* user didn't saved his current file, ask him */
             dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                        ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                        ESD_BTNS_YES_NO_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_open_file_answered_cb, cf_name);
index f633db70849094e13a616d695a862316368d0268..513b7f13a36c0d1944432a7a1a428b9bce86e5db 100644 (file)
@@ -1,7 +1,7 @@
 /* menu.c
  * Menu routines
  *
- * $Id: menu.c,v 1.157 2004/02/03 17:59:01 ulfl Exp $
+ * $Id: menu.c,v 1.158 2004/02/04 01:10:37 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -840,7 +840,7 @@ menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
   if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
     /* user didn't saved his current file, ask him */
     dialog = simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, 
-                ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL, 
+                ESD_BTNS_YES_NO_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, menu_open_recent_file_answered_cb, widget);
index 574979f1e63e5006536cbbbd40a06d8d58032509..ba3ca97ac67dd530490de99d3fafb7cbecec8e4d 100644 (file)
@@ -1,13 +1,12 @@
 /* simple_dialog.c
  * Simple message dialog box routines.
  *
- * $Id: simple_dialog.c,v 1.23 2004/02/03 17:59:01 ulfl Exp $
+ * $Id: simple_dialog.c,v 1.24 2004/02/04 01:10:37 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * 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
@@ -150,7 +149,7 @@ simple_dialog(gint type, gint btn_mask, gchar *msg_format, ...) {
   case(ESD_BTN_CLEAR | ESD_BTN_CANCEL):
     bbox = dlg_button_row_new(GTK_STOCK_CLEAR, GTK_STOCK_CANCEL, NULL);
     break;
-  case(ESD_BTN_YES | ESD_BTN_NO | ESD_BTN_CANCEL):
+  case(ESD_BTNS_YES_NO_CANCEL):
     bbox = dlg_button_row_new(GTK_STOCK_YES, GTK_STOCK_NO, GTK_STOCK_CANCEL, NULL);
     break;
   default:
index 29ced367ca72d4135ae45db2360d28056c93e5d8..5f067914355019b0a884c582f4a962bee4afba19 100644 (file)
@@ -1,14 +1,13 @@
 /* simple_dialog.h
- * Definitions for dialog box routines with toolkit-independent APIs but
+ * Definitions for alert box routines with toolkit-independent APIs but
  * toolkit-dependent implementations.
  *
- * $Id: simple_dialog.h,v 1.8 2004/02/03 17:59:00 ulfl Exp $
+ * $Id: simple_dialog.h,v 1.9 2004/02/04 01:10:36 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * 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
 extern "C" {
 #endif /* __cplusplus */
 
-/* Dialog type. */
+/* Dialog type.
+
+   INFO: tells the user something they should know, but not requiring
+   any action; the only button should be "OK".
+
+   WARN: tells the user about a problem; the only button should be "OK"
+
+   QUESTION: asks the user for confirmation; there should be more than one
+   button
+   
+   ERROR: tells the user about a serious problem; the only button should be
+   "OK". */
 #define ESD_TYPE_INFO      0x00
 #define ESD_TYPE_WARN      0x01
 #define ESD_TYPE_QUESTION   0x02
@@ -48,6 +58,10 @@ extern "C" {
 #define ESD_BTN_NO     0x08
 #define ESD_BTN_CLEAR  0x10
 
+#define ESD_BTNS_OK_CANCEL     (ESD_BTN_OK|ESD_BTN_CANCEL)
+#define ESD_BTNS_YES_NO                (ESD_BTN_YES|ESD_BTN_NO)
+#define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
+
 /* show a simple dialog */
 #if __GNUC__ >= 2
 extern gpointer simple_dialog(gint type, gint btn_mask, gchar *msg_format, ...)