From 300409fddbda4e58889e3e626f7f6ba11f342a20 Mon Sep 17 00:00:00 2001 From: elboulangero Date: Sat, 8 Aug 2015 18:56:44 +0200 Subject: [PATCH] When card changes, do a full reinit to update icon --- src/alsa.c | 6 +++--- src/prefs.c | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/alsa.c b/src/alsa.c index ac19f44..19a2a1c 100644 --- a/src/alsa.c +++ b/src/alsa.c @@ -248,8 +248,8 @@ static int alsa_cb(snd_mixer_elem_t *e, unsigned int mask) { * @return FALSE if the source should be removed, * TRUE otherwise */ -static gboolean idle_alsa_init(gpointer data) { - alsa_init(); +static gboolean idle_alsa_reinit(gpointer data) { + do_alsa_reinit(); return FALSE; } @@ -279,7 +279,7 @@ static gboolean poll_cb(GIOChannel *source, */ do_notify_text(_("Soundcard disconnected"), _("Soundcard has been disconnected, reloading Alsa...")); - g_idle_add(idle_alsa_init, NULL); + g_idle_add(idle_alsa_reinit, NULL); return FALSE; } sread = 1; diff --git a/src/prefs.c b/src/prefs.c index 7c1f773..c887983 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -309,7 +309,7 @@ static void set_notification_options() { /** * Applies the preferences, usually triggered by on_ok_button_clicked() - * in callbacks.c, but also initially caled from main(). + * in callbacks.c, but also initially called from main(). * * @param alsa_change whether we want to trigger alsa-reinitalization */ @@ -337,13 +337,14 @@ void apply_prefs(gint alsa_change) { set_notification_options(); get_icon_theme(); - if (alsa_change) - alsa_init(); + vol_meter_clrs = get_vol_meter_colors(); set_vol_meter_color(vol_meter_clrs[0],vol_meter_clrs[1],vol_meter_clrs[2]); g_free(vol_meter_clrs); update_status_icons(); - update_vol_text(); + + if (alsa_change) + do_alsa_reinit(); } /**