Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Can someone please help me with a problem

Can someone please help me with a problem
Thread Tools
Naintofaren
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 14, 2004, 07:20 PM
 
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. )
     
GeeYouEye
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status: Offline
Reply With Quote
Oct 15, 2004, 04:08 PM
 
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.
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 16, 2004, 05:10 AM
 
For authentication and modifying of system files, see ThemeChanger's source.
     
Naintofaren  (op)
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 17, 2004, 10:10 AM
 
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
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 17, 2004, 10:19 AM
 
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.
     
Naintofaren  (op)
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 17, 2004, 01:10 PM
 
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
     
Naintofaren  (op)
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 17, 2004, 07:05 PM
 
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
     
GeeYouEye
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status: Offline
Reply With Quote
Oct 17, 2004, 07:38 PM
 
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.
     
Naintofaren  (op)
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 17, 2004, 07:51 PM
 
i understand what the code does but i cant turn it into cocoa
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 21, 2004, 03:03 PM
 
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.
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Oct 21, 2004, 03:58 PM
 
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'."
     
Naintofaren  (op)
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Oct 25, 2004, 07:49 AM
 
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
     
sandsl
Senior User
Join Date: Aug 2002
Location: Oxford, England
Status: Offline
Reply With Quote
Oct 25, 2004, 10:08 AM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:57 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,