Revert r13468 for now.

This commit is contained in:
Mitchell Livingston 2012-09-06 03:21:03 +00:00
parent 4935b91e3a
commit 9e7e64fe04
12 changed files with 230 additions and 40 deletions

View File

@ -286,8 +286,8 @@
A2D77451154CC25700A62B93 /* WebSeedTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D7744F154CC25700A62B93 /* WebSeedTableView.h */; };
A2D77452154CC25700A62B93 /* WebSeedTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D77450154CC25700A62B93 /* WebSeedTableView.m */; };
A2D77453154CC72B00A62B93 /* WebSeedTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D77450154CC25700A62B93 /* WebSeedTableView.m */; };
A2D8CFBA15F82DFA0056E93D /* NSApplicationAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A29D84031049C25600D1987A /* NSApplicationAdditions.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
A2D8CFBB15F82E030056E93D /* NSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DE5CC9C0980656F00BE280E /* NSStringAdditions.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
A2D8CFBA15F82DFA0056E93D /* NSApplicationAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A29D84031049C25600D1987A /* NSApplicationAdditions.m */; };
A2D8CFBB15F82E030056E93D /* NSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DE5CC9C0980656F00BE280E /* NSStringAdditions.m */; };
A2DA362A0CBC674900C2ED41 /* InfoActivity.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36270CBC674900C2ED41 /* InfoActivity.png */; };
A2DA362B0CBC674900C2ED41 /* InfoFiles.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36280CBC674900C2ED41 /* InfoFiles.png */; };
A2DA362C0CBC674900C2ED41 /* InfoPeers.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36290CBC674900C2ED41 /* InfoPeers.png */; };
@ -3595,12 +3595,13 @@
A2F35BD115C5A0A100EBF632 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist";
INSTALL_PATH = /Library/QuickLook;
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.6.8;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/third-party/curl/lib\"",
);
OTHER_LDFLAGS = (
"-read_only_relocs",
suppress,
@ -3613,12 +3614,13 @@
A2F35BD215C5A0A100EBF632 /* Release - Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist";
INSTALL_PATH = /Library/QuickLook;
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.6.8;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/third-party/curl/lib\"",
);
OTHER_LDFLAGS = (
"-read_only_relocs",
suppress,
@ -3631,12 +3633,13 @@
A2F35BD315C5A0A100EBF632 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist";
INSTALL_PATH = /Library/QuickLook;
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.6.8;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/third-party/curl/lib\"",
);
OTHER_LDFLAGS = (
"-read_only_relocs",
suppress,

View File

@ -2914,6 +2914,8 @@ setLocation( void * vdata )
if( !tr_is_same_file( location, tor->currentDir ) )
{
tr_file_index_t i;
tr_ptrArray copiedxattrs = TR_PTR_ARRAY_INIT;
const void * const vstrcmp = strcmp;
/* bad idea to move files while they're being verified... */
tr_verifyRemove( tor );
@ -2935,6 +2937,7 @@ setLocation( void * vdata )
if( do_move && !tr_is_same_file( oldpath, newpath ) )
{
char * cursub;
bool renamed = false;
errno = 0;
tr_torinf( tor, "moving \"%s\" to \"%s\"", oldpath, newpath );
@ -2944,6 +2947,24 @@ setLocation( void * vdata )
tr_torerr( tor, "error moving \"%s\" to \"%s\": %s",
oldpath, newpath, tr_strerror( errno ) );
}
/* copy extended attributes */
cursub = tr_dirname( sub );
while( strcmp( cursub, "." ) != 0 ) {
char * tmp;
if ( tr_ptrArrayFindSorted( &copiedxattrs, cursub, vstrcmp ) == NULL ) {
char * olddir = tr_buildPath( oldbase, cursub, NULL );
char * newdir = tr_buildPath( location, cursub, NULL );
tr_copyXattr( olddir, newdir );
tr_free( olddir );
tr_free( newdir );
tr_ptrArrayInsertSorted( &copiedxattrs, tr_strdup( cursub ), vstrcmp );
}
tmp = tr_dirname( cursub );
tr_free( cursub );
cursub = tmp;
}
tr_free(cursub);
}
tr_free( newpath );
@ -2967,6 +2988,7 @@ setLocation( void * vdata )
/* set the new location and reverify */
tr_torrentSetDownloadDir( tor, location );
}
tr_ptrArrayDestruct( &copiedxattrs, tr_free );
}
if( !err && do_move )

View File

@ -19,6 +19,7 @@
#define HAVE_ICONV_OPEN
#define HAVE_MKDTEMP
#define HAVE_VALLOC
#define HAVE_XATTRS_MACOS
#endif
#include <assert.h>
@ -40,6 +41,9 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_XATTRS_MACOS
#include <sys/xattr.h> /* listxattr(), getxattr(), setxattr() */
#endif
#include <unistd.h> /* stat(), getcwd(), getpagesize(), unlink() */
#include <event2/buffer.h>
@ -1510,6 +1514,75 @@ tr_strratio( char * buf, size_t buflen, double ratio, const char * infinity )
return buf;
}
int
tr_copyXattr( const char* srcpath, const char* dstpath )
{
int ret = 0;
#ifdef HAVE_XATTRS_MACOS
char * listbuf = NULL, * valuebuf = NULL;
ssize_t listlen = 0, valuelen = 0;
char* name;
listlen = listxattr( srcpath, NULL, 0, 0 );
if( listlen <= 0 ) {
ret = -1;
goto out;
}
listbuf = tr_malloc( listlen );
if( listbuf == NULL ) {
ret = -1;
goto out;
}
listlen = listxattr( srcpath, listbuf, listlen, 0 );
if( listlen <= 0) {
ret = -1;
goto out;
}
for( name = listbuf; name < listbuf + listlen; name = strchr( name, '\0' ) + 1) {
ssize_t len = getxattr( srcpath, name, NULL, 0, 0, 0);
if( len < 0 ) {
ret = -1;
goto out;
}
if( len > valuelen ) {
valuelen = len;
valuebuf = reallocf( valuebuf, valuelen );
if (valuebuf == NULL) {
ret = -1;
goto out;
}
}
len = getxattr( srcpath, name, valuebuf, valuelen, 0, 0 );
if ( len < 0) {
ret = -1;
goto out;
}
ret = setxattr( dstpath, name, valuebuf, len, 0, 0 );
if( ret != 0 ) {
ret = -1;
goto out;
}
}
out:
tr_free( valuebuf );
tr_free( listbuf );
if( ret != 0 )
tr_err( "Couldn't copy xattrs from \"%s\" to \"%s\": %s",
srcpath, dstpath, tr_strerror( errno ) );
#endif
return ret;
}
/***
****
***/
@ -1578,6 +1651,7 @@ tr_moveFile( const char * oldpath, const char * newpath, bool * renamed )
if( bytesLeft != 0 )
return -1;
tr_copyXattr( oldpath, newpath );
unlink( oldpath );
return 0;
}

View File

@ -481,6 +481,12 @@ char* tr_strratio( char * buf, size_t buflen, double ratio, const char * infinit
struct tm * tr_localtime_r( const time_t *_clock, struct tm *_result );
/**
* @brief copy extended attributes of a file or a folder
* @return 0 on success; otherwise, return -1 and set errno
*/
int tr_copyXattr( const char* srcpath, const char* dstpath ) TR_GNUC_NONNULL(1,2);
/**
* @brief move a file
* @return 0 on success; otherwise, return -1 and set errno

View File

@ -112,7 +112,7 @@
*
* @param inDelegate The delegate for the GrowlApplicationBridge. It must conform to the GrowlApplicationBridgeDelegate protocol.
*/
+ (void) setGrowlDelegate:(NSObject<GrowlApplicationBridgeDelegate> *)inDelegate;
+ (void) setGrowlDelegate:(id<GrowlApplicationBridgeDelegate>)inDelegate;
/*!
* @method growlDelegate
@ -120,7 +120,7 @@
* @discussion See setGrowlDelegate: for details.
* @result The Growl delegate.
*/
+ (NSObject<GrowlApplicationBridgeDelegate> *) growlDelegate;
+ (id<GrowlApplicationBridgeDelegate>) growlDelegate;
#pragma mark -
@ -260,6 +260,7 @@
* Growl when next it is ready; <code>NO</code> if not.
*/
+ (void) setWillRegisterWhenGrowlIsReady:(BOOL)flag;
/*! @method willRegisterWhenGrowlIsReady
* @abstract Reports whether GrowlApplicationBridge will register with Growl
* when Growl next launches.
@ -361,6 +362,7 @@
* copy of <code>regDict</code>.
*/
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
/*! @method registrationDictionaryByFillingInDictionary:restrictToKeys:
* @abstract Tries to fill in missing keys in a registration dictionary.
* @discussion This method examines the passed-in dictionary for missing keys,
@ -400,6 +402,32 @@
+ (NSDictionary *) notificationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
+ (NSDictionary *) frameworkInfoDictionary;
#pragma mark -
/*!
*@method growlURLSchemeAvailable
*@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this
*@return Returns whether growl:// is registered on the system
*@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function
* Further, this method can provide a check on whether Growl is installed,
* however, the framework will not be relying on this method for choosing when/how to notify,
* and it is not recommended that the app rely on it for other than whether to use growl:// methods
*@since Growl.framework 1.4
*/
+ (BOOL) isGrowlURLSchemeAvailable;
/*!
* @method openGrowlPreferences:
* @abstract Open Growl preferences, optionally to this app's settings, growl:// method
* @param showApp Whether to show the application's settings, otherwise just opens to the last position
* @return Return's whether opening the URL was succesfull or not.
* @discussion Will launch if Growl is installed, but not running, and open the preferences window
* Uses growl:// URL scheme
* @since Growl.framework 1.4
*/
+ (BOOL) openGrowlPreferences:(BOOL)showApp;
@end
//------------------------------------------------------------------------------
@ -408,27 +436,15 @@
/*!
* @protocol GrowlApplicationBridgeDelegate
* @abstract Required protocol for the Growl delegate.
* @discussion The methods in this protocol are required and are called
* @discussion The methods in this protocol are optional and are called
* automatically as needed by GrowlApplicationBridge. See
* <code>+[GrowlApplicationBridge setGrowlDelegate:]</code>.
* See also <code>GrowlApplicationBridgeDelegate_InformalProtocol</code>.
*/
@protocol GrowlApplicationBridgeDelegate
@protocol GrowlApplicationBridgeDelegate <NSObject>
// -registrationDictionaryForGrowl has moved to the informal protocol as of 0.7.
@end
//------------------------------------------------------------------------------
#pragma mark -
/*!
* @category NSObject(GrowlApplicationBridgeDelegate_InformalProtocol)
* @abstract Methods which may be optionally implemented by the GrowlDelegate.
* @discussion The methods in this informal protocol will only be called if implemented by the delegate.
*/
@interface NSObject (GrowlApplicationBridgeDelegate_InformalProtocol)
@optional
/*!
* @method registrationDictionaryForGrowl

View File

@ -99,6 +99,14 @@
* This key is optional.
*/
#define GROWL_NOTIFICATIONS_DESCRIPTIONS XSTR("NotificationDescriptions")
/*! @defined GROWL_NOTIFICATIONS_ICONS
* @abstract A dictionary of icons for each notification
* @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are
* icons for each notification, for GNTP spec
*
* This key is optional.
*/
#define GROWL_NOTIFICATIONS_ICONS XSTR("NotificationIcons")
/*! @defined GROWL_TICKET_VERSION
* @abstract The version of your registration ticket.
@ -212,6 +220,19 @@
*/
#define GROWL_NOTIFICATION_PROGRESS XSTR("NotificationProgress")
/*! @defined GROWL_NOTIFICATION_ALREADY_SHOWN
* @abstract If this key is set, it should contain a bool value wrapped
* in a NSNumber which describes whether the notification has
* already been displayed, for instance by built in Notification
* Center support. This value can be used to allow display
* plugins to skip a notification, while still allowing Growl
* actions to run on them.
*
* Optional. Not supported by all display plugins.
*/
#define GROWL_NOTIFICATION_ALREADY_SHOWN XSTR("AlreadyShown")
// Notifications
#pragma mark Notifications
@ -316,6 +337,28 @@
*/
#define GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX XSTR("GrowlTimedOut!")
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON
* @abstract The distributed notification sent when the Notification Center support is toggled on in Growl 2.0
* @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent
* to inform all running apps that they should now speak to Notification Center directly.
*/
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON XSTR("GrowlNotificationCenterOn!")
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF
* @abstract The distributed notification sent when the Notification Center support is toggled off in Growl 2.0
* @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent
* to inform all running apps that they should no longer speak to Notification Center directly.
*/
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF XSTR("GrowlNotificationCenterOff!")
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY
* @abstract The distributed notification sent by an application to query Growl 2.0's notification center support.
* @discussion When an app starts up, it will send this query to get Growl 2.0 to spit out whether notification
* center support is on or off.
*/
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY XSTR("GrowlNotificationCenterYN?")
/*! @group Other symbols */
/* Symbols which don't fit into any of the other categories. */
@ -338,4 +381,6 @@
#define GROWL_POSITION_PREFERENCE_KEY @"GrowlSelectedPosition"
#define GROWL_PLUGIN_CONFIG_ID XSTR("GrowlPluginConfigurationID")
#endif //ndef _GROWLDEFINES_H

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>11C74</string>
<string>12A269</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
@ -15,25 +15,25 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3.1</string>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>GRRR</string>
<key>CFBundleVersion</key>
<string>1.3.1</string>
<string>2.0</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>4D199</string>
<string>4F250</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>11C63</string>
<string>12A264</string>
<key>DTSDKName</key>
<string>macosx10.7</string>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0420</string>
<string>0440</string>
<key>DTXcodeBuild</key>
<string>4D199</string>
<string>4F250</string>
<key>NSPrincipalClass</key>
<string>GrowlApplicationBridge</string>
</dict>

View File

@ -6,7 +6,7 @@
<dict>
<key>Resources/Info.plist</key>
<data>
SwzGt9RQsuVafBBrfBalB75dCwU=
lnx8exuPwE/bsUq32R5DXDQholc=
</data>
</dict>
<key>rules</key>

View File

@ -291,7 +291,27 @@
NSTableColumn * column = [tableView tableColumnWithIdentifier: @"Message"];
const CGFloat count = floorf([message sizeWithAttributes: fAttributes].width / [column width]);
return [tableView rowHeight] * (count + 1.0);
const CGFloat oldHeight = [tableView rowHeight] * (count + 1.0);
NSLog(@"oldHeight: %f", oldHeight);
NSAttributedString * attributedMessage = [[NSAttributedString alloc] initWithString: message attributes: fAttributes];
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedMessage);
[attributedMessage release];
const CGSize size = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRangeMake(0, 0), NULL, CGSizeMake([column width], CGFLOAT_MAX), NULL);
CFRelease(framesetter);
NSLog(@"new %@", NSStringFromSize(size));
//NSLog(@"%@", fAttributes);
CGFloat newHeight = size.height;
//not sure why this is needed
const CGFloat numRows = newHeight / 13.0;
newHeight += numRows * 1.0;
return newHeight;
}
- (void) tableView: (NSTableView *) tableView sortDescriptorsDidChange: (NSArray *) oldDescriptors

View File

@ -20,6 +20,7 @@ NSString * generateIconData(NSString * fileExtension, NSUInteger width, NSMutabl
[renderedIcon unlockFocus];
NSData * iconData = [renderedIcon TIFFRepresentation];
[renderedIcon release];
NSDictionary * imgProps = @{
(NSString *)kQLPreviewPropertyMIMETypeKey : @"image/png",
@ -42,7 +43,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
//try to parse the torrent file
tr_info inf;
tr_ctor * ctor = tr_ctorNew(NULL);
tr_ctorSetMetainfoFromFile(ctor, [[(__bridge NSURL *)url path] UTF8String]);
tr_ctorSetMetainfoFromFile(ctor, [[(NSURL *)url path] UTF8String]);
const int err = tr_torrentParse(ctor, &inf);
tr_ctorFree(ctor);
if (err)
@ -168,7 +169,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
(NSString *)kQLPreviewPropertyMIMETypeKey : @"text/html",
(NSString *)kQLPreviewPropertyAttachmentsKey : allImgProps };
QLPreviewRequestSetDataRepresentation(preview, (__bridge CFDataRef)[htmlString dataUsingEncoding: NSUTF8StringEncoding], kUTTypeHTML, (__bridge CFDictionaryRef)props);
QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)[htmlString dataUsingEncoding: NSUTF8StringEncoding], kUTTypeHTML, (CFDictionaryRef)props);
return noErr;
}

View File

@ -92,6 +92,7 @@
NSRect gridRects[active ? 2 : 3];
NSColor * colorRects[active ? 2 : 3];
//bottom line
NSRect lineBorderRect = NSMakeRect(NSMinX(rect), 0.0, NSWidth(rect), 1.0);
NSRect intersectLineBorderRect = NSIntersectionRect(lineBorderRect, rect);
if (!NSIsEmptyRect(intersectLineBorderRect))
@ -105,6 +106,8 @@
rect.size.height -= intersectLineBorderRect.size.height;
}
//top line
if (active)
{
lineBorderRect.origin.y = NSHeight([self bounds]) - 1.0;