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.
     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  */
    16 
    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>
    26 
    27 #define MESSAGE	AILocalizedString(@"Message", nil)
    28 
    29 @interface AIStandardToolbarItemsPlugin ()
    30 - (void)showSourceDestinationPicker:(NSToolbarItem *)toolbarItem;
    31 @end
    32 
    33 /*!
    34  * @class AIStandardToolbarItemsPlugin
    35  * @brief Component to provide general-use toolbar items
    36  *
    37  * Just provides a Source/Destination picker toolbar item at present.
    38  */
    39 @implementation AIStandardToolbarItemsPlugin
    40 
    41 /*!
    42  * @brief Install
    43  */
    44 - (void)installPlugin
    45 {
    46     //New Message
    47     NSToolbarItem   *toolbarItem = 
    48 	[AIToolbarUtilities toolbarItemWithIdentifier:@"SourceDestination"
    49 											label:AILocalizedString(@"Source/Destination", nil)
    50 									 paletteLabel:AILocalizedString(@"Change Source or Destination", nil)
    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)
    52 										   target:self
    53 								  settingSelector:@selector(setImage:)
    54 									  itemContent:[NSImage imageNamed:@"source-destination" forClass:[self class] loadLazily:YES]
    55 										   action:@selector(showSourceDestinationPicker:)
    56 											 menu:nil];
    57 	[adium.toolbarController registerToolbarItem:toolbarItem forToolbarType:@"MessageWindow"];
    58 }
    59 
    60 /*!
    61  * @brief New chat with the selected list object
    62  */
    63 - (IBAction)showSourceDestinationPicker:(NSToolbarItem *)toolbarItem
    64 {
    65     AIListObject	*object = adium.interfaceController.selectedListObject;
    66 
    67     if ([object isKindOfClass:[AIListContact class]]) {
    68 		AIChat  *chat = [adium.chatController openChatWithContact:(AIListContact *)object
    69 												 onPreferredAccount:YES];
    70         [adium.interfaceController setActiveChat:chat];
    71     }
    72 	
    73 }
    74 
    75 @end