<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -18,7 +18,7 @@
 				&lt;string&gt;application/rtf&lt;/string&gt;
 			&lt;/array&gt;
 			&lt;key&gt;CFBundleTypeName&lt;/key&gt;
-			&lt;string&gt;NSRTFPboardType&lt;/string&gt;
+			&lt;string&gt;RTFDocument&lt;/string&gt;
 			&lt;key&gt;CFBundleTypeOSTypes&lt;/key&gt;
 			&lt;array&gt;
 				&lt;string&gt;RTF &lt;/string&gt;</diff>
      <filename>Info.plist</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 #import &quot;NeoDocument.h&quot;
 #import &quot;NeoTextView.h&quot;
 
+static NSString *const kNeoRTFDocumentType = @&quot;RTFDocument&quot;;
+
 @implementation NeoDocument
 
 - (NSString *) windowNibName {
@@ -13,28 +15,40 @@
   if (_contents != nil) {
     [_textView insertText: _contents];
     [_textView invalidateLayout];
+    [_contents release];
+    _contents = nil;
   }
 }
 
 - (NSData *) dataOfType: (NSString *) typeName error: (NSError **) outError {
-  NSAttributedString *contents = [_textView attributedString];
-	NSData *data = [contents RTFFromRange:NSMakeRange(0, [contents length])
-                     documentAttributes:nil];
+  NSData *data = nil;
+
+  if ([kNeoRTFDocumentType isEqualToString:typeName]) {
+    NSAttributedString *contents = [_textView attributedString];
+    data = [contents RTFFromRange:NSMakeRange(0, [contents length])
+               documentAttributes:nil];
+  }
+
   return data;
 }
 
 - (BOOL) readFromData: (NSData *) data ofType: (NSString *) typeName error: (NSError **) outError {
-  NSAttributedString *contents =
-    [[NSAttributedString alloc] initWithData:data
-                                     options:[NSDictionary dictionaryWithObjectsAndKeys:
-                                                NSDocumentTypeDocumentOption, NSRTFTextDocumentType,
-                                                nil]
-                          documentAttributes:NULL
-                                       error:outError];
-  [_contents release];
-  _contents = contents;
-
-  return contents != nil;
+  if ([kNeoRTFDocumentType isEqualToString:typeName]) {
+    NSAttributedString *contents =
+      [[NSAttributedString alloc] initWithData:data
+                                       options:[NSDictionary dictionaryWithObjectsAndKeys:
+                                                  NSDocumentTypeDocumentOption, NSRTFTextDocumentType,
+                                                  nil]
+                            documentAttributes:NULL
+                                         error:outError];
+    if (contents != nil) {
+      [_contents release];
+      _contents = contents;
+      return YES;
+    }
+  }
+
+  return NO;
 }
 
 @end</diff>
      <filename>src/NeoDocument.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6b2ca0a89622cb6e719a74b6782fac4e1e7fe442</id>
    </parent>
  </parents>
  <author>
    <name>Takanori Ishikawa</name>
    <email>takanori.ishikawa@gmail.com</email>
  </author>
  <url>http://github.com/ishikawa/neuro/commit/8d672182774c8f5815b266323cb66f4d2aac7943</url>
  <id>8d672182774c8f5815b266323cb66f4d2aac7943</id>
  <committed-date>2009-08-01T06:16:07-07:00</committed-date>
  <authored-date>2009-08-01T06:16:07-07:00</authored-date>
  <message>Added document type check</message>
  <tree>64870ef21022089296bfc7e5374007ffb9c97e62</tree>
  <committer>
    <name>Takanori Ishikawa</name>
    <email>takanori.ishikawa@gmail.com</email>
  </committer>
</commit>
