VLCAddonListItem.m 2.89 KB
Newer Older
1
/*****************************************************************************
2
 * VLCAddonListItem.m: Addons manager for the Mac
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 ****************************************************************************
 * Copyright (C) 2014 VideoLAN and authors
 * Authors:       Felix Paul Kühne <fkuehne # videolan.org>
 *                David Fuhrmann <dfuhrmann # videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

23
#import "intf.h"
24
#import "VLCAddonListItem.h"
25
#import "VLCStringUtility.h"
26

27
@interface VLCAddonListItem ()
28 29 30 31 32
{
    addon_entry_t *p_addon_entry;
}
@end

33
@implementation VLCAddonListItem
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

- (id)initWithAddon:(addon_entry_t *)p_entry
{
    self = [super init];
    if(self) {
        p_addon_entry = addon_entry_Hold(p_entry);
    }

    return self;
}

-(void)dealloc
{
    addon_entry_Release(p_addon_entry);
}

50
- (NSData *)uuid
51
{
52 53 54 55 56
    vlc_mutex_lock(&p_addon_entry->lock);
    NSData *o_uuid = [NSData dataWithBytes:p_addon_entry->uuid length:sizeof(p_addon_entry->uuid)];
    vlc_mutex_unlock(&p_addon_entry->lock);

    return o_uuid;
57 58 59 60
}

- (NSString *)name
{
61 62 63 64 65
    vlc_mutex_lock(&p_addon_entry->lock);
    NSString *o_str = toNSStr(p_addon_entry->psz_name);
    vlc_mutex_unlock(&p_addon_entry->lock);

    return o_str;
66 67 68
}
- (NSString *)author
{
69 70 71 72 73
    vlc_mutex_lock(&p_addon_entry->lock);
    NSString *o_str = toNSStr(p_addon_entry->psz_author);
    vlc_mutex_unlock(&p_addon_entry->lock);

    return o_str;
74 75 76 77
}

- (NSString *)version
{
78 79 80 81 82
    vlc_mutex_lock(&p_addon_entry->lock);
    NSString *o_str = toNSStr(p_addon_entry->psz_version);
    vlc_mutex_unlock(&p_addon_entry->lock);

    return o_str;
83 84 85 86
}

- (NSString *)description
{
87 88 89 90 91
    vlc_mutex_lock(&p_addon_entry->lock);
    NSString *o_str = toNSStr(p_addon_entry->psz_description);
    vlc_mutex_unlock(&p_addon_entry->lock);

    return o_str;
92 93 94 95
}

- (BOOL)isInstalled
{
96 97 98 99 100
    vlc_mutex_lock(&p_addon_entry->lock);
    BOOL b_installed = p_addon_entry->e_state == ADDON_INSTALLED;
    vlc_mutex_unlock(&p_addon_entry->lock);

    return b_installed;
101 102 103 104
}

- (addon_type_t)type
{
105 106 107 108 109
    vlc_mutex_lock(&p_addon_entry->lock);
    addon_type_t type = p_addon_entry->e_type;
    vlc_mutex_unlock(&p_addon_entry->lock);

    return type;
110 111 112
}

@end