diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-04 21:52:42 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-04 21:52:42 (EDT) |
commit | 94bb2bb2cedf02519e9bfc7d76a70d3996dfe132 (patch) | |
tree | ba0c973553e7beb74bf345fedfede6810f5022fd | |
parent | 97cd9aef4004cc4f20f9f018566a148d40f35a2d (diff) | |
download | marquee-94bb2bb2cedf02519e9bfc7d76a70d3996dfe132.zip marquee-94bb2bb2cedf02519e9bfc7d76a70d3996dfe132.tar.gz marquee-94bb2bb2cedf02519e9bfc7d76a70d3996dfe132.tar.bz2 |
about:profiles: Don't edit, remove, or make default new profiles
-rw-r--r-- | src/schemes/about/profiles.c | 18 |
1 files changed, 12 insertions, 6 deletions
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); + } } } |