Commits

Anonymous committed 491a274

Patch from Chris Karr to insert separators between the various sound sections in the sounds popup, minor style and coding conformance changes by myself.

Comments (0)

Files changed (4)

Core/Resources/English.lproj/GrowlPref.nib/classes.nib

                 previewButton = NSButton; 
                 servicePasswordColumn = NSTableColumn; 
                 servicesArrayController = NSArrayController; 
+                soundMenuButton = NSPopUpButton; 
                 startStopGrowl = NSButton; 
                 ticketsArrayController = TicketsArrayController; 
             }; 

Core/Resources/English.lproj/GrowlPref.nib/keyedobjects.nib

Binary file modified.

Core/Source/GrowlPreferencePane.h

 	IBOutlet NSMenu					*notificationPriorityMenu;
 	IBOutlet TicketsArrayController	*ticketsArrayController;
 	IBOutlet GrowlPositionPicker	*appPositionPicker;
+	IBOutlet NSPopUpButton			*soundMenuButton;
 
 	//"Display Options" tab pane
 	IBOutlet NSTableView			*displayPluginsTable;

Core/Source/GrowlPreferencePane.m

 					   withObject:[NSIndexSet indexSetWithIndex:defaultStyleRow]
 					   afterDelay:0];
 		}
+		
+		[[NSNotificationCenter defaultCenter] addObserver:self
+												 selector:@selector(translateSeparatorsInSoundMenu:)
+													 name:NSPopUpButtonWillPopUpNotification
+												    object:soundMenuButton];
 	}
 }
 
 		
 		if ([[NSFileManager defaultManager] fileExistsAtPath:directory isDirectory:&isDirectory]) {
 			if (isDirectory) {
+				[soundNames addObject:@"-"];
+				
 				NSArray *files = [[NSFileManager defaultManager] directoryContentsAtPath:directory];
 
 				NSString *filename = nil;
 	return [soundNames autorelease];
 }
 
+- (void)translateSeparatorsInSoundMenu:(NSNotification *)notification
+{
+	if ([notification object] == soundMenuButton)	{
+		NSMenu *menu = [soundMenuButton menu];
+	
+		int itemIndex = 0;
+	
+		while ((itemIndex = [menu indexOfItemWithTitle:@"-"]) != NSNotFound) {
+			[menu removeItemAtIndex:itemIndex];
+			[menu insertItem:[NSMenuItem separatorItem] atIndex:itemIndex];
+		}
+	}
+}
+
 #pragma mark Growl running state
 
 /*!