]> git.sesse.net Git - vlc/blob - modules/gui/macosx/AddonListDataSource.m
macosx: slightly de-uglify the VLC description in the about dialog by rendering it...
[vlc] / modules / gui / macosx / AddonListDataSource.m
1 /*****************************************************************************
2  * AddonListDataSource.m: Addons manager for the Mac
3  ****************************************************************************
4  * Copyright (C) 2014 VideoLAN and authors
5  * Authors:       Felix Paul Kühne <fkuehne # videolan.org>
6  *                David Fuhrmann <dfuhrmann # videolan.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22
23 #import "intf.h"
24 #import "AddonListDataSource.h"
25 #import "StringUtility.h"
26
27 @implementation VLCAddon
28
29 - (id)initWithAddon:(addon_entry_t *)p_entry
30 {
31     self = [super init];
32     if(self) {
33         p_addon_entry = addon_entry_Hold(p_entry);
34     }
35
36     return self;
37 }
38
39 -(void)dealloc
40 {
41     addon_entry_Release(p_addon_entry);
42
43     [super dealloc];
44 }
45
46 - (NSData *)uuid
47 {
48     vlc_mutex_lock(&p_addon_entry->lock);
49     NSData *o_uuid = [NSData dataWithBytes:p_addon_entry->uuid length:sizeof(p_addon_entry->uuid)];
50     vlc_mutex_unlock(&p_addon_entry->lock);
51
52     return o_uuid;
53 }
54
55 - (NSString *)name
56 {
57     vlc_mutex_lock(&p_addon_entry->lock);
58     NSString *o_str = toNSStr(p_addon_entry->psz_name);
59     vlc_mutex_unlock(&p_addon_entry->lock);
60
61     return o_str;
62 }
63 - (NSString *)author
64 {
65     vlc_mutex_lock(&p_addon_entry->lock);
66     NSString *o_str = toNSStr(p_addon_entry->psz_author);
67     vlc_mutex_unlock(&p_addon_entry->lock);
68
69     return o_str;
70 }
71
72 - (NSString *)version
73 {
74     vlc_mutex_lock(&p_addon_entry->lock);
75     NSString *o_str = toNSStr(p_addon_entry->psz_version);
76     vlc_mutex_unlock(&p_addon_entry->lock);
77
78     return o_str;
79 }
80
81 - (NSString *)description
82 {
83     vlc_mutex_lock(&p_addon_entry->lock);
84     NSString *o_str = toNSStr(p_addon_entry->psz_description);
85     vlc_mutex_unlock(&p_addon_entry->lock);
86
87     return o_str;
88 }
89
90 - (BOOL)isInstalled
91 {
92     vlc_mutex_lock(&p_addon_entry->lock);
93     BOOL b_installed = p_addon_entry->e_state == ADDON_INSTALLED;
94     vlc_mutex_unlock(&p_addon_entry->lock);
95
96     return b_installed;
97 }
98
99 - (addon_type_t)type
100 {
101     vlc_mutex_lock(&p_addon_entry->lock);
102     addon_type_t type = p_addon_entry->e_type;
103     vlc_mutex_unlock(&p_addon_entry->lock);
104
105     return type;
106 }
107
108 @end