return false;
}
+static bool is_default_theme_id_set(void)
+{
+ if (default_sound_theme_id == INITIAL_DEFAULT_SOUND_THEME_ID)
+ return false;
+ return true;
+}
+
static int parse_sound_theme_property(gpointer data, gpointer user_data)
{
struct section_property *prop = (struct section_property *) data;
goto out_parsing_fail;
}
- if (sound_theme_elem.is_default && (sound_theme_elem.id == default_sound_theme_id)) {
- _E("Failed to parse sound conf file, default sound theme is duplicated.");
- goto out_parsing_fail;
- }
-
if (is_sound_theme_id_duplicated(sound_theme_elem.id)) {
_E("Failed to parse sound conf file, sound theme id is duplicated.");
goto out_parsing_fail;
}
if (sound_theme_elem.is_default) {
+ if (is_default_theme_id_set()) {
+ _E("Failed to parse sound conf file, default sound theme is duplicated.");
+ goto out_parsing_fail;
+ }
default_sound_theme_id = sound_theme_elem.id;
sound_thememan_set_default_sound_theme_id(default_sound_theme_id);
}
int sound_parser_init(const char* sound_file_path)
{
int ret = 0;
- default_sound_theme_id = INITIAL_DEFAULT_SOUND_THEME_ID;
g_hash_table_to_check_id_duplicated = g_hash_table_new_full(g_int_hash, g_int_equal,
g_free, g_free);
ret = libsys_config_parse_by_section(sound_file_path, parse_sound_theme_section, NULL);
- if (default_sound_theme_id == INITIAL_DEFAULT_SOUND_THEME_ID) {
+ if (!is_default_theme_id_set()) {
_E("Failed to parse sound conf file. There is no default sound theme id");
ret = -EPERM;
}
return ret;
return 0;
+}
+
+void sound_parser_exit(void)
+{
+ default_sound_theme_id = INITIAL_DEFAULT_SOUND_THEME_ID;
}
\ No newline at end of file