2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
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.
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.
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.
17 #import <Adium/AIChatControllerProtocol.h>
18 #import <Adium/AIContactControllerProtocol.h>
19 #import <Adium/AIInterfaceControllerProtocol.h>
20 #import "AIStandardToolbarItemsPlugin.h"
21 #import <Adium/AIToolbarControllerProtocol.h>
22 #import <AIUtilities/AIToolbarUtilities.h>
23 #import <AIUtilities/AIImageAdditions.h>
24 #import <Adium/AIListContact.h>
25 #import <Adium/AIListObject.h>
27 #define MESSAGE AILocalizedString(@"Message", nil)
30 * @class AIStandardToolbarItemsPlugin
31 * @brief Component to provide general-use toolbar items
33 * Just provides a Source/Destination picker toolbar item at present.
35 @implementation AIStandardToolbarItemsPlugin
43 NSToolbarItem *toolbarItem =
44 [AIToolbarUtilities toolbarItemWithIdentifier:@"SourceDestination"
45 label:AILocalizedString(@"Source/Destination", nil)
46 paletteLabel:AILocalizedString(@"Change Source or Destination", nil)
47 toolTip:AILocalizedString(@"If multiple accounts can send to this contact or this is a combined contact, change the source and/or destination of this chat", nil)
49 settingSelector:@selector(setImage:)
50 itemContent:[NSImage imageNamed:@"message" forClass:[self class] loadLazily:YES]
51 action:@selector(showSourceDestinationPicker:)
53 [[adium toolbarController] registerToolbarItem:toolbarItem forToolbarType:@"MessageWindow"];
57 * @brief New chat with the selected list object
59 - (IBAction)showSourceDestinationPicker:(NSToolbarItem *)toolbarItem
61 AIListObject *object = [[adium interfaceController] selectedListObject];
63 if ([object isKindOfClass:[AIListContact class]]) {
64 AIChat *chat = [[adium chatController] openChatWithContact:(AIListContact *)object
65 onPreferredAccount:YES];
66 [[adium interfaceController] setActiveChat:chat];