summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config/profiles.c14
-rw-r--r--src/config/profiles.h5
2 files changed, 19 insertions, 0 deletions
diff --git a/src/config/profiles.c b/src/config/profiles.c
index 8d7100d..52d4131 100644
--- a/src/config/profiles.c
+++ b/src/config/profiles.c
@@ -36,6 +36,7 @@ struct _MqProfiles {
gchar *file_name;
GKeyFile *key_file;
gchar *current;
+ MqConfig *current_config;
};
static gboolean
@@ -146,6 +147,7 @@ changed(GFileMonitor G_GNUC_UNUSED *monitor, GFile G_GNUC_UNUSED *file,
if (insert(profiles, profiles->current,
cur_name, cur_color))
{
+ mq_config_save(profiles->current_config);
mq_profiles_save(profiles);
}
}
@@ -251,6 +253,12 @@ mq_profiles_get_current(MqProfiles *profiles)
return g_strdup(profiles->current);
}
+MqConfig *
+mq_profiles_get_current_config(MqProfiles *profiles)
+{
+ return profiles->current_config;
+}
+
void
mq_profiles_set_name(MqProfiles *profiles, const gchar *profile,
const gchar *name)
@@ -286,12 +294,18 @@ void
mq_profiles_set_current(MqProfiles *profiles, const gchar *profile)
{
g_free(profiles->current);
+ if (profiles->current_config) {
+ mq_config_free(profiles->current_config);
+ }
if (profile && profile[0]) {
profiles->current = g_strdup(profile);
} else {
profiles->current = mq_profiles_get_default(profiles);
}
+ profiles->current_config = mq_config_new(profiles->current,
+ MQ_CONFIG_PROFILE_DEFAULT);
+ mq_config_load(profiles->current_config);
}
gchar *
diff --git a/src/config/profiles.h b/src/config/profiles.h
index c75f3b3..50db8fe 100644
--- a/src/config/profiles.h
+++ b/src/config/profiles.h
@@ -26,6 +26,8 @@ typedef struct _MqProfiles MqProfiles;
#include <glib.h>
+#include "config.h"
+
G_BEGIN_DECLS
MqProfiles *
@@ -49,6 +51,9 @@ mq_profiles_get_default(MqProfiles *profiles);
gchar *
mq_profiles_get_current(MqProfiles *profiles) G_GNUC_PURE;
+MqConfig *
+mq_profiles_get_current_config(MqProfiles *profiles) G_GNUC_PURE;
+
void
mq_profiles_set_name(MqProfiles *profiles, const gchar *profile,
const gchar *name);