1 /*****************************************************************************
2 * intf_macosx.c: MacOS X interface plugin
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: intf_macosx.m,v 1.4 2002/06/02 12:16:31 massiot Exp $
7 * Authors: Colin Delacroix <colin@zoy.org>
8 * Florian G. Pflug <fgp@phlo.org>
9 * Jon Lech Johansen <jon-vl@nanocrew.net>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
29 #include <stdlib.h> /* malloc(), free() */
30 #include <sys/param.h> /* for MAXPATHLEN */
38 /*****************************************************************************
40 *****************************************************************************/
41 static int intf_Open ( intf_thread_t *p_intf );
42 static void intf_Close ( intf_thread_t *p_intf );
43 static void intf_Run ( intf_thread_t *p_intf );
45 /*****************************************************************************
46 * Functions exported as capabilities. They are declared as static so that
47 * we don't pollute the namespace too much.
48 *****************************************************************************/
49 void _M( intf_getfunctions )( function_list_t * p_function_list )
51 p_function_list->functions.intf.pf_open = intf_Open;
52 p_function_list->functions.intf.pf_close = intf_Close;
53 p_function_list->functions.intf.pf_run = intf_Run;
56 /*****************************************************************************
57 * intf_Open: initialize interface
58 *****************************************************************************/
59 static int intf_Open( intf_thread_t *p_intf )
61 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
62 if( p_intf->p_sys == NULL )
67 p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
68 p_intf->p_sys->o_port = [[NSPort port] retain];
69 p_intf->p_sys->b_mute = 0;
70 p_intf->p_sys->i_part = 0;
71 p_intf->p_sys->b_disabled_menus = 0;
72 p_intf->p_sys->b_loop = 0;
73 p_intf->p_sys->>i_channel = 0;
75 [[NSApplication sharedApplication] autorelease];
76 [NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
81 /*****************************************************************************
82 * intf_Close: destroy interface
83 *****************************************************************************/
84 static void intf_Close( intf_thread_t *p_intf )
86 /* write cached user defaults to disk */
87 [[NSUserDefaults standardUserDefaults] synchronize];
89 [p_intf->p_sys->o_port release];
90 [p_intf->p_sys->o_pool release];
92 free( p_intf->p_sys );
95 /*****************************************************************************
97 *****************************************************************************/
98 static void intf_Run( intf_thread_t *p_intf )