aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-10-24 07:18:39 +0000
committerGuy Harris <guy@alum.mit.edu>2001-10-24 07:18:39 +0000
commit509f30374efd07a3efeaa367f7f48dfae765f97e (patch)
treeef5a0eee067a920b7bbe92f3f75ae7e64d502eb5 /gtk
parentd453f6d99253d5946a4c150c57a7ab8bce2a0715 (diff)
Have a routine that takes a file name for a personal configuration file
and generates the path name; have it, if the file is to be opened for reading on Win32, check whether it exists and, if not, check for it in the old home directory-based configuration directory and, if so, return that path instead, so that files saved with earlier versions of Ethereal will be seen. svn path=/trunk/; revision=4072
Diffstat (limited to 'gtk')
-rw-r--r--gtk/colors.c24
-rw-r--r--gtk/file_dlg.c4
-rw-r--r--gtk/main.c7
3 files changed, 8 insertions, 27 deletions
diff --git a/gtk/colors.c b/gtk/colors.c
index cebf124d23..cd1c0da016 100644
--- a/gtk/colors.c
+++ b/gtk/colors.c
@@ -1,7 +1,7 @@
/* colors.c
* Definitions for color structures and routines
*
- * $Id: colors.c,v 1.14 2001/10/24 06:13:06 guy Exp $
+ * $Id: colors.c,v 1.15 2001/10/24 07:18:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -162,24 +162,6 @@ delete_color_filter(color_filter_t *colorf)
g_free(colorf);
}
-/*
- * Get the pathname of the preferences file.
- */
-static const char *
-get_colorfilter_file_path(void)
-{
- static gchar *cf_path = NULL;
- static const char fname[] = "colorfilters";
-
- if (cf_path == NULL) {
- cf_path = (gchar *) g_malloc(strlen(get_persconffile_dir()) +
- sizeof fname + 1);
- sprintf(cf_path, "%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(),
- fname);
- }
- return cf_path;
-}
-
static gboolean
read_filters(colfilter *filter)
{
@@ -203,7 +185,7 @@ read_filters(colfilter *filter)
return FALSE;
/* we have a clist */
- path = get_colorfilter_file_path();
+ path = get_persconffile_path("colorfilters", FALSE);
if ((f = fopen(path, "r")) == NULL) {
if (errno != ENOENT) {
simple_dialog(ESD_TYPE_CRIT, NULL,
@@ -302,7 +284,7 @@ write_filters(colfilter *filter)
return FALSE;
}
- path = get_colorfilter_file_path();
+ path = get_persconffile_path("colorfilters", TRUE);
if ((f = fopen(path, "w+")) == NULL) {
simple_dialog(ESD_TYPE_CRIT, NULL,
"Could not open\n%s\nfor writing: %s.",
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index 0f4ebdbeab..2b621f2ad9 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -1,7 +1,7 @@
/* file_dlg.c
* Dialog boxes for handling files
*
- * $Id: file_dlg.c,v 1.42 2001/09/10 08:49:11 guy Exp $
+ * $Id: file_dlg.c,v 1.43 2001/10/24 07:18:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -36,6 +36,8 @@
#include <string.h>
+#include <glib.h>
+
#include <epan/filesystem.h>
#include "globals.h"
diff --git a/gtk/main.c b/gtk/main.c
index e0158cc5a2..1471ed321a 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.207 2001/10/22 22:59:26 guy Exp $
+ * $Id: main.c,v 1.208 2001/10/24 07:18:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1325,10 +1325,7 @@ main(int argc, char *argv[])
else if (cfile.snap < MIN_PACKET_SIZE)
cfile.snap = MIN_PACKET_SIZE;
- rc_file = (gchar *) g_malloc(strlen(get_persconffile_dir()) +
- strlen(RC_FILE) + 2);
- sprintf(rc_file, "%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(),
- RC_FILE);
+ rc_file = get_persconffile_path(RC_FILE, FALSE);
gtk_rc_parse(rc_file);
/* Try to load the regular and boldface fixed-width fonts */