Changeset 464


Ignore:
Timestamp:
04/10/08 21:55:16 (11 years ago)
Author:
Nicholas Riley
Message:

CFUserNotification changes: info icon no longer displayed, so display bookmark helper app icon; remove no-longer-necessary CFUserNotificationCreate CFLog suppression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEBookmarks.c

    r122 r464  
    159159    SAFE_RELEASE(bundleURL);
    160160
     161    // get the bookmark helper's icon
     162    bundleURL = ICCF_GetBookmarkHelperURL(inst);
     163    if (bundleURL == NULL) return kICBookmarkNoHelperErr;
     164   
     165    CFBundleRef bundle = CFBundleCreate(NULL, bundleURL);
     166    SAFE_RELEASE(bundleURL);
     167    if (bundle == NULL) return kICBookmarkNoHelperErr;
     168   
     169    CFStringRef iconFile = CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("CFBundleIconFile"));
     170    if (iconFile != NULL) {
     171        CFURLRef iconURL = CFBundleCopyResourceURL(bundle, iconFile, NULL, NULL);
     172        if (iconURL != NULL) {
     173            CFDictionaryAddValue(dict, kCFUserNotificationIconURLKey, iconURL);
     174            CFRelease(iconURL);
     175        }
     176    }
     177
    161178    const CFStringRef textFieldTitles[] = { ICCF_CopyLocalizedString(CFSTR("Location:")), ICCF_CopyLocalizedString(CFSTR("Name:")), ICCF_CopyLocalizedString(CFSTR("Description:")) };
    162179    const CFStringRef textFieldValues[] = { url, CFSTR(""), CFSTR("") };
     
    173190    if (textFieldValuesArray != NULL) CFRelease(textFieldValuesArray);
    174191
    175     // XXX suppress log message from Apple's code:
    176     // 2003-02-02 17:48:26.896 TextEdit[2790] CFLog (20): Add Bookmark:  Bookmark name and description are optional.
    177     int errfd = dup(STDERR_FILENO), nullfd = open("/dev/null", O_WRONLY, 0);
    178     // need to have something open in STDERR_FILENO because if it isn't,
    179     // CFLog will log to /dev/console
    180     dup2(nullfd, STDERR_FILENO);
    181     close(nullfd);
    182192    CFUserNotificationRef notification = CFUserNotificationCreate(NULL, 0, kCFUserNotificationPlainAlertLevel, &err, dict);
    183     dup2(errfd, STDERR_FILENO);
    184     close(errfd);
    185193    if (notification == NULL) {
    186194        CFRelease(dict);
Note: See TracChangeset for help on using the changeset viewer.