UTI for Mach-O file

2010-08-25 Thread John Johnson
Hello. I'm implementing an NSDocument-based utility that loads mach-o files and 
displays information about them. But no matter what UTI I put in the 
Info.plist, I can't get the app to recognize the file when dropped on the dock 
tile. The only way I could get it recognized is by having no UTI and a * for 
the extensions, but this has the (very) unfortunate side-effect of recognizing 
ALL files. I've tried com.apple.mach-o.binary and public.unix-executable as 
well as public.executable. It's curious, because running mdls shown no UTI for 
an executable...
Can anyone tell me the best way to go from here, so that my app recognizes ONLY 
mach-o files? Is UTI's even the best way to go?

Thanks,
John___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UTI for Mach-O file

2010-08-25 Thread John Johnson
 I guess that makes sense. But then why is there a com.apple.mach-o.binary 
 and a public.unix-executable UTI in the first place??
 
 Well, technically, UTIs are not just applied to on-disk files.  They can be 
 applied to email attachments, where a MIME type might give that sort of 
 information (although perhaps not for those specific UTIs).  Also, pasteboard 
 contents.
 
 But mostly, I'm guessing they exist as parent UTIs for other more-specific 
 UTIs to declare conformance with.
 
 You can use the UTTypeCopyDeclaration and/or UTTypeCopyDeclaringBundleURL on 
 those UTIs to investigate.  Maybe the declaration includes some file 
 extensions, for example.  So, there might be real files that get assigned 
 com.apple.mach-o.binary or public.unix-executable based on a file extension 
 neither of us is thinking of right now.  Of course, that doesn't help solve 
 your problem, just maybe satisfy your curiosity.  :)

Yes, it does satisfy my curiosity. Thanks for your knowledge and insight. I 
guess it would've just been oh-too-convenient if that little dock icon 
highlighted only for valid mach-o files and bundles... But it's just 
aesthetics; the program will function doing it like Kevin suggested.

John___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Set Hierarchical NSUserDefaults Value

2010-07-16 Thread John Johnson

 or use something like this category I wrote last year, when I got tired of 
 uprooting and replanting entire trees in my User Defaults, every time I 
 wanted to change a leaf:
 
 
 NSUserDefaults+KeyPaths.zip

Very nice. I think I will find this useful. Thanks. 
-J___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sanity Check

2010-07-08 Thread John Johnson
 I have taken all advice and the code now looks like below which cleans up the 
 pointed out controller leak and does not store [self window]:

There still seems to be some problems with your code...

 - (IBAction)sewing:(id)sender {
 
   [[[SewingController alloc] initWithWindowNibName:@Sewing and Color 
 andBFileName:mBFilename] release];
 }

You allocate and immediately release the controller here... not quite sure what 
you're trying to do here, but that basically means you don't have a controller 
object, and your window will not stay onscreen. Have you actually tested this 
code?

 - (id) initWithWindowNibName:(NSString*)windowNibName 
 andBFileName:(BFilename*)bfilename
 {
   self = [super initWithWindowNibName:windowNibName];
   if (self != nil)
   {
   [self retain];
   m_design = [[self window] contentView];
 
   
   [[self window] setDelegate:self];
   }
   return self;
 }

Once again, no point in hanging on to the content view and storing it in an 
ivar, because just like the window, it's easily accessible from -window 
-contentView. Unless it's a custom view, but I do not see a cast here... Also, 
do you have a reason for retaining self?

 
 - (void)windowWillClose:(NSNotification *)notification {
 
   if(m_design-m_dirtyDesign)
   NSLog(@dirty message);
   else
   NSLog(@clean, no message);
   [self release];
 }

This -release is interesting as 
well.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom bundle icon

2010-07-05 Thread John Johnson
 You should do as Jean-Daniel says, but also, you should set the 'bundle
 bit' of your .ftplugin files.
 
 The system only knows to show .ftplugin folders as flat files if it can
 find your UTI somewhere.  If the user has your app, then that's fine,
 but if not then he'll still see a folder.

Thanks for the info on the bundle bit. So can I set the UTI on the plugin 
itself, or must I set it on the main app? I mean, I understand that setting it 
on the main app will work, but will  setting it on just the plugin work as 
well?___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom bundle icon

2010-07-05 Thread John Johnson
 You can't set a UTI on something. You provide a UTI declaration in
 your Info.plist, consisting of a set of attributes that define what it
 means for a file to conform to a UTI, and Launch Services uses that to
 match files against when it tries to determine their UTI. So, no, by
 definition you can't set it on your plugin bundle.
 
 Did you instead mean you wanted to provide your UTI declaration in
 your plugin bundle's Info.plist? That won't work, unforunately. The
 Declaring New Uniform Type Identifiers section of the Uniform Type
 Identifiers Overview enumerates the bundles which Launch Services
 consults when searching for UTI declarations: app bundles, Spotlight
 importers, and Automator actions.
 http://developer.apple.com/mac/library/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_declare/understand_utis_declare.html#//apple_ref/doc/uid/TP40001319-CH204-SW1

Ah well that's OK, this clears it all up for me. And yes, I did mean setting 
the UTI keys on the plugin rather than the app. Toe may toe, tuh mah toe... 
:)___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Custom bundle icon

2010-07-02 Thread John Johnson
Just an aesthetic question. I've implemented an API for cocoa plugins in my 
app, and the plugins use a custom extension, ftplugin. These plugins show up as 
folders in the finder, even though I've set the app icon to an icns file. Is 
there something particular I have to do to have the plugin treated as a package 
with my custom icon showing?

Thanks,
John___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom bundle icon

2010-07-02 Thread John Johnson
If only I'd searched a little longer, but the lack of definitive keywords made 
it difficult...
http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01533.html

Now it shows up and acts as a plugin in the Finder, but it still does not use 
the custom icon file that I've set.

On Jul 2, 2010, at 8:39 AM, John Johnson wrote:

 Just an aesthetic question. I've implemented an API for cocoa plugins in my 
 app, and the plugins use a custom extension, ftplugin. These plugins show up 
 as folders in the finder, even though I've set the app icon to an icns file. 
 Is there something particular I have to do to have the plugin treated as a 
 package with my custom icon showing?
 
 Thanks,
 John

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: DnD International No symbol

2010-06-19 Thread John Johnson
 On Wed, Jun 16, 2010 at 7:19 PM, Tony Romano tony...@hotmail.com wrote:
 Hmm...  I'm returning the NSDragOperationNone now, all I get is an image of 
 what is being dragged no other symbol and the outlineview won't accept the 
 drop which is correct.  When I have a valid selection, I get the other 
 symbol for copy(green circle with plus sign), or for Move, the outlineview 
 highlights the drop point.
 
 Right, that's what I would expect. Cocoa doesn't distinguish between
 can't drop and can drop by changing the cursor.

I don't know about that. Consider trying to drag and drop a file onto a 
read-only disk image in the finder... you get the no smoking symbol 
cursor.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem running CocoaDVDPlayer sample

2010-06-17 Thread John Johnson
 Didn't there used to be a technote on how to circumvent this behavior?
 iTunes pulls some of the same trickery.

I doubt Apple would build in a way to circumvent this behavior. That would 
defeat the purpose of having it there in the first place. 
That said, you can build a kernel extension that circumvents this; it basically 
just hijacks the ptrace call for PT_DENY_ATTACH and immediately returns. I use 
something similar myself.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSButton with image

2010-06-14 Thread John Johnson
 If all I want is an image that acts like a button, do I need to
 subclass NSButton? I just want my button to show only my image and no
 Apple style button backgrounds.

All this is easily found in the NSButton and NSButtonCell documentation. I 
believe what you are looking for is setImagePosition:NSImageOnly, 
setBordered:NO, setButtonType:NSMomentaryChangeButton.
In InterfaceBuilder, all these options are available too. Image position will 
be the button showing just the square, the bordered option is a checkbox, 
etc.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Spotlight-Style search menu

2010-06-02 Thread John Johnson
So I know how to set a view in an NSMenuItem, but my question is how to get it 
to look similar to the Spotlight search menu. For example, if I set the first 
item in a popup menu to a custom view, there is still a thin strip of white 
across the top. I want the gradient from the view to fill up the entire 
background. Is this a custom control or is there a way to get an NSMenu to 
behave like this?

John___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: The Unadopted Protocol

2010-06-02 Thread John Johnson

 This compiles and runs fine, even though MyClass never adopted the protocol
 Unadopted. It take it that by casting mc to an id, I cause the compiler to
 grasp at the only signature for testing that it knows about, namely the
 one in the protocol. So it happily uses that signature without complaint,
 and at runtime the correct message is sent to the MyClass instance.

I noticed this, but I assume that by casting it to an id you are discarding the 
protocol conformance. I'd always thought protocol conformance was just to have 
the compiler warn you if you hadn't implemented a particular method. Doesn't it 
only get checked at runtime if conformsToProtocol: is called on it?
By having an id variable, the compiler thinks it can accept any message, and if 
the object can respond to that message at runtime, it's all fine.

So... maybe (d) :)

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Spotlight-Style search menu

2010-06-02 Thread John Johnson

 Currently there is not. You should file an enhancement request at 
 http://bugreport.apple.com asking for this feature. You're certainly not the 
 only one who would like it. :)
 
 --Kyle Sluder

Hmm that is slightly disappointing. Another couple of subclasses and dozens of 
lines of code for this one feature... I filed the enhancement request as per 
your suggestion, thanks for your quick response.


 I don't know but if you can set your NSStatusItem as a custom view and 
 determine it's location on the screen, you can then show your custom view in 
 a borderless window at that position

This is the solution I've decided on as well. It's actually a button on a 
window that I want to trigger the search field to pop down, and I still want it 
to behave like a menu, i.e. clicking anywhere else on the screen dismisses the 
menu, and the button get's the pushed in look. What's the best way to achieve 
this behavior? ___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Spotlight-Style search menu (SOLVED)

2010-06-02 Thread John Johnson

 Well, you can have the custom view in the status bar to be a NSButton, it's 
 action will compute the location and make the window key and visible at that 
 location and when the window resigns key, just fade it away

Brilliant! Seems the only way to go. Anyhow, thanks for the help 
:)___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about how to make a custom sheet

2010-05-29 Thread John Johnson
Perhaps NSWindowController subclass is what you're looking for. A sheet is just 
another window. Then set the File's Owner of the NIB file that houses the sheet 
to this subclass.

 My problem is how to get a custom class attached to the sheet, so controls on 
 the sheet can be controlled during user interaction. This step is not 
 mentioned in the documentation.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: reformat drive to HFS via API

2010-05-25 Thread John Johnson
The DiskManagement.framework is a private framework. Short of creating your own 
API using low-level disk access, diskutil may be your best bet.

 I would like to be able to reformat a flash drive from control application, 
 but it appears that there is no public API that allows this kind access.  Am 
 I missing something in the documentation?  Or do I do something like call out 
 to diskutil to make it happen?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com