adium 2140:9ff9883ffd2f: Add an action for removing the selected...

commits at adium.im commits at adium.im
Mon May 11 03:26:06 UTC 2009


details:	http://hg.adium.im/adium/rev/9ff9883ffd2f
revision:	2140:9ff9883ffd2f
author:		Zachary West <zacw at adium.im>
date:		Sun May 10 23:25:49 2009 -0400

Add an action for removing the selected groups (as well as via the delete key).

diffstat:

 Resources/en.lproj/AIAdvancedInspectorPane.nib/classes.nib      |   2 +
 Resources/en.lproj/AIAdvancedInspectorPane.nib/keyedobjects.nib |     
 Source/AIAdvancedInspectorPane.h                                |   1 +
 Source/AIAdvancedInspectorPane.m                                |  36 ++++++-----
 4 files changed, 22 insertions(+), 17 deletions(-)

diffs (100 lines):

diff -r 9f79ee44cff5 -r 9ff9883ffd2f Resources/en.lproj/AIAdvancedInspectorPane.nib/classes.nib
--- a/Resources/en.lproj/AIAdvancedInspectorPane.nib/classes.nib	Sun May 10 22:51:42 2009 -0400
+++ b/Resources/en.lproj/AIAdvancedInspectorPane.nib/classes.nib	Sun May 10 23:25:49 2009 -0400
@@ -130,6 +130,8 @@
 		<dict>
 			<key>ACTIONS</key>
 			<dict>
+				<key>removeSelectedGroups</key>
+				<string>id</string>
 				<key>selectAccount</key>
 				<string>id</string>
 				<key>selectedEncryptionPreference</key>
diff -r 9f79ee44cff5 -r 9ff9883ffd2f Resources/en.lproj/AIAdvancedInspectorPane.nib/keyedobjects.nib
Binary file Resources/en.lproj/AIAdvancedInspectorPane.nib/keyedobjects.nib has changed
diff -r 9f79ee44cff5 -r 9ff9883ffd2f Source/AIAdvancedInspectorPane.h
--- a/Source/AIAdvancedInspectorPane.h	Sun May 10 22:51:42 2009 -0400
+++ b/Source/AIAdvancedInspectorPane.h	Sun May 10 23:25:49 2009 -0400
@@ -51,4 +51,5 @@
 - (IBAction)setVisible:(id)sender;
 - (IBAction)setAutoJoin:(id)sender;
 
+- (void)removeSelectedGroups:(id)sender;
 @end
diff -r 9f79ee44cff5 -r 9ff9883ffd2f Source/AIAdvancedInspectorPane.m
--- a/Source/AIAdvancedInspectorPane.m	Sun May 10 22:51:42 2009 -0400
+++ b/Source/AIAdvancedInspectorPane.m	Sun May 10 23:25:49 2009 -0400
@@ -34,10 +34,6 @@
 -(void)reloadPopup;
 @end
 
- at interface NSMenuItem (NSMenItem_AdvancedInspectorPane)
-- (void)setAttributes:(NSDictionary *)attributes;
- at end
-
 @implementation AIAdvancedInspectorPane
 
 - (id) init
@@ -185,13 +181,13 @@
 
 -(void)reloadPopup
 {
+	[contactMenu release]; contactMenu = nil;
+	contactMenu = [[AIContactMenu contactMenuWithDelegate:self forContactsInObject:displayedObject] retain];
+	
 	[accounts release]; accounts = nil;
 	accounts = [[self accountsForCurrentObject] retain];
 	
 	[accountMenu rebuildMenu];
-	
-	[contactMenu release]; contactMenu = nil;
-	contactMenu = [[AIContactMenu contactMenuWithDelegate:self forContactsInObject:displayedObject] retain];
 }
 
 - (void)accountMenu:(AIAccountMenu *)inAccountMenu didSelectAccount:(AIAccount *)inAccount
@@ -229,7 +225,7 @@
 	currentSelectedContact = [adium.contactController contactWithService:inContact.service
 																 account:currentSelectedAccount
 																	 UID:inContact.UID];
-	
+
 	// Update the groups.
 	[tableView_groups reloadData];
 }
@@ -264,8 +260,17 @@
 	}
 }
 
+#pragma mark Group control
+- (void)removeSelectedGroups:(id)sender
+{
+	for (AIListGroup *group in [currentSelectedContact.remoteGroups.allObjects objectsAtIndexes:tableView_groups.selectedRowIndexes]) {
+		[currentSelectedContact removeFromGroup:group];
+	}
+	
+	[tableView_groups reloadData];
+}
+
 #pragma mark Accounts Table View Data Sources
-
 /*!
  * @brief Number of table view rows
  */
@@ -290,12 +295,9 @@
 	return nil;
 }
 
+- (void)tableViewDeleteSelectedRows:(NSTableView *)tableView
+{
+	[self removeSelectedGroups:nil];
+}
+
 @end
-
- at implementation NSMenuItem (NSMenItem_AdvancedInspectorPane)
-- (void)setAttributes:(NSDictionary *)attributes
-{
-	[self setAttributedTitle:[[[NSAttributedString alloc] initWithString:[self title]
-															  attributes:attributes] autorelease]];
-}
- at end




More information about the commits mailing list