summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-04 15:54:04 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-04 15:54:04 (EDT)
commitce8c5af951cbc82771a9c076af6ac98ff37d4896 (patch)
tree3abac2d55da72b89ca6bd039d71cc4f7d45e8c62
parentdd0b67694ff464d368e6e6dfb17d37fc7e1bf34a (diff)
downloadmarquee-ce8c5af951cbc82771a9c076af6ac98ff37d4896.zip
marquee-ce8c5af951cbc82771a9c076af6ac98ff37d4896.tar.gz
marquee-ce8c5af951cbc82771a9c076af6ac98ff37d4896.tar.bz2
mq_profiles_set_default(): New function
-rw-r--r--src/config/profiles.c17
-rw-r--r--src/config/profiles.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/src/config/profiles.c b/src/config/profiles.c
index 2829f56..04561ec 100644
--- a/src/config/profiles.c
+++ b/src/config/profiles.c
@@ -123,6 +123,23 @@ mq_profiles_set_color(MqProfiles *profiles, const gchar *profile,
g_key_file_set_string(profiles->key_file, profile, "color", color);
}
+void
+mq_profiles_set_default(MqProfiles *profiles, const gchar *profile)
+{
+ gchar **ids;
+ gsize length;
+ gsize i;
+
+ ids = g_key_file_get_groups(profiles->key_file, &length);
+ for (i = 0; i < length; ++i) {
+ g_key_file_set_boolean(profiles->key_file, ids[i], "default",
+ FALSE);
+ }
+ g_strfreev(ids);
+
+ g_key_file_set_boolean(profiles->key_file, profile, "default", FALSE);
+}
+
gboolean
mq_profiles_save(MqProfiles *profiles)
{
diff --git a/src/config/profiles.h b/src/config/profiles.h
index fce5209..0159461 100644
--- a/src/config/profiles.h
+++ b/src/config/profiles.h
@@ -51,6 +51,9 @@ void
mq_profiles_set_color(MqProfiles *profiles, const gchar *profile,
const gchar *color);
+void
+mq_profiles_set_default(MqProfiles *profiles, const gchar *profile);
+
gboolean
mq_profiles_save(MqProfiles *profiles);