diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-05 13:30:23 (EST) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-05 13:30:23 (EST) |
commit | fdd3822f4cf6ab2d8ce60518ef0b202e0139595d (patch) | |
tree | af034626ad50303b4519454b469a664e2eee546a /src/config | |
parent | e82a1c323fea98a2975d9b07e2eed1bbdb6e6e05 (diff) | |
download | marquee-fdd3822f4cf6ab2d8ce60518ef0b202e0139595d.zip marquee-fdd3822f4cf6ab2d8ce60518ef0b202e0139595d.tar.gz marquee-fdd3822f4cf6ab2d8ce60518ef0b202e0139595d.tar.bz2 |
mq_profiles_[gs]et_current(): New functions
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/profiles.c | 19 | ||||
-rw-r--r-- | src/config/profiles.h | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/config/profiles.c b/src/config/profiles.c index ae2639c..413fc93 100644 --- a/src/config/profiles.c +++ b/src/config/profiles.c @@ -31,6 +31,7 @@ struct _MqProfiles { gchar *file_name; GKeyFile *key_file; + gchar *current; }; static gboolean @@ -132,6 +133,12 @@ mq_profiles_get_default(MqProfiles *profiles) return def; } +gchar * +mq_profiles_get_current(MqProfiles *profiles) +{ + return g_strdup(profiles->current); +} + void mq_profiles_set_name(MqProfiles *profiles, const gchar *profile, const gchar *name) @@ -163,6 +170,18 @@ mq_profiles_set_default(MqProfiles *profiles, const gchar *profile) g_key_file_set_boolean(profiles->key_file, profile, "default", TRUE); } +void +mq_profiles_set_current(MqProfiles *profiles, const gchar *profile) +{ + g_free(profiles->current); + + if (profile && profile[0]) { + profiles->current = g_strdup(profile); + } else { + profiles->current = mq_profiles_get_default(profiles); + } +} + gchar * mq_profiles_insert(MqProfiles *profiles, const gchar *name, const gchar *color) { diff --git a/src/config/profiles.h b/src/config/profiles.h index 3104531..3a9ab91 100644 --- a/src/config/profiles.h +++ b/src/config/profiles.h @@ -46,6 +46,9 @@ mq_profiles_is_default(MqProfiles *profiles, const gchar *profile); gchar * mq_profiles_get_default(MqProfiles *profiles); +gchar * +mq_profiles_get_current(MqProfiles *profiles) G_GNUC_PURE; + void mq_profiles_set_name(MqProfiles *profiles, const gchar *profile, const gchar *name); @@ -57,6 +60,9 @@ mq_profiles_set_color(MqProfiles *profiles, const gchar *profile, void mq_profiles_set_default(MqProfiles *profiles, const gchar *profile); +void +mq_profiles_set_current(MqProfiles *profiles, const gchar *profile); + gchar * mq_profiles_insert(MqProfiles *profiles, const gchar *name, const gchar *color); |