|
|
Can someone please help me with a problem
|
|
|
|
Fresh-Faced Recruit
Join Date: Jul 2004
Status:
Offline
|
|
Dear everyone,
I am making a program and need some code(like an xcode project). What i need it to do is when a button is clicked a file browser appears. Then the person clicks an icns file. Then system>library>coreservices>systemicons.bundle>con tents>resources>genericfoldericon.icns is replaced with the icon they selected.
After that is finished the file browser goes away. I know some of you might say "its called if you dont know what you are doing dont do it. But fact is I dont know until i try and I have dealt with system level files before.
Thanks in advanced,
NF (naintofaren)
(
Last edited by Naintofaren; Oct 17, 2004 at 10:11 AM.
)
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status:
Offline
|
|
You need to use an NSOpenPanel (or if you want one that closes right after clicking on an icon, a subclass, though I don't recommend that). Read the documentation on it and NSSavePanel for more info, especially -filename and -runModalForTypes: (I think that's the method you want anyway).
Edit: you'll also need to get authentication to change system files. That, you'll have to ask somebody else about.
|
I bring order to chaos. You are in chaos windows, you are the contradiction, a bug wishing to be an OS.
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
For authentication and modifying of system files, see ThemeChanger's source.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jul 2004
Status:
Offline
|
|
hmm I tried my best but i got so many errors and things. Could someone please build an example and email it to [email protected]? I would really appreaciate it. I think it would be a better learning experience then the themechanger code which is hard to read.
Thanks in advanced,
Naintofaren
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by Naintofaren:
hmm I tried my best but i got so many errors and things. Could someone please build an example and email it to [email protected]? I would really appreaciate it. I think it would be a better learning experience then the themechanger code which is hard to read.
How exactly is the ThemeChanger code hard to read? It does exactly what you want, and people have complemented me on its readability in the past. Anyway, look at MoreAuthSample and AuthSample on http://developer.apple.com/samplecode/, and also read the documentation on authencation. Asking someone to do this for you is probably not going to get any takers.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jul 2004
Status:
Offline
|
|
Oh sory I worded that wrong. Its not that it is hard to read its just that I have no idea what alot of the code is doing.
Ill try the sample code
Thanks,
NaintoFaren
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jul 2004
Status:
Offline
|
|
uh oh. I dont know c. I only know cocoa. Although I am thinking of switching over to c I dont know any of it. Could you give me some cocoa examples? Thanks
Sincerly,
NaintoFaren
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status:
Offline
|
|
How can you know Cocoa without knowing C? It (though not C++) is kind of a prerequisite, since Objective-C (Cocoa) is a superset of C.
|
I bring order to chaos. You are in chaos windows, you are the contradiction, a bug wishing to be an OS.
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jul 2004
Status:
Offline
|
|
i understand what the code does but i cant turn it into cocoa
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by Naintofaren:
i understand what the code does but i cant turn it into cocoa
You don't "turn it into Cocoa". Cocoa is a framework. MoreAuthSample uses other frameworks that do other things, like the Security framework. ThemeChanger is a Cocoa application which uses the techniques showcased in MoreAuthSample.
There are some more recent Obj-C interfaces to Security, see SecurityFoundation and SecurityInterface, but they're not as a well documented and I believe are only 10.3+
Seriously, if you didn't know that, you shouldn't be doing anything that requires root access.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Originally posted by Angus_D:
You don't "turn it into Cocoa". Cocoa is a framework. MoreAuthSample uses other frameworks that do other things, like the Security framework.
To be more explicit, Cocoa is a framework written in Objective-C, which is a superset (i.e. includes all of) the C language. Any C code is valid in Objective-C, since from Objective-C's point of view, they're the same language.
The idea of turning C code "into Cocoa" doesn't make any sense. Cocoa is a framework which applications use.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jul 2004
Status:
Offline
|
|
ok so i goofed on a couple posts. I figured out how to do everything but have the lock and unlock feature for my app. Can someone give me some code or a sample xcode app that shows how to use the security.framework for an unlock/lock feature. I dont need a big application just something that unlocks and locks.
Thanks again,
NaintoFaren
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Aug 2002
Location: Oxford, England
Status:
Offline
|
|
If your looking to use the lock/unlock graphic like in many system preferences you'll need to use SFAuthorizationView.
More info on the various apple lists cocoadev and cdsa.
You can also try searching for an answer on cocoabuilder before posting a question, its often quicker.
|
Luke
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|