[vlc-commits] macosx: progress dialog: Fix cancellability and cancellable state

David Fuhrmann git at videolan.org
Mon Sep 18 15:30:10 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Mon Sep 18 12:59:46 2017 +0200| [a64b70d2eb61d3b9c95c6594af605a2bb99df16f] | committer: David Fuhrmann

macosx: progress dialog: Fix cancellability and cancellable state

According to API, an empty (NULL) cancel string means the dialog
is not cancellable.
Dialog can be also cancelled by calling pf_cancel, which in turn
stops the modal event loop with 0. In this case,
vlc_dialog_id_dismiss shall be called as well.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a64b70d2eb61d3b9c95c6594af605a2bb99df16f
---

 modules/gui/macosx/VLCCoreDialogProvider.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/VLCCoreDialogProvider.m b/modules/gui/macosx/VLCCoreDialogProvider.m
index 1ed2fa68b3..9df7fb0c3d 100644
--- a/modules/gui/macosx/VLCCoreDialogProvider.m
+++ b/modules/gui/macosx/VLCCoreDialogProvider.m
@@ -286,8 +286,10 @@ static void updateProgressCallback(void *p_data,
 
     if ([[dialogData objectAtIndex:5] length] > 0) {
         progressCancelButton.title = [dialogData objectAtIndex:5];
+        progressCancelButton.enabled = YES;
     } else {
         progressCancelButton.title = _NS("Cancel");
+        progressCancelButton.enabled = NO;
     }
 
     [progressIndicator startAnimation:self];
@@ -298,8 +300,7 @@ static void updateProgressCallback(void *p_data,
 
     [progressIndicator stopAnimation:self];
 
-    if (returnValue == -1)
-        vlc_dialog_id_dismiss([[dialogData objectAtIndex:0] pointerValue]);
+    vlc_dialog_id_dismiss([[dialogData objectAtIndex:0] pointerValue]);
 }
 
 - (void)updateDisplayedProgressDialog:(NSArray *)dialogData



More information about the vlc-commits mailing list