@@ -266,33 +266,34 @@ void config_load()
266266
267267 aud_config_set_defaults (nullptr , core_defaults);
268268
269- /* migrate from previous versions */
269+ /* Migrate from previous versions
270+ * Caution: Use only the aud_set_*_no_notify() functions here.
271+ * The event loop may not be initialized yet at this point. */
270272 if (aud_get_bool (" replay_gain_album" ))
271273 {
272- aud_set_str (" replay_gain_album" , " " );
273- aud_set_int (" replay_gain_mode" , (int )ReplayGainMode::Album);
274+ aud_set_str_no_notify (nullptr , " replay_gain_album" , " " );
275+ aud_set_int_no_notify (nullptr , " replay_gain_mode" ,
276+ (int )ReplayGainMode::Album);
274277 }
275278
276- String no_confirm = aud_get_str (" audgui" , " no_confirm_playlist_delete" );
277- if (no_confirm[0 ])
279+ if (aud_get_bool (" audgui" , " no_confirm_playlist_delete" ))
278280 {
279- aud_set_bool (" no_confirm_playlist_delete" ,
280- aud_get_bool (" audgui" , " no_confirm_playlist_delete" ));
281- aud_set_str (" audgui" , " no_confirm_playlist_delete" , " " );
281+ aud_set_bool_no_notify (nullptr , " no_confirm_playlist_delete" , true );
282+ aud_set_str_no_notify (" audgui" , " no_confirm_playlist_delete" , " " );
282283 }
283284
284285 double step_size = aud_get_double (" gtkui" , " step_size" );
285286 if (step_size > 0 )
286287 {
287- aud_set_int ( " step_size" , (int )step_size);
288- aud_set_str (" gtkui" , " step_size" , " " );
288+ aud_set_int_no_notify ( nullptr , " step_size" , (int )step_size);
289+ aud_set_str_no_notify (" gtkui" , " step_size" , " " );
289290 }
290291
291292 int volume_delta = aud_get_int (" statusicon" , " volume_delta" );
292293 if (volume_delta > 0 )
293294 {
294- aud_set_int ( " volume_delta" , volume_delta);
295- aud_set_str (" statusicon" , " volume_delta" , " " );
295+ aud_set_int_no_notify ( nullptr , " volume_delta" , volume_delta);
296+ aud_set_str_no_notify (" statusicon" , " volume_delta" , " " );
296297 }
297298}
298299
@@ -377,8 +378,8 @@ void config_cleanup()
377378 s_defaults.clear ();
378379}
379380
380- EXPORT void aud_set_str (const char * section, const char * name,
381- const char * value)
381+ bool aud_set_str_no_notify (const char * section, const char * name,
382+ const char * value)
382383{
383384 assert (name && value);
384385
@@ -387,8 +388,13 @@ EXPORT void aud_set_str(const char * section, const char * name,
387388 bool is_default = config_op_run (op, s_defaults);
388389
389390 op.type = is_default ? OP_CLEAR : OP_SET ;
390- bool changed = config_op_run (op, s_config);
391+ return config_op_run (op, s_config);
392+ }
391393
394+ EXPORT void aud_set_str (const char * section, const char * name,
395+ const char * value)
396+ {
397+ bool changed = aud_set_str_no_notify (section, name, value);
392398 if (changed && !section)
393399 event_queue (str_concat ({" set " , name}), nullptr );
394400}
@@ -406,6 +412,11 @@ EXPORT String aud_get_str(const char * section, const char * name)
406412 return op.value ? op.value : String (" " );
407413}
408414
415+ void aud_set_bool_no_notify (const char * section, const char * name, bool value)
416+ {
417+ aud_set_str_no_notify (section, name, value ? " TRUE" : " FALSE" );
418+ }
419+
409420EXPORT void aud_set_bool (const char * section, const char * name, bool value)
410421{
411422 aud_set_str (section, name, value ? " TRUE" : " FALSE" );
@@ -422,6 +433,11 @@ EXPORT void aud_toggle_bool(const char * section, const char * name)
422433 aud_set_bool (section, name, !aud_get_bool (section, name));
423434}
424435
436+ void aud_set_int_no_notify (const char * section, const char * name, int value)
437+ {
438+ aud_set_str_no_notify (section, name, int_to_str (value));
439+ }
440+
425441EXPORT void aud_set_int (const char * section, const char * name, int value)
426442{
427443 aud_set_str (section, name, int_to_str (value));
@@ -432,6 +448,12 @@ EXPORT int aud_get_int(const char * section, const char * name)
432448 return str_to_int (aud_get_str (section, name));
433449}
434450
451+ void aud_set_double_no_notify (const char * section, const char * name,
452+ double value)
453+ {
454+ aud_set_str_no_notify (section, name, double_to_str (value));
455+ }
456+
435457EXPORT void aud_set_double (const char * section, const char * name,
436458 double value)
437459{
0 commit comments