Skip to content

Commit

Permalink
Use changed signal for app updates
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Aug 26, 2023
1 parent f185805 commit 99cac1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/App.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/

public class Sound.App : Object {
public signal void changed ();

public uint32 index { get; private set; }
public string name { get; private set; }
public string display_name { get; private set; }
Expand Down
6 changes: 2 additions & 4 deletions src/AppRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ public class Sound.AppRow : Gtk.Grid {
app_name_label.label = app.display_name;
image.set_from_gicon (app.icon, Gtk.IconSize.DND);

app.notify["volume"].connect (update);
app.notify["muted"].connect (update);
app.changed.connect (update);

volume_scale.set_value (app.volume);
}

public void unbind_app () {
app.notify["volume"].disconnect (update);
app.notify["muted"].disconnect (update);
app.changed.disconnect (update);
}
}
2 changes: 2 additions & 0 deletions src/PulseAudioManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ public class Sound.PulseAudioManager : GLib.Object {
if (app.volume != volume) {
app.volume = volume;
}

app.changed ();
}

private void card_info_callback (PulseAudio.Context c, PulseAudio.CardInfo? card, int eol) {
Expand Down

0 comments on commit 99cac1d

Please sign in to comment.