aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-01-27 14:45:31 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-01-27 14:45:31 +0000
commit45572b611c4a3f704d9f143ea3be4e8f43db1294 (patch)
tree80f8d6970362e176ee2789efc57d4014ca67e66b
parentc3fa6a267c1fd8a71e05a1c620fb6f62016cc349 (diff)
Do not change profile if directory creation failed, and change to default
profile if existing profile was deleted. svn path=/trunk/; revision=24208
-rw-r--r--epan/filesystem.c13
-rw-r--r--gtk/main.c7
-rw-r--r--gtk/profile_dlg.c7
3 files changed, 19 insertions, 8 deletions
diff --git a/epan/filesystem.c b/epan/filesystem.c
index 13995f2aed..7ad214e9a2 100644
--- a/epan/filesystem.c
+++ b/epan/filesystem.c
@@ -793,7 +793,8 @@ set_profile_name(const gchar *profilename)
g_free (persconfprofile);
}
- if (profilename && strlen(profilename) > 0) {
+ if (profilename && strlen(profilename) > 0 &&
+ strcmp(profilename, DEFAULT_PROFILE) != 0) {
persconfprofile = g_strdup (profilename);
} else {
/* Default Profile */
@@ -929,9 +930,10 @@ get_persconffile_dir(const gchar *profilename)
g_free (persconffile_profile_dir);
}
- if (profilename) {
- persconffile_profile_dir = g_strdup_printf ("%s%s%s", get_profiles_dir (), G_DIR_SEPARATOR_S,
- profilename);
+ if (profilename && strlen(profilename) > 0 &&
+ strcmp(profilename, DEFAULT_PROFILE) != 0) {
+ persconffile_profile_dir = g_strdup_printf ("%s%s%s", get_profiles_dir (),
+ G_DIR_SEPARATOR_S, profilename);
} else {
persconffile_profile_dir = g_strdup_printf (get_persconffile_dir_no_profile ());
}
@@ -959,7 +961,8 @@ delete_directory (const char *directory, char **pf_dir_path_return)
if ((dir = eth_dir_open(directory, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) {
- filename = g_strdup_printf ("%s%s%s", directory, G_DIR_SEPARATOR_S, eth_dir_get_name(file));
+ filename = g_strdup_printf ("%s%s%s", directory, G_DIR_SEPARATOR_S,
+ eth_dir_get_name(file));
if (test_for_directory(filename) != EISDIR) {
ret = eth_remove(filename);
#if 0
diff --git a/gtk/main.c b/gtk/main.c
index d5fc9fc4a8..3103b280e8 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -5026,7 +5026,12 @@ void change_configuration_profile (const gchar *profile_name)
{
char *gdp_path, *dp_path;
- /* First set profile name and update the status bar */
+ /* First check if profile exists */
+ if (!profile_exists(profile_name)) {
+ return;
+ }
+
+ /* Set profile name and update the status bar */
set_profile_name (profile_name);
profile_bar_update ();
diff --git a/gtk/profile_dlg.c b/gtk/profile_dlg.c
index 811343e225..9a102c0709 100644
--- a/gtk/profile_dlg.c
+++ b/gtk/profile_dlg.c
@@ -226,9 +226,12 @@ profile_select(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
gtk_tree_model_get(model, &iter, 1, &fl_entry, -1);
if (fl_entry) {
profile = (profile_def *) fl_entry->data;
- if (strcmp(profile->name, DEFAULT_PROFILE)!=0) {
+ if (profile_exists (profile->name)) {
+ /* The new profile exists, change */
change_configuration_profile (profile->name);
- } else {
+ } else if (!profile_exists (get_profile_name())) {
+ /* The new profile does not exist, and the previous profile has
+ been deleted. Change to the default profile */
change_configuration_profile (NULL);
}
}