Commit 454ac21d authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: remove the interaction code from intf.m and add a draft for...

macosx: remove the interaction code from intf.m and add a draft for dialog-fatal. The complete implementation will recycle the existing VLCInteraction dialogue code.
parent 0db2b225
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <vlc_keys.h> #include <vlc_keys.h>
#include <vlc_dialog.h> #include <vlc_dialog.h>
#include <unistd.h> /* execl() */ #include <unistd.h> /* execl() */
#import <vlc_dialog.h>
#import "intf.h" #import "intf.h"
#import "fspanel.h" #import "fspanel.h"
...@@ -220,20 +221,26 @@ static int FullscreenChanged( vlc_object_t *p_this, const char *psz_variable, ...@@ -220,20 +221,26 @@ static int FullscreenChanged( vlc_object_t *p_this, const char *psz_variable,
} }
/***************************************************************************** /*****************************************************************************
* InteractCallback: Callback triggered by the interaction * DialogCallback: Callback triggered by the "dialog-*" variables
* variable, to let the intf display error and interaction dialogs * to let the intf display error and interaction dialogs
*****************************************************************************/ *****************************************************************************/
static int InteractCallback( vlc_object_t *p_this, const char *psz_variable, static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t previous, vlc_value_t value, void *data )
vlc_value_t old_val, vlc_value_t new_val, void *param )
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
VLCMain *interface = (VLCMain *)param; VLCMain *interface = (VLCMain *)data;
interaction_dialog_t *p_dialog = (interaction_dialog_t *)(new_val.p_address);
NSValue *o_value = [NSValue valueWithPointer:p_dialog]; NSLog( @"dialog callback triggered; type of dialogue is '%s'", type );
if(!strcmp (type, "dialog-fatal"))
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewInteractionEventNotification" object:[interface getInteractionList] {
userInfo:[NSDictionary dictionaryWithObject:o_value forKey:@"VLCDialogPointer"]]; const dialog_fatal_t *p_dialog = (const dialog_fatal_t *)value.p_address;
NSLog( @"fatal dialogue with title '%s' and message '%s'", p_dialog->title, p_dialog->message );
#if 0
NSValue *o_value = [NSValue valueWithPointer:p_dialog];
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewInteractionEventNotification" object:[interface getInteractionList] userInfo:[NSDictionary dictionaryWithObject:o_value forKey:@"VLCDialogPointer"]];
#endif
}
[o_pool release]; [o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -460,10 +467,11 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -460,10 +467,11 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback( p_intf->p_libvlc, "intf-show", ShowController, self); var_AddCallback( p_intf->p_libvlc, "intf-show", ShowController, self);
pl_Release( p_intf ); pl_Release( p_intf );
var_Create( p_intf, "interaction", VLC_VAR_ADDRESS ); /* subscribe to various interactive dialogues */
var_AddCallback( p_intf, "interaction", InteractCallback, self ); var_Create( p_intf, "dialog-fatal", VLC_VAR_ADDRESS );
interaction_Register( p_intf ); var_AddCallback( p_intf, "dialog-fatal", DialogCallback, self );
dialog_Register( p_intf );
/* update the playmode stuff */ /* update the playmode stuff */
p_intf->p_sys->b_playmode_update = true; p_intf->p_sys->b_playmode_update = true;
...@@ -473,16 +481,16 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -473,16 +481,16 @@ static VLCMain *_o_sharedMainInstance = nil;
name: NSApplicationDidChangeScreenParametersNotification name: NSApplicationDidChangeScreenParametersNotification
object: nil]; object: nil];
/* take care of tint changes during runtime */
o_img_play = [NSImage imageNamed: @"play"]; o_img_play = [NSImage imageNamed: @"play"];
o_img_pause = [NSImage imageNamed: @"pause"]; o_img_pause = [NSImage imageNamed: @"pause"];
[self controlTintChanged]; [self controlTintChanged];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector( controlTintChanged ) selector: @selector( controlTintChanged )
name: NSControlTintDidChangeNotification name: NSControlTintDidChangeNotification
object: nil]; object: nil];
/* yeah, we are done */
nib_main_loaded = TRUE; nib_main_loaded = TRUE;
} }
...@@ -722,9 +730,10 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -722,9 +730,10 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
[o_extended savePrefs]; [o_extended savePrefs];
} }
interaction_Unregister( p_intf ); /* unsubscribe from the interactive dialogues */
var_DelCallback( p_intf, "interaction", InteractCallback, self ); dialog_Unregister( p_intf );
var_DelCallback( p_intf, "dialog-fatal", DialogCallback, self );
/* remove global observer watching for vout device changes correctly */ /* remove global observer watching for vout device changes correctly */
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
...@@ -733,7 +742,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -733,7 +742,6 @@ static VLCMain *_o_sharedMainInstance = nil;
/* release some other objects here, because it isn't sure whether dealloc /* release some other objects here, because it isn't sure whether dealloc
* will be called later on */ * will be called later on */
if( nib_about_loaded ) if( nib_about_loaded )
[o_about release]; [o_about release];
...@@ -2093,6 +2101,9 @@ end: ...@@ -2093,6 +2101,9 @@ end:
- (IBAction)showBookmarks:(id)sender - (IBAction)showBookmarks:(id)sender
{ {
dialog_Fatal( p_intf, _("Video Settings not saved"),
_("An error occured while saving your settings via SimplePrefs.") );
/* we need the wizard-nib for the bookmarks's extract functionality */ /* we need the wizard-nib for the bookmarks's extract functionality */
if( !nib_wizard_loaded ) if( !nib_wizard_loaded )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment