From 94bb2bb2cedf02519e9bfc7d76a70d3996dfe132 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 04 Nov 2017 21:52:42 -0400 Subject: about:profiles: Don't edit, remove, or make default new profiles --- diff --git a/src/schemes/about/profiles.c b/src/schemes/about/profiles.c index c2b7a96..7e2bb7d 100644 --- a/src/schemes/about/profiles.c +++ b/src/schemes/about/profiles.c @@ -117,16 +117,22 @@ edit_profiles(MqProfiles *profiles, GHashTable *query) for (key = keys; key; key = key->next) { if (g_str_has_prefix(key->data, "save_")) { id = (gchar *) key->data + strlen("save_"); - input_key = g_strconcat("name_", id, NULL); - mq_profiles_set_name(profiles, id, - g_hash_table_lookup(query, input_key)); - g_free(input_key); + if (id[0]) { /* Edit existing profile. */ + input_key = g_strconcat("name_", id, NULL); + mq_profiles_set_name(profiles, id, + g_hash_table_lookup(query, input_key)); + g_free(input_key); + } } else if (g_str_has_prefix(key->data, "delete_")) { id = (gchar *) key->data + strlen("delete_"); - mq_profiles_remove(profiles, id); + if (id[0]) { /* Don't remove new profile. */ + mq_profiles_remove(profiles, id); + } } else if (g_str_has_prefix(key->data, "default_")) { id = (gchar *) key->data + strlen("default_"); - mq_profiles_set_default(profiles, id); + if (id[0]) { /* Don't set new profile as default. */ + mq_profiles_set_default(profiles, id); + } } } -- cgit v0.9.1