diff options
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); |