summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config/profiles.c19
-rw-r--r--src/config/profiles.h6
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);