Skip to content

Commit

Permalink
only stop preview if active
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed Aug 21, 2014
1 parent cc0a202 commit 1d99cb6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/ui/SettingsWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace Venom {
private Gtk.Dialog dialog;
public signal void destroy();

private Gtk.ToggleButton audio_preview_button;
private Gtk.ToggleButton video_preview_button;

public SettingsWindow( Gtk.Window parent ) {
Gtk.Builder builder = new Gtk.Builder();
try {
Expand Down Expand Up @@ -54,8 +57,8 @@ namespace Venom {
(binding, srcval, ref targetval) => {targetval.set_int((bool)srcval ? 0 : 1); return true;},
(binding, srcval, ref targetval) => {targetval.set_boolean((int)srcval == 0); return true;}
);
Gtk.ToggleButton audio_preview_button = builder.get_object("audio_preview_button") as Gtk.ToggleButton;
Gtk.ToggleButton video_preview_button = builder.get_object("video_preview_button") as Gtk.ToggleButton;
audio_preview_button = builder.get_object("audio_preview_button") as Gtk.ToggleButton;
video_preview_button = builder.get_object("video_preview_button") as Gtk.ToggleButton;
audio_preview_button.toggled.connect(() => {
if(audio_preview_button.active) {
AVManager.instance.start_audio_preview();
Expand All @@ -74,8 +77,12 @@ namespace Venom {
}

~SettingsWindow() {
AVManager.instance.end_audio_preview();
AVManager.instance.end_video_preview();
if(audio_preview_button.active) {
AVManager.instance.end_audio_preview();
}
if(video_preview_button.active) {
AVManager.instance.end_video_preview();
}
}

public void show_all() {
Expand Down

0 comments on commit 1d99cb6

Please sign in to comment.