adium 4557:af063450a8a4: Comply to Cocoa memory management guide...

commits at adium.im commits at adium.im
Tue Jan 24 20:24:53 UTC 2012


details:	http://hg.adium.im/adium/rev/af063450a8a4
revision:	4557:af063450a8a4
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Tue Jan 24 22:24:42 2012 +0200

Comply to Cocoa memory management guidelines in AIFloater.

diffs (89 lines):

diff -r 09f21de0e8f2 -r af063450a8a4 Frameworks/AIUtilities Framework/Source/AIFloater.h
--- a/Frameworks/AIUtilities Framework/Source/AIFloater.h	Tue Jan 24 21:20:40 2012 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AIFloater.h	Tue Jan 24 22:24:42 2012 +0200
@@ -20,7 +20,8 @@
  * @class AIFloater
  * @brief A programtically movable, fadable <tt>NSImage</tt> display class
  *
- * <tt>AIFloater</tt> allows for the display of an <tt>NSImage</tt>, including an animating one, anywhere on the screen.  The image can be easily moved programatically and will fade into and out of view as requested. 
+ * <tt>AIFloater</tt> allows for the display of an <tt>NSImage</tt>, including an animating one, anywhere on the screen.
+ * The image can be easily moved programatically and will fade into and out of view as requested. 
  */
 @interface AIFloater : NSObject {
     NSImageView		*staticView;
@@ -35,7 +36,7 @@
  *
  * It will handle releasing itself when closed; it need not be retained by the caller.
  */
-+ (id)floaterWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask;
++ (id)newFloaterWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask;
 
 /*!
  * Position the float at a specified point
diff -r 09f21de0e8f2 -r af063450a8a4 Frameworks/AIUtilities Framework/Source/AIFloater.m
--- a/Frameworks/AIUtilities Framework/Source/AIFloater.m	Tue Jan 24 21:20:40 2012 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AIFloater.m	Tue Jan 24 22:24:42 2012 +0200
@@ -25,14 +25,16 @@
 #define WINDOW_FADE_SNAP		0.05f // How close to min/max we must get before fade is finished
 
 @interface AIFloater ()
+
 - (id)initWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask;
-- (void)_setWindowOpacity:(CGFloat)opacity;
+- (void)AI_setWindowOpacity:(CGFloat)opacity;
+
 @end
 
 @implementation AIFloater
 
 // Because the floater can control its own display, it retains itself and releases when it closes.
-+ (id)floaterWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask
++ (id)newFloaterWithImage:(NSImage *)inImage styleMask:(unsigned int)styleMask
 {
     return [[self alloc] initWithImage:inImage styleMask:styleMask];
 }
@@ -58,7 +60,7 @@
 		[panel setHasShadow:YES];
 		[panel setOpaque:NO];
 		[panel setBackgroundColor:[NSColor clearColor]];
-		[self _setWindowOpacity:WINDOW_FADE_MIN];
+		[self AI_setWindowOpacity:WINDOW_FADE_MIN];
 			
 		// Setup the static view
 		staticView = [[NSImageView alloc] initWithFrame:frame];
@@ -106,7 +108,7 @@
 - (void)setMaxOpacity:(CGFloat)inMaxOpacity
 {
     maxOpacity = inMaxOpacity;
-    if (windowIsVisible) [self _setWindowOpacity:maxOpacity];
+    if (windowIsVisible) [self AI_setWindowOpacity:maxOpacity];
 }
 
 #pragma mark Window Visibility
@@ -134,12 +136,12 @@
 				[fadeAnimation startAnimation];
             }
         } else {
-            [self _setWindowOpacity:(windowIsVisible ? maxOpacity : WINDOW_FADE_MIN)];
+            [self AI_setWindowOpacity:(windowIsVisible ? maxOpacity : WINDOW_FADE_MIN)];
         }
     }
 }
 
-- (void)_setWindowOpacity:(CGFloat)opacity
+- (void)AI_setWindowOpacity:(CGFloat)opacity
 {
     [panel setAlphaValue:opacity];
 }
diff -r 09f21de0e8f2 -r af063450a8a4 Frameworks/AIUtilities Framework/Source/AIImageButton.m
--- a/Frameworks/AIUtilities Framework/Source/AIImageButton.m	Tue Jan 24 21:20:40 2012 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AIImageButton.m	Tue Jan 24 22:24:42 2012 +0200
@@ -114,7 +114,7 @@
 			point.x = maxXOrigin;
 		}
 
-		imageFloater = [[AIFloater floaterWithImage:bigImage styleMask:NSBorderlessWindowMask] retain];
+		imageFloater = [[AIFloater newFloaterWithImage:bigImage styleMask:NSBorderlessWindowMask] retain];
 		[imageFloater setMaxOpacity:1.0f];
 		[imageFloater moveFloaterToPoint:point];
 		[imageFloater setVisible:YES animate:NO];




More information about the commits mailing list