My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes  
Changes to /trunk/Examples/BloggerSample/BloggerSampleWindowController.m
r396 vs. r650 Compare: vs.  Format:
Revision r650
Go to: 
Project members, sign in to write a code review
/trunk/Examples/BloggerSample/BloggerSampleWindowController.m   r396 /trunk/Examples/BloggerSample/BloggerSampleWindowController.m   r650
1 /* Copyright (c) 2009 Google Inc. 1 /* Copyright (c) 2009 Google Inc.
2 * 2 *
3 * Licensed under the Apache License, Version 2.0 (the "License"); 3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. 4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at 5 * You may obtain a copy of the License at
6 * 6 *
7 * http://www.apache.org/licenses/LICENSE-2.0 7 * http://www.apache.org/licenses/LICENSE-2.0
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software 9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS, 10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and 12 * See the License for the specific language governing permissions and
13 * limitations under the License. 13 * limitations under the License.
14 */ 14 */
15 15
16 // 16 //
17 // BloggerSampleWindowController.m 17 // BloggerSampleWindowController.m
18 // 18 //
19 19
20 #import "BloggerSampleWindowController.h" 20 #import "BloggerSampleWindowController.h"
21 21
22 @interface BloggerSampleWindowController (PrivateMethods) 22 @interface BloggerSampleWindowController (PrivateMethods)
23 - (void)updateUI; 23 - (void)updateUI;
24 24
25 - (void)fetchAllBlogs; 25 - (void)fetchAllBlogs;
26 - (void)fetchPostsForSelectedBlog; 26 - (void)fetchPostsForSelectedBlog;
27 - (void)addEntry; 27 - (void)addEntry;
28 - (void)updateSelectedPost; 28 - (void)updateSelectedPost;
29 - (void)deleteSelectedPost; 29 - (void)deleteSelectedPost;
30 30
31 - (GDataServiceGoogleBlogger *)bloggerService; 31 - (GDataServiceGoogleBlogger *)bloggerService;
32 - (GDataEntryBlog *)selectedBlog; 32 - (GDataEntryBlog *)selectedBlog;
33 - (GDataEntryBlogPost *)selectedPost; 33 - (GDataEntryBlogPost *)selectedPost;
34 - (GDataEntryBlogComment *)selectedComment; 34 - (GDataEntryBlogComment *)selectedComment;
35 35
36 - (GDataFeedBase *)blogFeed; 36 - (GDataFeedBase *)blogFeed;
37 - (void)setBlogFeed:(GDataFeedBase *)feed; 37 - (void)setBlogFeed:(GDataFeedBase *)feed;
38 - (NSError *)blogFetchError; 38 - (NSError *)blogFetchError;
39 - (void)setBlogFetchError:(NSError *)error; 39 - (void)setBlogFetchError:(NSError *)error;
40 - (GDataServiceTicket *)blogFeedTicket; 40 - (GDataServiceTicket *)blogFeedTicket;
41 - (void)setBlogFeedTicket:(GDataServiceTicket *)ticket; 41 - (void)setBlogFeedTicket:(GDataServiceTicket *)ticket;
42 42
43 - (GDataFeedBase *)postFeed; 43 - (GDataFeedBase *)postFeed;
44 - (void)setPostFeed:(GDataFeedBase *)feed; 44 - (void)setPostFeed:(GDataFeedBase *)feed;
45 - (NSError *)postFetchError; 45 - (NSError *)postFetchError;
46 - (void)setPostFetchError:(NSError *)error; 46 - (void)setPostFetchError:(NSError *)error;
47 - (GDataServiceTicket *)postFeedTicket; 47 - (GDataServiceTicket *)postFeedTicket;
48 - (void)setPostFeedTicket:(GDataServiceTicket *)ticket; 48 - (void)setPostFeedTicket:(GDataServiceTicket *)ticket;
49 49
50 - (GDataServiceTicket *)editPostTicket; 50 - (GDataServiceTicket *)editPostTicket;
51 - (void)setEditPostTicket:(GDataServiceTicket *)ticket; 51 - (void)setEditPostTicket:(GDataServiceTicket *)ticket;
52 52
53 - (GDataFeedBase *)commentFeed; 53 - (GDataFeedBase *)commentFeed;
54 - (void)setCommentFeed:(GDataFeedBase *)feed; 54 - (void)setCommentFeed:(GDataFeedBase *)feed;
55 - (NSError *)commentFetchError; 55 - (NSError *)commentFetchError;
56 - (void)setCommentFetchError:(NSError *)error; 56 - (void)setCommentFetchError:(NSError *)error;
57 - (GDataServiceTicket *)commentFeedTicket; 57 - (GDataServiceTicket *)commentFeedTicket;
58 - (void)setCommentFeedTicket:(GDataServiceTicket *)ticket; 58 - (void)setCommentFeedTicket:(GDataServiceTicket *)ticket;
59 59
60 @end 60 @end
61 61
62 @implementation BloggerSampleWindowController 62 @implementation BloggerSampleWindowController
63 63
64 + (BloggerSampleWindowController *)sharedBloggerSampleWindowController { 64 + (BloggerSampleWindowController *)sharedBloggerSampleWindowController {
65 65
66 static BloggerSampleWindowController* gController = nil; 66 static BloggerSampleWindowController* gController = nil;
67 67
68 if (!gController) { 68 if (!gController) {
69 gController = [[BloggerSampleWindowController alloc] init]; 69 gController = [[BloggerSampleWindowController alloc] init];
70 } 70 }
71 return gController; 71 return gController;
72 } 72 }
73 73
74 74
75 - (id)init { 75 - (id)init {
76 return [self initWithWindowNibName:@"BloggerSampleWindow"]; 76 return [self initWithWindowNibName:@"BloggerSampleWindow"];
77 } 77 }
78 78
79 - (void)awakeFromNib { 79 - (void)awakeFromNib {
80 // Set the result text fields to have a distinctive color and mono-spaced font 80 // Set the result text fields to have a distinctive color and mono-spaced font
81 [mBlogsResultTextField setTextColor:[NSColor darkGrayColor]]; 81 [mBlogsResultTextField setTextColor:[NSColor darkGrayColor]];
82 [mPostsResultTextField setTextColor:[NSColor darkGrayColor]]; 82 [mPostsResultTextField setTextColor:[NSColor darkGrayColor]];
83 [mCommentsResultTextField setTextColor:[NSColor darkGrayColor]]; 83 [mCommentsResultTextField setTextColor:[NSColor darkGrayColor]];
84 84
85 NSFont *resultTextFont = [NSFont fontWithName:@"Monaco" size:9]; 85 NSFont *resultTextFont = [NSFont fontWithName:@"Monaco" size:9];
86 [mBlogsResultTextField setFont:resultTextFont]; 86 [mBlogsResultTextField setFont:resultTextFont];
87 [mPostsResultTextField setFont:resultTextFont]; 87 [mPostsResultTextField setFont:resultTextFont];
88 [mCommentsResultTextField setFont:resultTextFont]; 88 [mCommentsResultTextField setFont:resultTextFont];
89 89
90 [self updateUI]; 90 [self updateUI];
91 } 91 }
92 92
93 - (void)dealloc { 93 - (void)dealloc {
94 [mBlogFeed release]; 94 [mBlogFeed release];
95 [mBlogFeedTicket release]; 95 [mBlogFeedTicket release];
96 [mBlogFetchError release]; 96 [mBlogFetchError release];
97 97
98 [mPostFeed release]; 98 [mPostFeed release];
99 [mPostFeedTicket release]; 99 [mPostFeedTicket release];
100 [mPostFetchError release]; 100 [mPostFetchError release];
101 101
102 [mEditPostTicket release]; 102 [mEditPostTicket release];
103 103
104 [mCommentFeed release]; 104 [mCommentFeed release];
105 [mCommentFeedTicket release]; 105 [mCommentFeedTicket release];
106 [mCommentFetchError release]; 106 [mCommentFetchError release];
107 107
108 [super dealloc]; 108 [super dealloc];
109 } 109 }
110 110
111 #pragma mark - 111 #pragma mark -
112 112
113 - (void)updateUI { 113 - (void)updateUI {
114 114
115 // blogs list display 115 // blogs list display
116 [mBlogsTable reloadData]; 116 [mBlogsTable reloadData];
117 117
118 if (mBlogFeedTicket != nil) { 118 if (mBlogFeedTicket != nil) {
119 [mBlogsProgressIndicator startAnimation:self]; 119 [mBlogsProgressIndicator startAnimation:self];
120 } else { 120 } else {
121 [mBlogsProgressIndicator stopAnimation:self]; 121 [mBlogsProgressIndicator stopAnimation:self];
122 } 122 }
123 123
124 // blogs fetch result or selected item 124 // blogs fetch result or selected item
125 NSString *blogsResultStr = @""; 125 NSString *blogsResultStr = @"";
126 if (mBlogFetchError) { 126 if (mBlogFetchError) {
127 blogsResultStr = [mBlogFetchError description]; 127 blogsResultStr = [mBlogFetchError description];
128 } else { 128 } else {
129 GDataEntryBlog *blog = [self selectedBlog]; 129 GDataEntryBlog *blog = [self selectedBlog];
130 if (blog) { 130 if (blog) {
131 blogsResultStr = [blog description]; 131 blogsResultStr = [blog description];
132 } 132 }
133 } 133 }
134 [mBlogsResultTextField setString:blogsResultStr]; 134 [mBlogsResultTextField setString:blogsResultStr];
135 135
136 // post list display 136 // post list display
137 [mPostsTable reloadData]; 137 [mPostsTable reloadData];
138 138
139 if (mPostFeedTicket != nil) { 139 if (mPostFeedTicket != nil) {
140 [mPostsProgressIndicator startAnimation:self]; 140 [mPostsProgressIndicator startAnimation:self];
141 } else { 141 } else {
142 [mPostsProgressIndicator stopAnimation:self]; 142 [mPostsProgressIndicator stopAnimation:self];
143 } 143 }
144 144
145 // post fetch result or selected item 145 // post fetch result or selected item
146 NSString *postResultStr = @""; 146 NSString *postResultStr = @"";
147 if (mPostFetchError) { 147 if (mPostFetchError) {
148 postResultStr = [mPostFetchError description]; 148 postResultStr = [mPostFetchError description];
149 } else { 149 } else {
150 if ([self selectedPost] != nil) { 150 if ([self selectedPost] != nil) {
151 postResultStr = [[self selectedPost] description]; 151 postResultStr = [[self selectedPost] description];
152 } 152 }
153 } 153 }
154 [mPostsResultTextField setString:postResultStr]; 154 [mPostsResultTextField setString:postResultStr];
155 155
156 // enable/disable edit buttons 156 // enable/disable edit buttons
157 BOOL isBlogSelected = ([self selectedBlog] != nil); 157 BOOL isBlogSelected = ([self selectedBlog] != nil);
158 [mAddPostButton setEnabled:isBlogSelected]; 158 [mAddPostButton setEnabled:isBlogSelected];
159 159
160 BOOL isPostSelected = ([self selectedPost] != nil); 160 BOOL isPostSelected = ([self selectedPost] != nil);
161 [mDeletePostButton setEnabled:isPostSelected]; 161 [mDeletePostButton setEnabled:isPostSelected];
162 [mPostDraftCheckBox setEnabled:isPostSelected]; 162 [mPostDraftCheckBox setEnabled:isPostSelected];
163 163
164 BOOL canUpdatePost = NO; 164 BOOL canUpdatePost = NO;
165 165
166 if (isPostSelected) { 166 if (isPostSelected) {
167 // the post can be updated if either the text or the draft checkbox state 167 // the post can be updated if either the text or the draft checkbox state
168 // has changed 168 // has changed
169 NSString *postStr = [[[self selectedPost] content] stringValue]; 169 NSString *postStr = [[[self selectedPost] content] stringValue];
170 NSString *editedStr = [mPostEditField stringValue]; 170 NSString *editedStr = [mPostEditField stringValue];
171 171
172 BOOL isPostDraft = [[[self selectedPost] atomPubControl] isDraft]; 172 BOOL isPostDraft = [[[self selectedPost] atomPubControl] isDraft];
173 BOOL isEditedDraft = ([mPostDraftCheckBox state] == NSOnState); 173 BOOL isEditedDraft = ([mPostDraftCheckBox state] == NSOnState);
174 174
175 canUpdatePost = ![postStr isEqual:editedStr] 175 canUpdatePost = ![postStr isEqual:editedStr]
176 || (isPostDraft != isEditedDraft); 176 || (isPostDraft != isEditedDraft);
177 } 177 }
178 [mUpdatePostButton setEnabled:canUpdatePost]; 178 [mUpdatePostButton setEnabled:canUpdatePost];
179 179
180 if (mEditPostTicket != nil) { 180 if (mEditPostTicket != nil) {
181 [mEditProgressIndicator startAnimation:self]; 181 [mEditProgressIndicator startAnimation:self];
182 } else { 182 } else {
183 [mEditProgressIndicator stopAnimation:self]; 183 [mEditProgressIndicator stopAnimation:self];
184 } 184 }
185 185
186 // comment list display 186 // comment list display
187 [mCommentsTable reloadData]; 187 [mCommentsTable reloadData];
188 188
189 if (mCommentFeedTicket != nil) { 189 if (mCommentFeedTicket != nil) {
190 [mCommentsProgressIndicator startAnimation:self]; 190 [mCommentsProgressIndicator startAnimation:self];
191 } else { 191 } else {
192 [mCommentsProgressIndicator stopAnimation:self]; 192 [mCommentsProgressIndicator stopAnimation:self];
193 } 193 }
194 194
195 // comment fetch result or selected item 195 // comment fetch result or selected item
196 NSString *commentResultStr = @""; 196 NSString *commentResultStr = @"";
197 if (mCommentFetchError) { 197 if (mCommentFetchError) {
198 commentResultStr = [mCommentFetchError description]; 198 commentResultStr = [mCommentFetchError description];
199 } else { 199 } else {
200 if ([self selectedComment] != nil) { 200 if ([self selectedComment] != nil) {
201 commentResultStr = [[self selectedComment] description]; 201 commentResultStr = [[self selectedComment] description];
202 } 202 }
203 } 203 }
204 [mCommentsResultTextField setString:commentResultStr]; 204 [mCommentsResultTextField setString:commentResultStr];
205 } 205 }
206 206
207 - (void)reloadEntryEditField { 207 - (void)reloadEntryEditField {
208 GDataEntryBlogPost *entry = [self selectedPost]; 208 GDataEntryBlogPost *entry = [self selectedPost];
209 if (entry) { 209 if (entry) {
210 [mPostEditField setStringValue:[[entry content] stringValue]]; 210 [mPostEditField setStringValue:[[entry content] stringValue]];
211 211
212 BOOL isDraft = [[entry atomPubControl] isDraft]; 212 BOOL isDraft = [[entry atomPubControl] isDraft];
213 [mPostDraftCheckBox setState:(isDraft ? NSOnState : NSOffState)]; 213 [mPostDraftCheckBox setState:(isDraft ? NSOnState : NSOffState)];
214 } 214 }
215 } 215 }
216 216
217 #pragma mark IBActions 217 #pragma mark IBActions
218 - (IBAction)getBlogsClicked:(id)sender { 218 - (IBAction)getBlogsClicked:(id)sender {
219 219
220 NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 220 NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
221 221
222 NSString *username = [mUsernameField stringValue]; 222 NSString *username = [mUsernameField stringValue];
223 username = [username stringByTrimmingCharactersInSet:whitespace]; 223 username = [username stringByTrimmingCharactersInSet:whitespace];
224 224
225 if ([username rangeOfString:@"@"].location == NSNotFound) { 225 if ([username rangeOfString:@"@"].location == NSNotFound) {
226 // if no domain was supplied, add @gmail.com 226 // if no domain was supplied, add @gmail.com
227 username = [username stringByAppendingString:@"@gmail.com"]; 227 username = [username stringByAppendingString:@"@gmail.com"];
228 } 228 }
229 229
230 [mUsernameField setStringValue:username]; 230 [mUsernameField setStringValue:username];
231 231
232 [self fetchAllBlogs]; 232 [self fetchAllBlogs];
233 } 233 }
234 234
235 - (IBAction)addPostClicked:(id)sender { 235 - (IBAction)addPostClicked:(id)sender {
236 [self addEntry]; 236 [self addEntry];
237 } 237 }
238 238
239 - (IBAction)updatePostClicked:(id)sender { 239 - (IBAction)updatePostClicked:(id)sender {
240 [self updateSelectedPost]; 240 [self updateSelectedPost];
241 } 241 }
242 242
243 - (IBAction)deletePostClicked:(id)sender { 243 - (IBAction)deletePostClicked:(id)sender {
244 [self deleteSelectedPost]; 244 [self deleteSelectedPost];
245 } 245 }
246 246
247 - (IBAction)draftCheckboxClicked:(id)sender { 247 - (IBAction)draftCheckboxClicked:(id)sender {
248 [self updateUI]; 248 [self updateUI];
249 } 249 }
250 250
251 - (IBAction)loggingCheckboxClicked:(id)sender { 251 - (IBAction)loggingCheckboxClicked:(id)sender {
252 [GDataHTTPFetcher setIsLoggingEnabled:[sender state]]; 252 [GTMHTTPFetcher setLoggingEnabled:[sender state]];
253 } 253 }
254 254
255 #pragma mark - 255 #pragma mark -
256 256
257 // get a google service object with the current username/password 257 // get a google service object with the current username/password
258 // 258 //
259 // A "service" object handles networking tasks. Service objects 259 // A "service" object handles networking tasks. Service objects
260 // contain user authentication information as well as networking 260 // contain user authentication information as well as networking
261 // state information (such as cookies and the "last modified" date for 261 // state information (such as cookies and the "last modified" date for
262 // fetched data.) 262 // fetched data.)
263 263
264 - (GDataServiceGoogleBlogger *)bloggerService { 264 - (GDataServiceGoogleBlogger *)bloggerService {
265 265
266 static GDataServiceGoogleBlogger* service = nil; 266 static GDataServiceGoogleBlogger* service = nil;
267 267
268 if (!service) { 268 if (!service) {
269 service = [[GDataServiceGoogleBlogger alloc] init]; 269 service = [[GDataServiceGoogleBlogger alloc] init];
270 270
271 [service setShouldCacheDatedData:YES]; 271 [service setShouldCacheResponseData:YES];
272 [service setServiceShouldFollowNextLinks:YES]; 272 [service setServiceShouldFollowNextLinks:YES];
273 } 273 }
274 274
275 // update the name/password each time the service is requested 275 // update the name/password each time the service is requested
276 NSString *username = [mUsernameField stringValue]; 276 NSString *username = [mUsernameField stringValue];
277 NSString *password = [mPasswordField stringValue]; 277 NSString *password = [mPasswordField stringValue];
278 278
279 [service setUserCredentialsWithUsername:username 279 [service setUserCredentialsWithUsername:username
280 password:password]; 280 password:password];
281 281
282 return service; 282 return service;
283 } 283 }
284 284
285 // get the blog selected in the top list, or nil if none 285 // get the blog selected in the top list, or nil if none
286 - (GDataEntryBlog *)selectedBlog { 286 - (GDataEntryBlog *)selectedBlog {
287 287
288 NSArray *blogs = [mBlogFeed entries]; 288 NSArray *blogs = [mBlogFeed entries];
289 int rowIndex = [mBlogsTable selectedRow]; 289 int rowIndex = [mBlogsTable selectedRow];
290 if ([blogs count] > 0 && rowIndex > -1) { 290 if ([blogs count] > 0 && rowIndex > -1) {
291 291
292 GDataEntryBlog *blog = [blogs objectAtIndex:rowIndex]; 292 GDataEntryBlog *blog = [blogs objectAtIndex:rowIndex];
293 return blog; 293 return blog;
294 } 294 }
295 return nil; 295 return nil;
296 } 296 }
297 297
298 // get the entry selected in the bottom list, or nil if none 298 // get the entry selected in the bottom list, or nil if none
299 - (GDataEntryBlogPost *)selectedPost { 299 - (GDataEntryBlogPost *)selectedPost {
300 300
301 NSArray *entries = [mPostFeed entries]; 301 NSArray *entries = [mPostFeed entries];
302 int rowIndex = [mPostsTable selectedRow]; 302 int rowIndex = [mPostsTable selectedRow];
303 if ([entries count] > 0 && rowIndex > -1) { 303 if ([entries count] > 0 && rowIndex > -1) {
304 304
305 GDataEntryBlogPost *entry = [entries objectAtIndex:rowIndex]; 305 GDataEntryBlogPost *entry = [entries objectAtIndex:rowIndex];
306 return entry; 306 return entry;
307 } 307 }
308 return nil; 308 return nil;
309 } 309 }
310 310
311 // get the entry selected in the bottom list, or nil if none 311 // get the entry selected in the bottom list, or nil if none
312 - (GDataEntryBlogComment *)selectedComment { 312 - (GDataEntryBlogComment *)selectedComment {
313 313
314 NSArray *entries = [mCommentFeed entries]; 314 NSArray *entries = [mCommentFeed entries];
315 int rowIndex = [mCommentsTable selectedRow]; 315 int rowIndex = [mCommentsTable selectedRow];
316 if ([entries count] > 0 && rowIndex > -1) { 316 if ([entries count] > 0 && rowIndex > -1) {
317 317
318 GDataEntryBlogComment *entry = [entries objectAtIndex:rowIndex]; 318 GDataEntryBlogComment *entry = [entries objectAtIndex:rowIndex];
319 return entry; 319 return entry;
320 } 320 }
321 return nil; 321 return nil;
322 } 322 }
323 323
324 #pragma mark Fetch all blogs 324 #pragma mark Fetch all blogs
325 325
326 // begin retrieving the list of the user's blogs 326 // begin retrieving the list of the user's blogs
327 - (void)fetchAllBlogs { 327 - (void)fetchAllBlogs {
328 328
329 [self setBlogFeed:nil]; 329 [self setBlogFeed:nil];
330 [self setBlogFetchError:nil]; 330 [self setBlogFetchError:nil];
331 331
332 [self setPostFeed:nil]; 332 [self setPostFeed:nil];
333 [self setPostFetchError:nil]; 333 [self setPostFetchError:nil];
334 334
335 [self setCommentFeed:nil]; 335 [self setCommentFeed:nil];
336 [self setCommentFetchError:nil]; 336 [self setCommentFetchError:nil];
337 337
338 NSURL* feedURL = [GDataServiceGoogleBlogger blogFeedURLForUserID:kGDataServiceDefaultUser]; 338 NSURL* feedURL = [GDataServiceGoogleBlogger blogFeedURLForUserID:kGDataServiceDefaultUser];
339 339
340 GDataServiceGoogleBlogger *service = [self bloggerService]; 340 GDataServiceGoogleBlogger *service = [self bloggerService];
341 GDataServiceTicket *ticket; 341 GDataServiceTicket *ticket;
342 342
343 ticket = [service fetchFeedWithURL:feedURL 343 ticket = [service fetchFeedWithURL:feedURL
344 feedClass:[GDataFeedBlog class] 344 feedClass:[GDataFeedBlog class]
345 delegate:self 345 delegate:self
346 didFinishSelector:@selector(blogListTicket:finishedWithFeed:error:)]; 346 didFinishSelector:@selector(blogListTicket:finishedWithFeed:error:)];
347 [self setBlogFeedTicket:ticket]; 347 [self setBlogFeedTicket:ticket];
348 348
349 [self updateUI]; 349 [self updateUI];
350 } 350 }
351 351
352 // blog feed fetch callback 352 // blog feed fetch callback
353 - (void)blogListTicket:(GDataServiceTicket *)ticket 353 - (void)blogListTicket:(GDataServiceTicket *)ticket
354 finishedWithFeed:(GDataFeedBase *)feed 354 finishedWithFeed:(GDataFeedBase *)feed
355 error:(NSError *)error { 355 error:(NSError *)error {
356 356
357 [self setBlogFeed:feed]; 357 [self setBlogFeed:feed];
358 [self setBlogFetchError:error]; 358 [self setBlogFetchError:error];
359 [self setBlogFeedTicket:nil]; 359 [self setBlogFeedTicket:nil];
360 360
361 [self updateUI]; 361 [self updateUI];
362 } 362 }
363 363
364 #pragma mark Fetch a blog's posts 364 #pragma mark Fetch a blog's posts
365 365
366 // for the blog selected in the top list, begin retrieving the list of 366 // for the blog selected in the top list, begin retrieving the list of
367 // entries 367 // entries
368 - (void)fetchPostsForSelectedBlog { 368 - (void)fetchPostsForSelectedBlog {
369 369
370 GDataEntryBlog *blog = [self selectedBlog]; 370 GDataEntryBlog *blog = [self selectedBlog];
371 if (blog != nil) { 371 if (blog != nil) {
372 372
373 [self setPostFeed:nil]; 373 [self setPostFeed:nil];
374 [self setPostFetchError:nil]; 374 [self setPostFetchError:nil];
375 375
376 [self setCommentFeed:nil]; 376 [self setCommentFeed:nil];
377 [self setCommentFetchError:nil]; 377 [self setCommentFetchError:nil];
378 378
379 NSURL *feedURL = [[blog feedLink] URL]; 379 NSURL *feedURL = [[blog feedLink] URL];
380 380
381 GDataServiceGoogleBlogger *service = [self bloggerService]; 381 GDataServiceGoogleBlogger *service = [self bloggerService];
382 GDataServiceTicket *ticket; 382 GDataServiceTicket *ticket;
383 ticket = [service fetchFeedWithURL:feedURL 383 ticket = [service fetchFeedWithURL:feedURL
384 feedClass:[GDataFeedBlogPost class] 384 feedClass:[GDataFeedBlogPost class]
385 delegate:self 385 delegate:self
386 didFinishSelector:@selector(blogPostTicket:finishedWithFeed:error:)]; 386 didFinishSelector:@selector(blogPostTicket:finishedWithFeed:error:)];
387 [self setPostFeedTicket:ticket]; 387 [self setPostFeedTicket:ticket];
388 [self updateUI]; 388 [self updateUI];
389 } 389 }
390 } 390 }
391 391
392 // post feed fetch callback 392 // post feed fetch callback
393 - (void)blogPostTicket:(GDataServiceTicket *)ticket 393 - (void)blogPostTicket:(GDataServiceTicket *)ticket
394 finishedWithFeed:(GDataFeedBase *)feed 394 finishedWithFeed:(GDataFeedBase *)feed
395 error:(NSError *)error { 395 error:(NSError *)error {
396 396
397 [self setPostFeed:feed]; 397 [self setPostFeed:feed];
398 [self setPostFetchError:error]; 398 [self setPostFetchError:error];
399 [self setPostFeedTicket:nil]; 399 [self setPostFeedTicket:nil];
400 400
401 [self updateUI]; 401 [self updateUI];
402 } 402 }
403 403
404 #pragma mark Fetch a blog post's comments 404 #pragma mark Fetch a blog post's comments
405 405
406 // for the post selected in the middle list, begin retrieving the feed of 406 // for the post selected in the middle list, begin retrieving the feed of
407 // comments 407 // comments
408 - (void)fetchCommentsForSelectedPost { 408 - (void)fetchCommentsForSelectedPost {
409 409
410 GDataEntryBlogPost *post = [self selectedPost]; 410 GDataEntryBlogPost *post = [self selectedPost];
411 if (post != nil) { 411 if (post != nil) {
412 412
413 [self setCommentFeed:nil]; 413 [self setCommentFeed:nil];
414 [self setCommentFetchError:nil]; 414 [self setCommentFetchError:nil];
415 415
416 NSURL *feedURL = [[post repliesAtomLink] URL]; 416 NSURL *feedURL = [[post repliesAtomLink] URL];
417 if (feedURL != nil) { 417 if (feedURL != nil) {
418 GDataServiceGoogleBlogger *service = [self bloggerService]; 418 GDataServiceGoogleBlogger *service = [self bloggerService];
419 GDataServiceTicket *ticket; 419 GDataServiceTicket *ticket;
420 ticket = [service fetchFeedWithURL:feedURL 420 ticket = [service fetchFeedWithURL:feedURL
421 feedClass:[GDataFeedBlogComment class] 421 feedClass:[GDataFeedBlogComment class]
422 delegate:self 422 delegate:self
423 didFinishSelector:@selector(blogCommentTicket:finishedWithFeed:error:)]; 423 didFinishSelector:@selector(blogCommentTicket:finishedWithFeed:error:)];
424 [self setCommentFeedTicket:ticket]; 424 [self setCommentFeedTicket:ticket];
425 } 425 }
426 } 426 }
427 [self updateUI]; 427 [self updateUI];
428 } 428 }
429 429
430 // fetched comment feed callback 430 // fetched comment feed callback
431 - (void)blogCommentTicket:(GDataServiceTicket *)ticket 431 - (void)blogCommentTicket:(GDataServiceTicket *)ticket
432 finishedWithFeed:(GDataFeedBase *)feed 432 finishedWithFeed:(GDataFeedBase *)feed
433 error:(NSError *)error { 433 error:(NSError *)error {
434 434
435 [self setCommentFeed:feed]; 435 [self setCommentFeed:feed];
436 [self setCommentFetchError:error]; 436 [self setCommentFetchError:error];
437 [self setCommentFeedTicket:nil]; 437 [self setCommentFeedTicket:nil];
438 438
439 [self updateUI]; 439 [self updateUI];
440 } 440 }
441 441
442 #pragma mark Add an entry 442 #pragma mark Add an entry
443 443
444 - (void)addEntry { 444 - (void)addEntry {
445 GDataEntryBlogPost *newEntry = [GDataEntryBlogPost postEntry]; 445 GDataEntryBlogPost *newEntry = [GDataEntryBlogPost postEntry];
446 446
447 NSString *title = [NSString stringWithFormat:@"Post Created %@", 447 NSString *title = [NSString stringWithFormat:@"Post Created %@",
448 [NSDate date]]; 448 [NSDate date]];
449 NSString *content = [mPostEditField stringValue]; 449 NSString *content = [mPostEditField stringValue];
450 BOOL isDraft = [mPostDraftCheckBox state]; 450 BOOL isDraft = [mPostDraftCheckBox state];
451 451
452 [newEntry setTitleWithString:title]; 452 [newEntry setTitleWithString:title];
453 [newEntry setContentWithString:content]; 453 [newEntry setContentWithString:content];
454 [newEntry addAuthor:[GDataPerson personWithName:@"Blogger Sample App" 454 [newEntry addAuthor:[GDataPerson personWithName:@"Blogger Sample App"
455 email:nil]]; 455 email:nil]];
456 GDataAtomPubControl *atomPub; 456 GDataAtomPubControl *atomPub;
457 atomPub = [GDataAtomPubControl atomPubControlWithIsDraft:isDraft]; 457 atomPub = [GDataAtomPubControl atomPubControlWithIsDraft:isDraft];
458 [newEntry setAtomPubControl:atomPub]; 458 [newEntry setAtomPubControl:atomPub];
459 459
460 NSURL *postURL = [[[self selectedBlog] postLink] URL]; 460 NSURL *postURL = [[[self selectedBlog] postLink] URL];
461 if (postURL != nil) { 461 if (postURL != nil) {
462 GDataServiceGoogleBlogger *service = [self bloggerService]; 462 GDataServiceGoogleBlogger *service = [self bloggerService];
463 [service setServiceUserData:newEntry]; 463 [service setServiceUserData:newEntry];
464 464
465 GDataServiceTicket *ticket; 465 GDataServiceTicket *ticket;
466 ticket = [service fetchEntryByInsertingEntry:newEntry 466 ticket = [service fetchEntryByInsertingEntry:newEntry
467 forFeedURL:postURL 467 forFeedURL:postURL
468 delegate:self 468 delegate:self
469 didFinishSelector:@selector(addEntryTicket:finishedWithEntry:error:)]; 469 didFinishSelector:@selector(addEntryTicket:finishedWithEntry:error:)];
470 [self setEditPostTicket:ticket]; 470 [self setEditPostTicket:ticket];
471 [self updateUI]; 471 [self updateUI];
472 } 472 }
473 } 473 }
474 474
475 // add entry callback 475 // add entry callback
476 - (void)addEntryTicket:(GDataServiceTicket *)ticket 476 - (void)addEntryTicket:(GDataServiceTicket *)ticket
477 finishedWithEntry:(GDataEntryBlogPost *)addedEntry 477 finishedWithEntry:(GDataEntryBlogPost *)addedEntry
478 error:(NSError *)error { 478 error:(NSError *)error {
479 479
480 if (error == nil) { 480 if (error == nil) {
481 NSBeginAlertSheet(@"Add", nil, nil, nil, 481 NSBeginAlertSheet(@"Add", nil, nil, nil,
482 [self window], nil, nil, 482 [self window], nil, nil,
483 nil, nil, @"Added entry: %@", [[addedEntry title] stringValue]); 483 nil, nil, @"Added entry: %@", [[addedEntry title] stringValue]);
484 484
485 NSMutableArray *entries = [NSMutableArray arrayWithArray:[mPostFeed entries]]; 485 NSMutableArray *entries = [NSMutableArray arrayWithArray:[mPostFeed entries]];
486 [entries insertObject:addedEntry atIndex:0]; 486 [entries insertObject:addedEntry atIndex:0];
487 [mPostFeed setEntries:entries]; 487 [mPostFeed setEntries:entries];
488 } else { 488 } else {
489 // failed to add entry 489 // failed to add entry
490 GDataEntryBlogPost *addedEntry = [ticket postedObject]; 490 GDataEntryBlogPost *addedEntry = [ticket postedObject];
491 NSBeginAlertSheet(@"Add", nil, nil, nil, 491 NSBeginAlertSheet(@"Add", nil, nil, nil,
492 [self window], nil, nil, 492 [self window], nil, nil,
493 nil, nil, @"Failed to add entry: %@\nError: %@", 493 nil, nil, @"Failed to add entry: %@\nError: %@",
494 [[addedEntry title] stringValue], error); 494 [[addedEntry title] stringValue], error);
495 } 495 }
496 496
497 [self setEditPostTicket:nil]; 497 [self setEditPostTicket:nil];
498 [self updateUI]; 498 [self updateUI];
499 } 499 }
500 500
501 501
502 #pragma mark Update an entry 502 #pragma mark Update an entry
503 503
504 504
505 - (void)updateSelectedPost { 505 - (void)updateSelectedPost {
506 GDataEntryBlogPost *editedEntry = [[[self selectedPost] copy] autorelease]; 506 GDataEntryBlogPost *editedEntry = [[[self selectedPost] copy] autorelease];
507 if (editedEntry) { 507 if (editedEntry) {
508 508
509 // save the edited text into the entry 509 // save the edited text into the entry
510 [[editedEntry content] setStringValue:[mPostEditField stringValue]]; 510 [[editedEntry content] setStringValue:[mPostEditField stringValue]];
511 511
512 BOOL isDraft = ([mPostDraftCheckBox state] == NSOnState); 512 BOOL isDraft = ([mPostDraftCheckBox state] == NSOnState);
513 513
514 GDataAtomPubControl *atomPub = [editedEntry atomPubControl]; 514 GDataAtomPubControl *atomPub = [editedEntry atomPubControl];
515 if (atomPub == nil) { 515 if (atomPub == nil) {
516 atomPub = [GDataAtomPubControl atomPubControl]; 516 atomPub = [GDataAtomPubControl atomPubControl];
517 [editedEntry setAtomPubControl:atomPub]; 517 [editedEntry setAtomPubControl:atomPub];
518 } 518 }
519 [atomPub setIsDraft:isDraft]; 519 [atomPub setIsDraft:isDraft];
520 520
521 // send the edited entry to the server 521 // send the edited entry to the server
522 GDataServiceGoogleBlogger *service = [self bloggerService]; 522 GDataServiceGoogleBlogger *service = [self bloggerService];
523 523
524 // remember the old entry; we'll replace the edited one with it later 524 // remember the old entry; we'll replace the edited one with it later
525 [service setServiceUserData:[self selectedPost]]; 525 [service setServiceUserData:[self selectedPost]];
526 526
527 GDataServiceTicket *ticket; 527 GDataServiceTicket *ticket;
528 ticket = [service fetchEntryByUpdatingEntry:editedEntry 528 ticket = [service fetchEntryByUpdatingEntry:editedEntry
529 delegate:self 529 delegate:self
530 didFinishSelector:@selector(updateTicket:finishedWithEntry:error:)]; 530 didFinishSelector:@selector(updateTicket:finishedWithEntry:error:)];
531 [self setEditPostTicket:ticket]; 531 [self setEditPostTicket:ticket];
532 [self updateUI]; 532 [self updateUI];
533 } 533 }
534 } 534 }
535 535
536 // update entry callback 536 // update entry callback
537 - (void)updateTicket:(GDataServiceTicket *)ticket 537 - (void)updateTicket:(GDataServiceTicket *)ticket
538 finishedWithEntry:(GDataEntryBlogPost *)editedEntry 538 finishedWithEntry:(GDataEntryBlogPost *)editedEntry
539 error:(NSError *)error { 539 error:(NSError *)error {
540 if (error == nil) { 540 if (error == nil) {
541 NSBeginAlertSheet(@"Update", nil, nil, nil, 541 NSBeginAlertSheet(@"Update", nil, nil, nil,
542 [self window], nil, nil, 542 [self window], nil, nil,
543 nil, nil, @"Updated entry: %@", 543 nil, nil, @"Updated entry: %@",
544 [[editedEntry title] stringValue]); 544 [[editedEntry title] stringValue]);
545 545
546 GDataEntryBlogPost *oldEntry = [ticket userData]; 546 GDataEntryBlogPost *oldEntry = [ticket userData];
547 NSMutableArray *entries = [NSMutableArray arrayWithArray:[mPostFeed entries]]; 547 NSMutableArray *entries = [NSMutableArray arrayWithArray:[mPostFeed entries]];
548 unsigned int indexOfOldEntry = [entries indexOfObject:oldEntry]; 548 unsigned int indexOfOldEntry = [entries indexOfObject:oldEntry];
549 if (indexOfOldEntry != NSNotFound) { 549 if (indexOfOldEntry != NSNotFound) {
550 [entries replaceObjectAtIndex:indexOfOldEntry withObject:editedEntry]; 550 [entries replaceObjectAtIndex:indexOfOldEntry withObject:editedEntry];
551 [mPostFeed setEntries:entries]; 551 [mPostFeed setEntries:entries];
552 } 552 }
553 } else { 553 } else {
554 // update failed 554 // update failed
555 GDataEntryBlogPost *editedEntry = [ticket userData]; 555 GDataEntryBlogPost *editedEntry = [ticket userData];
556 NSBeginAlertSheet(@"Update", nil, nil, nil, 556 NSBeginAlertSheet(@"Update", nil, nil, nil,
557 [self window], nil, nil, 557 [self window], nil, nil,
558 nil, nil, @"Failed to update entry: %@\nError: %@", 558 nil, nil, @"Failed to update entry: %@\nError: %@",
559 [[editedEntry title] stringValue], error); 559 [[editedEntry title] stringValue], error);
560 } 560 }
561 561
562 [self setEditPostTicket:nil]; 562 [self setEditPostTicket:nil];
563 [self updateUI]; 563 [self updateUI];
564 } 564 }
565 565
566 #pragma mark Delete an entry 566 #pragma mark Delete an entry
567 567
568 - (void)deleteSelectedPost { 568 - (void)deleteSelectedPost {
569 GDataEntryBlogPost *entry = [self selectedPost]; 569 GDataEntryBlogPost *entry = [self selectedPost];
570 if (entry) { 570 if (entry) {
571 GDataServiceGoogleBlogger *service = [self bloggerService]; 571 GDataServiceGoogleBlogger *service = [self bloggerService];
572 [service setServiceUserData:entry]; // remember which entry we're deleting 572 [service setServiceUserData:entry]; // remember which entry we're deleting
573 573
574 GDataServiceTicket *ticket; 574 GDataServiceTicket *ticket;
575 ticket = [service deleteEntry:entry 575 ticket = [service deleteEntry:entry
576 delegate:self 576 delegate:self
577 didFinishSelector:@selector(deleteTicket:finishedWithNil:error:)]; 577 didFinishSelector:@selector(deleteTicket:finishedWithNil:error:)];
578 578
579 [ticket setUserData:entry]; 579 [ticket setUserData:entry];
580 [self setEditPostTicket:ticket]; 580 [self setEditPostTicket:ticket];
581 [self updateUI]; 581 [self updateUI];
582 } 582 }
583 } 583 }
584 584
585 - (void)deleteTicket:(GDataServiceTicket *)ticket 585 - (void)deleteTicket:(GDataServiceTicket *)ticket
586 finishedWithNil:(id)object 586 finishedWithNil:(id)object
587 error:(NSError *)error { 587 error:(NSError *)error {
588 GDataEntryBlogPost *entry = [ticket userData]; 588 GDataEntryBlogPost *entry = [ticket userData];
589 589
590 if (error == nil) { 590 if (error == nil) {
591 591
592 NSBeginAlertSheet(@"Delete", nil, nil, nil, 592 NSBeginAlertSheet(@"Delete", nil, nil, nil,
593 [self window], nil, nil, 593 [self window], nil, nil,
594 nil, nil, @"Deleted entry: %@", 594 nil, nil, @"Deleted entry: %@",
595 [[entry title] stringValue]); 595 [[entry title] stringValue]);
596 596
597 // remove the deleted entry from the list 597 // remove the deleted entry from the list
598 NSMutableArray *entries = [NSMutableArray arrayWithArray:[mPostFeed entries]]; 598 NSMutableArray *entries = [NSMutableArray arrayWithArray:[mPostFeed entries]];
599 599
600 if ([entries containsObject:entry]) { 600 if ([entries containsObject:entry]) {
601 [entries removeObject:entry]; 601 [entries removeObject:entry];
602 [mPostFeed setEntries:entries]; 602 [mPostFeed setEntries:entries];
603 } 603 }
604 604
605 [self reloadEntryEditField]; 605 [self reloadEntryEditField];
606 606
607 } else { 607 } else {
608 // delete failed 608 // delete failed
609 NSBeginAlertSheet(@"Delete", nil, nil, nil, 609 NSBeginAlertSheet(@"Delete", nil, nil, nil,
610 [self window], nil, nil, 610 [self window], nil, nil,
611 nil, nil, @"Failed to delete entry: %@\nError: %@", 611 nil, nil, @"Failed to delete entry: %@\nError: %@",
612 [[entry title] stringValue], error); 612 [[entry title] stringValue], error);
613 } 613 }
614 614
615 [self setEditPostTicket:nil]; 615 [self setEditPostTicket:nil];
616 [self updateUI]; 616 [self updateUI];
617 } 617 }
618 618
619 #pragma mark Text field delegate methods 619 #pragma mark Text field delegate methods
620 620
621 - (void)controlTextDidChange:(NSNotification *)note { 621 - (void)controlTextDidChange:(NSNotification *)note {
622 if ([note object] == mPostEditField) { 622 if ([note object] == mPostEditField) {
623 623
624 [self updateUI]; // enabled/disable the Update button 624 [self updateUI]; // enabled/disable the Update button
625 } 625 }
626 } 626 }
627 627
628 #pragma mark TableView delegate methods 628 #pragma mark TableView delegate methods
629 // 629 //
630 // table view delegate methods 630 // table view delegate methods
631 // 631 //
632 632
633 - (void)tableViewSelectionDidChange:(NSNotification *)notification { 633 - (void)tableViewSelectionDidChange:(NSNotification *)notification {
634 634
635 id object = [notification object]; 635 id object = [notification object];
636 if (object == mBlogsTable) { 636 if (object == mBlogsTable) {
637 // the user clicked on a blog, so fetch its entries 637 // the user clicked on a blog, so fetch its entries
638 [self fetchPostsForSelectedBlog]; 638 [self fetchPostsForSelectedBlog];
639 } else if (object == mPostsTable) { 639 } else if (object == mPostsTable) {
640 // the user clicked on an blog post; display it below the posts table 640 // the user clicked on an blog post; display it below the posts table
641 [self reloadEntryEditField]; 641 [self reloadEntryEditField];
642 642
643 // fetch the comment list for the selected post 643 // fetch the comment list for the selected post
644 [self fetchCommentsForSelectedPost]; 644 [self fetchCommentsForSelectedPost];
645 } else { 645 } else {
646 // the user clicked on a comment; redisplay the results field 646 // the user clicked on a comment; redisplay the results field
647 [self updateUI]; 647 [self updateUI];
648 } 648 }
649 } 649 }
650 650
651 // table view data source methods 651 // table view data source methods
652 - (GDataFeedBase *)feedForTableView:(NSTableView *)tableView { 652 - (GDataFeedBase *)feedForTableView:(NSTableView *)tableView {
653 GDataFeedBase *feed; 653 GDataFeedBase *feed;
654 if (tableView == mBlogsTable) { 654 if (tableView == mBlogsTable) {
655 feed = mBlogFeed; 655 feed = mBlogFeed;
656 } else if (tableView == mPostsTable) { 656 } else if (tableView == mPostsTable) {
657 feed = mPostFeed; 657 feed = mPostFeed;
658 } else { 658 } else {
659 feed = mCommentFeed; 659 feed = mCommentFeed;
660 } 660 }
661 return feed; 661 return feed;
662 } 662 }
663 663
664 - (int)numberOfRowsInTableView:(NSTableView *)tableView { 664 - (int)numberOfRowsInTableView:(NSTableView *)tableView {
665 return [[[self feedForTableView:tableView] entries] count]; 665 return [[[self feedForTableView:tableView] entries] count];
666 } 666 }
667 667
668 - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { 668 - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row {
669 GDataFeedBase *feed = [self feedForTableView:tableView]; 669 GDataFeedBase *feed = [self feedForTableView:tableView];
670 GDataEntryBase *entry = [feed entryAtIndex:row]; 670 GDataEntryBase *entry = [feed entryAtIndex:row];
671 return [[entry title] stringValue]; 671 return [[entry title] stringValue];
672 } 672 }
673 673
674 #pragma mark Setters and Getters 674 #pragma mark Setters and Getters
675 675
676 - (GDataFeedBase *)blogFeed { 676 - (GDataFeedBase *)blogFeed {
677 return mBlogFeed; 677 return mBlogFeed;
678 } 678 }
679 679
680 - (void)setBlogFeed:(GDataFeedBase *)feed { 680 - (void)setBlogFeed:(GDataFeedBase *)feed {
681 [mBlogFeed autorelease]; 681 [mBlogFeed autorelease];
682 mBlogFeed = [feed retain]; 682 mBlogFeed = [feed retain];
683 } 683 }
684 684
685 - (NSError *)blogFetchError { 685 - (NSError *)blogFetchError {
686 return mBlogFetchError; 686 return mBlogFetchError;
687 } 687 }
688 688
689 - (void)setBlogFetchError:(NSError *)error { 689 - (void)setBlogFetchError:(NSError *)error {
690 [mBlogFetchError release]; 690 [mBlogFetchError release];
691 mBlogFetchError = [error retain]; 691 mBlogFetchError = [error retain];
692 } 692 }
693 693
694 - (GDataServiceTicket *)blogFeedTicket { 694 - (GDataServiceTicket *)blogFeedTicket {
695 return mBlogFeedTicket; 695 return mBlogFeedTicket;
696 } 696 }
697 697
698 - (void)setBlogFeedTicket:(GDataServiceTicket *)ticket { 698 - (void)setBlogFeedTicket:(GDataServiceTicket *)ticket {
699 [mBlogFeedTicket autorelease]; 699 [mBlogFeedTicket autorelease];
700 mBlogFeedTicket = [ticket retain]; 700 mBlogFeedTicket = [ticket retain];
701 } 701 }
702 702
703 - (GDataFeedBase *)postFeed { 703 - (GDataFeedBase *)postFeed {
704 return mPostFeed; 704 return mPostFeed;
705 } 705 }
706 706
707 - (void)setPostFeed:(GDataFeedBase *)feed { 707 - (void)setPostFeed:(GDataFeedBase *)feed {
708 [mPostFeed autorelease]; 708 [mPostFeed autorelease];
709 mPostFeed = [feed retain]; 709 mPostFeed = [feed retain];
710 } 710 }
711 711
712 - (NSError *)postFetchError { 712 - (NSError *)postFetchError {
713 return mPostFetchError; 713 return mPostFetchError;
714 } 714 }
715 715
716 - (void)setPostFetchError:(NSError *)error { 716 - (void)setPostFetchError:(NSError *)error {
717 [mPostFetchError release]; 717 [mPostFetchError release];
718 mPostFetchError = [error retain]; 718 mPostFetchError = [error retain];
719 } 719 }
720 720
721 - (GDataServiceTicket *)postFeedTicket { 721 - (GDataServiceTicket *)postFeedTicket {
722 return mPostFeedTicket; 722 return mPostFeedTicket;
723 } 723 }
724 724
725 - (void)setPostFeedTicket:(GDataServiceTicket *)ticket { 725 - (void)setPostFeedTicket:(GDataServiceTicket *)ticket {
726 [mPostFeedTicket autorelease]; 726 [mPostFeedTicket autorelease];
727 mPostFeedTicket = [ticket retain]; 727 mPostFeedTicket = [ticket retain];
728 } 728 }
729 729
730 - (GDataFeedBase *)commentFeed { 730 - (GDataFeedBase *)commentFeed {
731 return mCommentFeed; 731 return mCommentFeed;
732 } 732 }
733 733
734 - (void)setCommentFeed:(GDataFeedBase *)feed { 734 - (void)setCommentFeed:(GDataFeedBase *)feed {
735 [mCommentFeed autorelease]; 735 [mCommentFeed autorelease];
736 mCommentFeed = [feed retain]; 736 mCommentFeed = [feed retain];
737 } 737 }
738 738
739 - (NSError *)commentFetchError { 739 - (NSError *)commentFetchError {
740 return mCommentFetchError; 740 return mCommentFetchError;
741 } 741 }
742 742
743 - (void)setCommentFetchError:(NSError *)error { 743 - (void)setCommentFetchError:(NSError *)error {
744 [mCommentFetchError release]; 744 [mCommentFetchError release];
745 mCommentFetchError = [error retain]; 745 mCommentFetchError = [error retain];
746 } 746 }
747 747
748 - (GDataServiceTicket *)commentFeedTicket { 748 - (GDataServiceTicket *)commentFeedTicket {
749 return mCommentFeedTicket; 749 return mCommentFeedTicket;
750 } 750 }
751 751
752 - (void)setCommentFeedTicket:(GDataServiceTicket *)ticket { 752 - (void)setCommentFeedTicket:(GDataServiceTicket *)ticket {
753 [mCommentFeedTicket autorelease]; 753 [mCommentFeedTicket autorelease];
754 mCommentFeedTicket = [ticket retain]; 754 mCommentFeedTicket = [ticket retain];
755 } 755 }
756 756
757 - (GDataServiceTicket *)editPostTicket { 757 - (GDataServiceTicket *)editPostTicket {
758 return mEditPostTicket; 758 return mEditPostTicket;
759 } 759 }
760 760
761 - (void)setEditPostTicket:(GDataServiceTicket *)ticket { 761 - (void)setEditPostTicket:(GDataServiceTicket *)ticket {
762 [mEditPostTicket autorelease]; 762 [mEditPostTicket autorelease];
763 mEditPostTicket = [ticket retain]; 763 mEditPostTicket = [ticket retain];
764 } 764 }
765 765
766 @end 766 @end
Powered by Google Project Hosting