dev.stuconnolly.com / svn / safaritabs

  1. /*
  2.  *  $Id: STSessionRestoreTab.m 198 2010-01-06 23:05:30Z stuart $
  3.  *
  4.  *  SafariTabs
  5.  *  http://stuconnolly.com/projects/safaritabs/
  6.  *
  7.  *  Copyright (c) 2010 Stuart Connolly. All rights reserved.
  8.  *
  9.  *  This program is free software: you can redistribute it and/or modify
  10.  *  it under the terms of the GNU General Public License as published by
  11.  *  the Free Software Foundation, either version 3 of the License, or
  12.  *  (at your option) any later version.
  13.  *
  14.  *  This program is distributed in the hope that it will be useful,
  15.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17.  *  GNU General Public License for more details.
  18.  *
  19.  *  You should have received a copy of the GNU General Public License
  20.  *  along with this program. If not, see <http://www.gnu.org/licenses/>.
  21.  */
  22.  
  23. #import "STSessionRestoreTab.h"
  24.  
  25. @implementation STSessionRestoreTab
  26.  
  27. @synthesize tabTitle;
  28. @synthesize tabURL;
  29. @synthesize tabEnabled;
  30. @synthesize tabIcon;
  31.  
  32. /*!
  33.  * Returns an initialised restore tab using the supplied details.
  34.  *
  35.  * @param title The tab's title.
  36.  * @param url   The tab's URL.
  37.  * @param icon  The tab's icon.
  38.  *
  39.  * @return The initialised restore tab instance.
  40.  */
  41. + (STSessionRestoreTab *)tabWithTitle:(NSString *)title url:(NSURL *)url icon:(NSImage *)icon
  42. {
  43.     return [[[STSessionRestoreTab alloc] initWithTitle:title url:url icon:icon] autorelease];
  44. }
  45.  
  46. /*!
  47.  * Initialises a restore tab using the supplied details.
  48.  *
  49.  * @param title The tab's title.
  50.  * @param url   The tab's URL.
  51.  * @param icon  The tab's icon.
  52.  *
  53.  * @return The initialised restore tab instance.
  54.  */
  55. - (id)initWithTitle:(NSString *)title url:(NSURL *)url icon:(NSImage *)icon
  56. {
  57.     if ((self = [super init])) {
  58.         [self setTabTitle:title];
  59.         [self setTabURL:url];
  60.         [self setTabEnabled:[NSNumber numberWithBool:YES]];
  61.         [self setTabIcon:icon];
  62.     }
  63.    
  64.     return self;
  65. }
  66.  
  67. /*!
  68.  * Returns a description of this object instance.
  69.  *
  70.  * @return The description as a string.
  71.  */
  72. - (NSString *)description
  73. {
  74.     return [NSString stringWithFormat:@"<%@: %@, %@>", [self className], [self tabTitle], [self tabURL]];
  75. }
  76.  
  77. /*!
  78.  * @brief Dealloc
  79.  */
  80. - (void)dealloc
  81. {
  82.     [tabTitle   release], tabTitle   = nil;
  83.     [tabURL     release], tabURL     = nil;
  84.     [tabEnabled release], tabEnabled = nil;
  85.     [tabIcon    release], tabIcon    = nil;
  86.    
  87.     [super dealloc];
  88. }
  89.  
  90. @end
  91.