aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/prefs_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-01-03 06:29:39 +0000
committerGuy Harris <guy@alum.mit.edu>2000-01-03 06:29:39 +0000
commit302c1164834d14e5b239f17b04e41c503c07605b (patch)
treee4574fea9d9f020a19787b715c774abd43b31570 /gtk/prefs_dlg.c
parent77e59876a7a34e094731791cbd95e07a637179c4 (diff)
Don't have "write_prefs()" display a dialog box if the attempt to open
the preferences file fails, have it return an error indication and the path of the preferences file, and have its caller display the dialog box. That way you don't have to drag in the dialog box code if you're going to use the preferences code in, say, a "line-mode" Ethereal. svn path=/trunk/; revision=1413
Diffstat (limited to 'gtk/prefs_dlg.c')
-rw-r--r--gtk/prefs_dlg.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c
index 66495b0276..9f610d1705 100644
--- a/gtk/prefs_dlg.c
+++ b/gtk/prefs_dlg.c
@@ -1,7 +1,7 @@
/* prefs_dlg.c
* Routines for handling preferences
*
- * $Id: prefs_dlg.c,v 1.6 1999/12/29 05:53:48 guy Exp $
+ * $Id: prefs_dlg.c,v 1.7 2000/01/03 06:29:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -34,6 +34,7 @@
#include <gtk/gtk.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
#include <errno.h>
@@ -54,6 +55,7 @@
#include "stream_prefs.h"
#include "gui_prefs.h"
#include "util.h"
+#include "ui_util.h"
static void prefs_main_ok_cb(GtkWidget *, gpointer);
static void prefs_main_save_cb(GtkWidget *, gpointer);
@@ -168,11 +170,19 @@ prefs_main_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
static void
prefs_main_save_cb(GtkWidget *save_bt, gpointer parent_w)
{
+ int err;
+ char *pf_path;
+
printer_prefs_save(gtk_object_get_data(GTK_OBJECT(parent_w), E_PRINT_PAGE_KEY));
column_prefs_save(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY));
stream_prefs_save(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY));
gui_prefs_save(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY));
- write_prefs();
+ err = write_prefs(&pf_path);
+ if (err != 0) {
+ simple_dialog(ESD_TYPE_WARN, NULL,
+ "Can't open preferences file\n\"%s\": %s.", pf_path,
+ strerror(err));
+ }
}
static void