Skip to content

Commit

Permalink
When card changes, do a full reinit to update icon
Browse files Browse the repository at this point in the history
  • Loading branch information
elboulangero committed Aug 8, 2015
1 parent eb51df8 commit 300409f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions src/prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 300409f

Please sign in to comment.