1. Perry Metzger
  2. growl

Commits

bgannin  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.

  • Participants
  • Parent commits 9f99337
  • Branches default

Comments (0)

Files changed (4)

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

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

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

Binary file modified.

File Core/Source/GrowlPreferencePane.h

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

File Core/Source/GrowlPreferencePane.m

View file
 					   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
 
 /*!