Source/AIStandardToolbarItemsPlugin.m
author Robert Vehse
Tue Aug 31 00:05:25 2010 +0200 (21 months ago)
changeset 3280 c045049c6bd1
parent 3092 ffb42621b742
child 4568 87a0f0ebd59a
permissions -rw-r--r--
Make the Source/Destination toolbar item point to an image named "source-destination" and add an image of same name which is currently identical to message.png. Refs #13963.
David@0
     1
/* 
David@0
     2
 * Adium is the legal property of its developers, whose names are listed in the copyright file included
David@0
     3
 * with this source distribution.
David@0
     4
 * 
David@0
     5
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
David@0
     6
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
David@0
     7
 * or (at your option) any later version.
David@0
     8
 * 
David@0
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
David@0
    10
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
David@0
    11
 * Public License for more details.
David@0
    12
 * 
David@0
    13
 * You should have received a copy of the GNU General Public License along with this program; if not,
David@0
    14
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
David@0
    15
 */
David@0
    16
David@0
    17
#import <Adium/AIChatControllerProtocol.h>
David@0
    18
#import <Adium/AIContactControllerProtocol.h>
David@0
    19
#import <Adium/AIInterfaceControllerProtocol.h>
David@0
    20
#import "AIStandardToolbarItemsPlugin.h"
David@0
    21
#import <Adium/AIToolbarControllerProtocol.h>
David@0
    22
#import <AIUtilities/AIToolbarUtilities.h>
David@0
    23
#import <AIUtilities/AIImageAdditions.h>
David@0
    24
#import <Adium/AIListContact.h>
David@0
    25
#import <Adium/AIListObject.h>
David@0
    26
David@0
    27
#define MESSAGE	AILocalizedString(@"Message", nil)
David@0
    28
sholt@3092
    29
@interface AIStandardToolbarItemsPlugin ()
sholt@3092
    30
- (void)showSourceDestinationPicker:(NSToolbarItem *)toolbarItem;
sholt@3092
    31
@end
sholt@3092
    32
David@0
    33
/*!
David@0
    34
 * @class AIStandardToolbarItemsPlugin
David@0
    35
 * @brief Component to provide general-use toolbar items
David@0
    36
 *
David@0
    37
 * Just provides a Source/Destination picker toolbar item at present.
David@0
    38
 */
David@0
    39
@implementation AIStandardToolbarItemsPlugin
David@0
    40
David@0
    41
/*!
David@0
    42
 * @brief Install
David@0
    43
 */
David@0
    44
- (void)installPlugin
David@0
    45
{
David@0
    46
    //New Message
David@0
    47
    NSToolbarItem   *toolbarItem = 
David@0
    48
	[AIToolbarUtilities toolbarItemWithIdentifier:@"SourceDestination"
David@0
    49
											label:AILocalizedString(@"Source/Destination", nil)
David@0
    50
									 paletteLabel:AILocalizedString(@"Change Source or Destination", nil)
David@0
    51
										  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)
David@0
    52
										   target:self
David@0
    53
								  settingSelector:@selector(setImage:)
Robert@3280
    54
									  itemContent:[NSImage imageNamed:@"source-destination" forClass:[self class] loadLazily:YES]
David@0
    55
										   action:@selector(showSourceDestinationPicker:)
David@0
    56
											 menu:nil];
David@100
    57
	[adium.toolbarController registerToolbarItem:toolbarItem forToolbarType:@"MessageWindow"];
David@0
    58
}
David@0
    59
David@0
    60
/*!
David@0
    61
 * @brief New chat with the selected list object
David@0
    62
 */
David@0
    63
- (IBAction)showSourceDestinationPicker:(NSToolbarItem *)toolbarItem
David@0
    64
{
David@428
    65
    AIListObject	*object = adium.interfaceController.selectedListObject;
David@0
    66
David@0
    67
    if ([object isKindOfClass:[AIListContact class]]) {
David@95
    68
		AIChat  *chat = [adium.chatController openChatWithContact:(AIListContact *)object
David@0
    69
												 onPreferredAccount:YES];
David@100
    70
        [adium.interfaceController setActiveChat:chat];
David@0
    71
    }
David@0
    72
	
David@0
    73
}
David@0
    74
David@0
    75
@end