fr_CA sparkle nibs
[adiumx.git] / Source / AIChatConsolidationPlugin.m
blob1ff0ba001206bd2135e7aae6ece90bd660f18088
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11  * Public License for more details.
12  * 
13  * You should have received a copy of the GNU General Public License along with this program; if not,
14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15  */
17 #import "AIChatConsolidationPlugin.h"
18 #import <Adium/AIInterfaceControllerProtocol.h>
19 #import <Adium/AIMenuControllerProtocol.h>
20 #import <AIUtilities/AIMenuAdditions.h>
22 #define CONSOLIDATE_CHATS_MENU_TITLE                    AILocalizedString(@"Consolidate Chats",nil)
24 /*!
25  * @class AIChatConsolidationPlugin
26  * @brief Component which provides the Conslidate Chats menu item
27  *
28  * Consolidating chats moves all open chats into a single, tabbed window
29  */
30 @implementation AIChatConsolidationPlugin
32 /*!
33  * @brief Install
34  */
35 - (void)installPlugin
37         consolidateMenuItem = [[NSMenuItem alloc] initWithTitle:CONSOLIDATE_CHATS_MENU_TITLE
38                                                                                                          target:self 
39                                                                                                          action:@selector(consolidateChats:)
40                                                                                           keyEquivalent:@"O"];
41         [[adium menuController] addMenuItem:consolidateMenuItem toLocation:LOC_Window_Commands];
44 - (void)dealloc
46         [consolidateMenuItem release];
47         
48         [super dealloc];
51 /*!
52  * @brief Consolidate chats
53  *
54  *      The interface controller does all the work for us :)
55  */
56 - (void)consolidateChats:(id)sender
58         [[adium interfaceController] consolidateChats]; 
61 /*!
62  * @brief Validate menu items
63  *
64  * Only enable the menu if more than one chat is open
65  */
66 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
68         return [[[adium interfaceController] openChats] count] > 1;
71 @end