diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-06 15:06:06 (EST) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-06 15:06:06 (EST) |
commit | bb80b6bc999f256a06c43119eea065927e0b36fc (patch) | |
tree | 613f046538d5ca58ceae9c76c78d007fdbb342e3 /src | |
parent | ad70ffabf7f6735b8bcde13fa30a1bd1dc83aec5 (diff) | |
download | marquee-bb80b6bc999f256a06c43119eea065927e0b36fc.zip marquee-bb80b6bc999f256a06c43119eea065927e0b36fc.tar.gz marquee-bb80b6bc999f256a06c43119eea065927e0b36fc.tar.bz2 |
about:profiles: Shorten static edit_profiles() function
Diffstat (limited to 'src')
-rw-r--r-- | src/schemes/about/profiles.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/schemes/about/profiles.c b/src/schemes/about/profiles.c index d2a5e21..eea34d1 100644 --- a/src/schemes/about/profiles.c +++ b/src/schemes/about/profiles.c @@ -363,24 +363,20 @@ 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_"); + name_key = g_strconcat("name_", id, NULL); + color_key = g_strconcat("color_", id, NULL); if (id[0]) { /* Edit existing profile. */ - name_key = g_strconcat("name_", id, NULL); - color_key = g_strconcat("color_", id, NULL); mq_profiles_set_name(profiles, id, g_hash_table_lookup(query, name_key)); mq_profiles_set_color(profiles, id, g_hash_table_lookup(query, color_key)); - g_free(name_key); - g_free(color_key); } else { - name_key = g_strconcat("name_", id, NULL); - color_key = g_strconcat("color_", id, NULL); mq_profiles_insert(profiles, g_hash_table_lookup(query, name_key), g_hash_table_lookup(query, color_key)); - g_free(name_key); - g_free(color_key); } + g_free(name_key); + g_free(color_key); } else if (g_str_has_prefix(key->data, "delete_")) { id = (gchar *) key->data + strlen("delete_"); if (id[0]) { /* Don't remove new profile. */ |