adium 5532:be91f6ac390b: Remove the emoticon toolbar item. Fixes...

commits at adium.im commits at adium.im
Wed Jun 5 03:56:08 UTC 2013


details:	http://hg.adium.im/adium/rev/be91f6ac390b
revision:	5532:be91f6ac390b
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Mon Jun 03 20:40:00 2013 -0400

Remove the emoticon toolbar item. Fixes #16396
Subject: adium 5533:bf8f8206070c: Add this comment back since it's still an issue. Refs #16381

details:	http://hg.adium.im/adium/rev/bf8f8206070c
revision:	5533:bf8f8206070c
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Tue Jun 04 23:54:22 2013 -0400

Add this comment back since it's still an issue. Refs #16381

diffs (198 lines):

diff -r 868232f2e8ef -r bf8f8206070c Plugins/Status Menu Item/CBStatusMenuItemController.m
--- a/Plugins/Status Menu Item/CBStatusMenuItemController.m	Thu May 30 13:01:02 2013 -0400
+++ b/Plugins/Status Menu Item/CBStatusMenuItemController.m	Tue Jun 04 23:54:22 2013 -0400
@@ -201,7 +201,10 @@
 
 	// Release our AIMenuBarIcons bundle
 	[menuIcons release];
-	[statusItem release];
+	
+	// Can't release this because it causes a crash on quit. rdar://4139755, rdar://4160625, and #743. --boredzo
+	// Or when toggling the menu item. #16381 --wixardy
+	// [statusItem release];
 	
 	//To the superclass, Robin!
 	[super dealloc];
diff -r 868232f2e8ef -r bf8f8206070c Source/BGEmoticonMenuPlugin.h
--- a/Source/BGEmoticonMenuPlugin.h	Thu May 30 13:01:02 2013 -0400
+++ b/Source/BGEmoticonMenuPlugin.h	Tue Jun 04 23:54:22 2013 -0400
@@ -20,8 +20,6 @@
 {
 	NSMenuItem			*quickMenuItem;
 	NSMenuItem			*quickContextualMenuItem;
-	
-	NSMutableSet		*toolbarItems;
 }
 
 - (NSMenu *)flatEmoticonMenuForPack:(AIEmoticonPack *)incomingPack;
diff -r 868232f2e8ef -r bf8f8206070c Source/BGEmoticonMenuPlugin.m
--- a/Source/BGEmoticonMenuPlugin.m	Thu May 30 13:01:02 2013 -0400
+++ b/Source/BGEmoticonMenuPlugin.m	Tue Jun 04 23:54:22 2013 -0400
@@ -16,17 +16,14 @@
 
 #import "AIEmoticonController.h"
 #import <Adium/AIMenuControllerProtocol.h>
-#import <Adium/AIToolbarControllerProtocol.h>
 #import "BGEmoticonMenuPlugin.h"
 #import <AIUtilities/AIMenuAdditions.h>
-#import <AIUtilities/AIToolbarUtilities.h>
 #import <AIUtilities/AIImageAdditions.h>
 #import <AIUtilities/AIImageDrawingAdditions.h>
 #import <AIUtilities/MVMenuButton.h>
 #import <Adium/AIEmoticon.h>
 
 @interface BGEmoticonMenuPlugin()
-- (void)registerToolbarItem;
 - (IBAction)dummyTarget:(id)sender;
 - (void)insertEmoticon:(id)sender;
 @end
@@ -40,11 +37,8 @@
 #define PREF_GROUP_EMOTICONS			@"Emoticons"
 
 #define	TITLE_INSERT_EMOTICON			AILocalizedString(@"Insert Emoticon",nil)
-#define	TOOLTIP_INSERT_EMOTICON			AILocalizedString(@"Insert an emoticon into the text",nil)
 #define	TITLE_EMOTICON					AILocalizedString(@"Emoticon",nil)
 
-#define	TOOLBAR_EMOTICON_IDENTIFIER		@"InsertEmoticon"
-
 /*!
  * @brief Install
  */
@@ -77,18 +71,6 @@
     //add the items to their menus.
     [adium.menuController addContextualMenuItem:quickContextualMenuItem toLocation:Context_TextView_Edit];    
     [adium.menuController addMenuItem:quickMenuItem toLocation:LOC_Edit_Additions];
-	
-	toolbarItems = [[NSMutableSet alloc] init];
-	[self registerToolbarItem];
-	
-	[[NSNotificationCenter defaultCenter] addObserver:self
-											 selector:@selector(toolbarWillAddItem:)
-												 name:NSToolbarWillAddItemNotification
-											   object:nil];
-	[[NSNotificationCenter defaultCenter] addObserver:self
-											 selector:@selector(toolbarDidRemoveItem:)
-												 name:NSToolbarDidRemoveItemNotification
-											   object:nil];
 }
 
 /*!
@@ -105,75 +87,9 @@
  */
 - (void)dealloc
 {
-	[toolbarItems release];
-	
 	[super dealloc];
 }
 
-/*!
- * @brief Add the emoticon menu as an item goes into a toolbar
- */
-- (void)toolbarWillAddItem:(NSNotification *)notification
-{
-	NSToolbarItem	*item = [[notification userInfo] objectForKey:@"item"];
-	
-	if ([[item itemIdentifier] isEqualToString:TOOLBAR_EMOTICON_IDENTIFIER]) {
-		NSMenu		*theEmoticonMenu = [[[NSMenu alloc] init] autorelease];
-		
-		[theEmoticonMenu setDelegate:self];
-
-		//Add menu to view
-		[[item view] setMenu:theEmoticonMenu];
-		
-		//Add menu to toolbar item (for text mode)
-		NSMenuItem	*mItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] init] autorelease];
-		[mItem setSubmenu:theEmoticonMenu];
-		[mItem setTitle:TITLE_EMOTICON];
-		[item setMenuFormRepresentation:mItem];
-		
-		[toolbarItems addObject:item];
-	}
-}
-
-/*!
- * @brief Stop tracking when an item is removed from a toolbar
- */
-- (void)toolbarDidRemoveItem:(NSNotification *)notification
-{
-	NSToolbarItem	*item = [[notification userInfo] objectForKey:@"item"];
-	if ([[item itemIdentifier] isEqualToString:TOOLBAR_EMOTICON_IDENTIFIER]) {
-		[item setView:nil];
-		[toolbarItems removeObject:item];
-	}
-}
-
-/*!
- * @brief Register our toolbar item
- */
-- (void)registerToolbarItem
-{
-	NSToolbarItem	*toolbarItem;
-	MVMenuButton	*button;
-
-	//Register our toolbar item
-	button = [[[MVMenuButton alloc] initWithFrame:NSMakeRect(0,0,32,32)] autorelease];
-	[button setImage:[NSImage imageNamed:@"emoticon" forClass:[self class] loadLazily:YES]];
-	toolbarItem = [AIToolbarUtilities toolbarItemWithIdentifier:TOOLBAR_EMOTICON_IDENTIFIER
-														  label:TITLE_EMOTICON
-												   paletteLabel:TITLE_INSERT_EMOTICON
-														toolTip:TOOLTIP_INSERT_EMOTICON
-														 target:self
-												settingSelector:@selector(setView:)
-													itemContent:button
-														 action:@selector(insertEmoticon:)
-														   menu:nil];
-	[toolbarItem setMinSize:NSMakeSize(32,32)];
-	[toolbarItem setMaxSize:NSMakeSize(32,32)];
-	[button setToolbarItem:toolbarItem];
-	[adium.toolbarController registerToolbarItem:toolbarItem forToolbarType:@"TextEntry"];
-}
-
-
 //Menu Generation ------------------------------------------------------------------------------------------------------
 #pragma mark Menu Generation
 
@@ -296,18 +212,6 @@
 	NSArray			*activePacks = [adium.emoticonController activeEmoticonPacks];
 	AIEmoticonPack	*pack;
 		
-   /* We need special voodoo here to identify if the menu belongs to a toolbar,
-	* add the necessary pad item, and then adjust the index accordingly.
-	* this shouldn't be necessary, but NSToolbar is evil.
-	*/
-	if ([[[menu itemAtIndex:0] title] isEqualToString:TITLE_EMOTICON]) {
-		if (idx == 0) {
-			return YES;
-		} else {
-			--idx;
-		}
-	}
-	
 	// Add in flat emoticon menu
 	if ([activePacks count] == 1) {
 		pack = [activePacks objectAtIndex:0];
@@ -341,9 +245,6 @@
 /*!
  * @brief Set the number of items that should be in the menu.
  *
- * Toolbars need one empty item to display properly.  We increase the number by 1, if the menu
- * is in a toolbar
- *
  */
 - (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
 {	
@@ -354,13 +255,6 @@
 	
 	if (itemCounts == 1)
 		itemCounts = [[[activePacks objectAtIndex:0] enabledEmoticons] count];
-	
-
-	if ([menu numberOfItems] > 0) {
-		if ([[[menu itemAtIndex:0] title] isEqualToString:TITLE_EMOTICON]) {
-			++itemCounts;
-		}
-	}
 
 	return itemCounts;
 }




More information about the commits mailing list