1/* ExtInfoRole.m
2 *
3 * Copyright (C) 2004-2016 Free Software Foundation, Inc.
4 *
5 * Author: Enrico Sersale <enrico@imago.ro>
6 * Date: March 2004
7 *
8 * This file is part of the GNUstep FSNode framework
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
23 */
24
25#import <AppKit/AppKit.h>
26#import <GNUstepBase/GNUstep.h>
27#import "ExtInfoRole.h"
28
29
30@implementation ExtInfoRole
31
32- (void)dealloc
33{
34  [super dealloc];
35}
36
37- (NSString *)menuName
38{
39  return NSLocalizedStringFromTableInBundle(@"Role", nil, [NSBundle bundleForClass:[self class]], @"");
40}
41
42- (NSDictionary *)extendedInfoForNode:(FSNode *)anode
43{
44  if ([anode isApplication]) {
45    NSBundle *bundle = [NSBundle bundleWithPath: [anode path]];
46    NSDictionary *info = [bundle infoDictionary];
47
48    if (info) {
49      NSString *role = [info objectForKey: @"NSRole"];
50
51      if (role) {
52        NSMutableDictionary *dict = [NSMutableDictionary dictionary];
53
54        [dict setObject: NSLocalizedStringFromTableInBundle(role, nil, [NSBundle bundleForClass:[self class]], @"")
55                 forKey: @"labelstr"];
56
57        return dict;
58      }
59    }
60  }
61
62  return nil;
63}
64
65@end
66