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 */; };
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,
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,
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,
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 );
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 );
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 );
/* set the new location and reverify */
tr_torrentSetDownloadDir( tor, location );
}
+ tr_ptrArrayDestruct( &copiedxattrs, tr_free );
}
if( !err && do_move )
#define HAVE_ICONV_OPEN
#define HAVE_MKDTEMP
#define HAVE_VALLOC
+ #define HAVE_XATTRS_MACOS
#endif
#include <assert.h>
#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>
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;
+}
+
/***
****
***/
if( bytesLeft != 0 )
return -1;
+ tr_copyXattr( oldpath, newpath );
unlink( oldpath );
return 0;
}
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
*
* @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
* @discussion See setGrowlDelegate: for details.
* @result The Growl delegate.
*/
-+ (NSObject<GrowlApplicationBridgeDelegate> *) growlDelegate;
++ (id<GrowlApplicationBridgeDelegate>) growlDelegate;
#pragma mark -
* 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.
* 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,
+ (NSDictionary *) notificationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
+ (NSDictionary *) frameworkInfoDictionary;
-@end
-//------------------------------------------------------------------------------
#pragma mark -
/*!
- * @protocol GrowlApplicationBridgeDelegate
- * @abstract Required protocol for the Growl delegate.
- * @discussion The methods in this protocol are required and are called
- * automatically as needed by GrowlApplicationBridge. See
- * <code>+[GrowlApplicationBridge setGrowlDelegate:]</code>.
- * See also <code>GrowlApplicationBridgeDelegate_InformalProtocol</code>.
+ *@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;
-@protocol GrowlApplicationBridgeDelegate
-
-// -registrationDictionaryForGrowl has moved to the informal protocol as of 0.7.
+/*!
+ * @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
#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.
+ * @protocol GrowlApplicationBridgeDelegate
+ * @abstract Required protocol for the Growl delegate.
+ * @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>.
*/
-@interface NSObject (GrowlApplicationBridgeDelegate_InformalProtocol)
+
+@protocol GrowlApplicationBridgeDelegate <NSObject>
+
+@optional
/*!
* @method registrationDictionaryForGrowl
* 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.
*/
#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
*/
#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. */
#define GROWL_POSITION_PREFERENCE_KEY @"GrowlSelectedPosition"
+#define GROWL_PLUGIN_CONFIG_ID XSTR("GrowlPluginConfigurationID")
+
#endif //ndef _GROWLDEFINES_H
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
- <string>11C74</string>
+ <string>12A269</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<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>
<dict>
<key>Resources/Info.plist</key>
<data>
- SwzGt9RQsuVafBBrfBalB75dCwU=
+ lnx8exuPwE/bsUq32R5DXDQholc=
</data>
</dict>
<key>rules</key>
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
[renderedIcon unlockFocus];
NSData * iconData = [renderedIcon TIFFRepresentation];
+ [renderedIcon release];
NSDictionary * imgProps = @{
(NSString *)kQLPreviewPropertyMIMETypeKey : @"image/png",
//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)
(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;
}
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))
rect.size.height -= intersectLineBorderRect.size.height;
}
+
+ //top line
if (active)
{
lineBorderRect.origin.y = NSHeight([self bounds]) - 1.0;