diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-04 18:37:35 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-04 18:37:35 (EDT) |
commit | fe7427fa6ceeb8567e9ed53397226ae2f29f0ff7 (patch) | |
tree | 055a28ca74706428bfdb115c53a3a5a210f8c61d /src | |
parent | be5124c5764727f41b6583e5bc9b377a69fd5c7c (diff) | |
download | marquee-fe7427fa6ceeb8567e9ed53397226ae2f29f0ff7.zip marquee-fe7427fa6ceeb8567e9ed53397226ae2f29f0ff7.tar.gz marquee-fe7427fa6ceeb8567e9ed53397226ae2f29f0ff7.tar.bz2 |
mq_profiles_get_default(): New function
Diffstat (limited to 'src')
-rw-r--r-- | src/config/profiles.c | 23 | ||||
-rw-r--r-- | src/config/profiles.h | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/config/profiles.c b/src/config/profiles.c index 36d3293..171b3aa 100644 --- a/src/config/profiles.c +++ b/src/config/profiles.c @@ -109,6 +109,29 @@ mq_profiles_is_default(MqProfiles *profiles, const gchar *profile) NULL); } +gchar * +mq_profiles_get_default(MqProfiles *profiles) +{ + gchar *def; + gchar **ids; + gsize length; + gsize i; + + def = NULL; + + ids = g_key_file_get_groups(profiles->key_file, &length); + for (i = 0; i < length; ++i) { + if (g_key_file_get_boolean(profiles->key_file, ids[i], + "default", NULL)) { + def = g_strdup(ids[i]); + break; + } + } + g_strfreev(ids); + + return def; +} + void mq_profiles_set_name(MqProfiles *profiles, const gchar *profile, const gchar *name) diff --git a/src/config/profiles.h b/src/config/profiles.h index 6783b10..9fa5ce1 100644 --- a/src/config/profiles.h +++ b/src/config/profiles.h @@ -43,6 +43,9 @@ mq_profiles_get_color(MqProfiles *profiles, const gchar *profile); gboolean mq_profiles_is_default(MqProfiles *profiles, const gchar *profile); +gchar * +mq_profiles_get_default(MqProfiles *profiles); + void mq_profiles_set_name(MqProfiles *profiles, const gchar *profile, const gchar *name); |