1 /*****************************************************************************
2 * playlistinfo.m: MacOS X interface module
3 *****************************************************************************
4 * Copyright (C) 2002-2004 VideoLAN
5 * $Id: playlistinfo.m 7015 2004-03-08 15:22:58Z bigben $
7 * Authors: Benjmaib Pracht <bigben at videolan dot org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
29 #include "playlistinfo.h"
32 /*****************************************************************************
33 * VLCPlaylistInfo Implementation
34 *****************************************************************************/
36 @implementation VLCPlaylistInfo
41 [o_info_window setExcludedFromWindowsMenu: TRUE];
42 [o_tbv_info setOutlineTableColumn:0];
43 [o_tbv_info setDataSource: self];
45 [o_info_window setTitle: _NS("Proprieties")];
46 [o_uri_lbl setStringValue: _NS("URI")];
47 [o_title_lbl setStringValue: _NS("Title")];
48 [o_author_lbl setStringValue: _NS("Author")];
49 [o_btn_info_ok setTitle: _NS("OK")];
50 [o_btn_info_cancel setTitle: _NS("Cancel")];
53 - (IBAction)togglePlaylistInfoPanel:(id)sender
55 intf_thread_t * p_intf = [NSApp getIntf];
56 playlist_t * p_playlist;
58 if( [o_info_window isVisible] )
60 [o_info_window orderOut: sender];
64 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
69 /*fill uri / title / author info */
70 int i_item = [o_vlc_playlist selectedPlaylistItem];
71 [o_uri_txt setStringValue:[NSString stringWithUTF8String: p_playlist->pp_items[i_item]->psz_uri]];
72 [o_title_txt setStringValue:[NSString stringWithUTF8String: p_playlist->pp_items[i_item]->psz_name]];
73 [o_author_txt setStringValue:[NSString stringWithUTF8String: playlist_GetInfo(p_playlist, i_item ,_("General"),_("Author") )]];
77 vlc_object_release ( p_playlist );
79 [o_info_window makeKeyAndOrderFront: sender];
83 - (IBAction)infoCancel:(id)sender
85 [self togglePlaylistInfoPanel:self];
89 - (IBAction)infoOk:(id)sender
91 int i_item = [o_vlc_playlist selectedPlaylistItem];
92 intf_thread_t * p_intf = [NSApp getIntf];
93 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
99 vlc_mutex_lock(&p_playlist->pp_items[i_item]->lock);
101 p_playlist->pp_items[i_item]->psz_uri = strdup([[o_uri_txt stringValue] cString]);
102 p_playlist->pp_items[i_item]->psz_name = strdup([[o_title_txt stringValue] cString]);
103 playlist_ItemAddInfo(p_playlist->pp_items[i_item],_("General"),_("Author"), [[o_author_txt stringValue] cString]);
105 vlc_mutex_unlock(&p_playlist->pp_items[i_item]->lock);
106 val.b_bool = VLC_TRUE;
107 var_Set( p_playlist,"int-change",val );
108 vlc_object_release ( p_playlist );
110 [self togglePlaylistInfoPanel:self];