Re: Dockling not working, at all, no clue why!
Re: Dockling not working, at all, no clue why!
- Subject: Re: Dockling not working, at all, no clue why!
- From: Kent Sutherland <email@hidden>
- Date: Sat, 6 Apr 2002 18:07:28 -0500
Well, you could run the code in the menu function up in the
initWithBundle part, and store the menu somewhere. Then when menu is
called, just return that stored menu. My guess is that the Dock doesn't
like the dockling to take it's sweet little time, but I'm not sure. With
the dockling I wrote, it would sometimes hang, but it almost always
finishes...
Hope I'm any help at all.
Kent Sutherland
--
ICQ: 81318970
email@hidden
http://homepage.mac.com/ksuther/
On Saturday, April 6, 2002, at 05:44 PM, Stevos wrote:
First of all, I know Apple is like no-no'ing Docklings these days, but
then
again a dockling is way faster than a App Dock Menu thing if you're just
doing the dockling. Anyways, I grabbed the template from StepWise, and
I was
on my way. This is the MyDockling.m file, and it has 0 errors. However,
the
dockling appears to do nothing! It just sort of hangs. I think this
might be
because I am using find and that takes its bloody time, so I looked
around
for a way to limit the depth that find searches, and I couldn't find it
(yes, I checked man find, but I couldn9t decipher that). So I guess my
first
question is how do I limit the depth of find. I guess we'll go from
there.
My code is below:
#import "MyDockling.h"
#import <CoreFoundation/CoreFoundation.h>
@implementation MyDockling
//Override this method to perform your own initialization
-(id)initWithBundle:(NSBundle*)bundle window:(NSWindow*)window
{
[super initWithBundle:bundle window:window];
return self;
}
-(BOOL)isMenuChanged
{
return YES;
}
-(NSMenu*)menu
{
find=[[NSTask alloc] init];
[find setLaunchPath:@"usr/bin/find"];
[find setCurrentDirectoryPath:@"/Applications"];
[find setArguments:[NSArray arrayWithObjects:@"/Applications",
@"-name
*.app"]];
[find setStandardOutput:theApps];
[find launch];
for(i = 0; i < [theApps count]; i++)
{
menuItem = [[NSMenuItem alloc] addItemWithTitle:[[[theApps
objectAtIndex:i] stringByDeletingPathExtension] lastPathComponent]
action:@selector(itemSelected:) keyEquivalent:@""];
[menuItem setRepresentedObject:[theApps objectAtIndex:i]];
[menu addItem:menuItem];
[menuItem release];
}
[self setMenu:menu];
return [super menu];
}
-(void)itemSelected:(id)sender
{
NSString *path = [sender representedObject];
[[NSWorkspace sharedWorkspace] openFile:path];
}
@end
-Stevos
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.