Closed Bug 546854 Opened 16 years ago Closed 15 years ago

Preference Manager should be able to get/set file preferences.

Categories

(Camino Graveyard :: Preferences, defect)

1.9.2 Branch
All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: chris, Assigned: chris)

References

Details

Attachments

(1 file, 5 obsolete files)

Bug 546853 requires getting and setting a complex pref (of type nsILocalFile). It makes sense to add this functionality to the Preference Manager.
Blocks: 546853
I'd recommend the API be get/setFilePref, have it deal in NSURLs, and do the conversion to and from nsILocalFile internally. That's consistent with the way the rest of the prefs API works, and doesn't force clients to deal in Gecko types to get completely generic support we may never need.
Summary: Preference Manager should be able to get/set complex values. → Preference Manager should be able to get/set file preferences.
Attached patch Fix v1.0 (obsolete) — Splinter Review
Here's my initial attempt.
Assignee: nobody → trendyhendy2000
Status: NEW → ASSIGNED
Attached patch Fix v1.1 (obsolete) — Splinter Review
This is a bit nicer.
Attachment #428013 - Attachment is obsolete: true
Attachment #428126 - Flags: review?
Attached patch Fix v1.1 (obsolete) — Splinter Review
Sorry, this is the real Fix v1.1.
Attachment #428126 - Attachment is obsolete: true
Attachment #428140 - Flags: review?
Attachment #428126 - Flags: review?
Attached patch Fix v1.2 (obsolete) — Splinter Review
Now with support for spaces in directory names!
Attachment #428140 - Attachment is obsolete: true
Attachment #428140 - Flags: review?
(I suppose this can actually land in cvs now, but it's not actually needed until 1.9.2; not quite sure how I want to track those cases yet.)
Version: Trunk → 1.9.2 Branch
Attachment #428328 - Flags: review?(stuart.morgan+bugzilla)
Comment on attachment 428328 [details] [diff] [review] Fix v1.2 r=me. However... the more I think about it the more I think the default return value for the getter should be nil. I know that's not consistent with the string method, but a URL based on an empty string isn't a meaningful object in the same way that @"" is. I couldn't even tell you for sure what URL that would construct (and I'm not sure an empty string is a valid init argument, since I don't know if the RFC allows empty string URL). So I think the first line should be changed to ... = nil;
Attachment #428328 - Flags: review?(stuart.morgan+bugzilla) → review+
Attached patch Fix v1.3 (obsolete) — Splinter Review
Same as version 1.2, but with nil initializer for prefValue.
Attachment #428328 - Attachment is obsolete: true
Attachment #434809 - Flags: superreview?(mikepinkerton)
Attachment #434809 - Flags: review+
+- (NSURL*)getFilePref: (const char*)prefName withSuccess:(BOOL*)outSuccess; - (NSString*)getStringPref: (const char*)prefName withSuccess:(BOOL*)outSuccess; - (NSColor*)getColorPref: (const char*)prefName withSuccess:(BOOL*)outSuccess; - (BOOL)getBooleanPref: (const char*)prefName withSuccess:(BOOL*)outSuccess; - (int)getIntPref: (const char*)prefName withSuccess:(BOOL*)outSuccess; why the space after the colon? Can we just fix that? The definition doesn't have the space. + (void)mPrefs->SetComplexValue(prefName, NS_GET_IID(nsILocalFile), filePref); Why the (void)? Do we really do this elsewhere? sr=pink
Attachment #434809 - Flags: superreview?(mikepinkerton) → superreview+
Those two bits of code in the sr review were done to maintain consistency with similar code in the same source file. Changing them doesn't affect the resulting behaviour, so the patch for checkin does that.
Attachment #434809 - Attachment is obsolete: true
Attachment #440684 - Flags: superreview+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: