dev.stuconnolly.com / svn / safaritabs

  1. /*
  2.  *  $Id: STUpdaterDialogs.m 207 2010-01-31 00:08:34Z 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 "STUpdaterDialogs.h"
  24. #import "STUtilities.h"
  25.  
  26. @implementation STUpdaterDialogs
  27.  
  28. /*!
  29.  * Displays a standard message dialog indicating that there is no new SafariTabs version to update to.
  30.  */
  31. void STDisplayNoNewVersionAvailableDialog(void)
  32. {
  33.     [[NSAlert alertWithMessageText:STLocalizedString(@"Update no update -> message") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:[NSString stringWithFormat:STLocalizedString(@"Update no update -> informative message"), STPluginVersion()]] runModal];
  34. }
  35.  
  36. /*!
  37.  * Displays a standard message dialog indicating that an error occurred whilst trying to check for new versions
  38.  * of SafariTabs.
  39.  */
  40. void STDisplayCheckForUpdateErrorDialog(void)
  41. {
  42.     [[NSAlert alertWithMessageText:STLocalizedString(@"Update fail -> message") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:STLocalizedString(@"Update fail -> informative message")] runModal];
  43. }
  44.  
  45. /*!
  46.  * Displays a standard message dialog indicating that an error occurred whilst trying to download a new version
  47.  * of SafariTabs.
  48.  */
  49. void STDisplayDownloadUpdateErrorDialog(void)
  50. {
  51.     [[NSAlert alertWithMessageText:STLocalizedString(@"Download fail -> message") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:STLocalizedString(@"Download fail -> informative message")] runModal];
  52. }
  53.  
  54. /*!
  55.  * Displays a standard message dialog indicating that the download was successfully completed.
  56.  */
  57. void STDisplayDownloadCompleteDialog(void)
  58. {
  59.     [[NSAlert alertWithMessageText:STLocalizedString(@"Download complete -> message") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:STLocalizedString(@"Download complete -> informative message")] runModal];
  60. }
  61.  
  62. /*!
  63.  * Displays a standard message dialog indicating that a new version of SafariTabs is available to download.
  64.  *
  65.  * @param version The new version string
  66.  *
  67.  * @return The user's decision of whether or not to update. One of NSAlertDefaultReturn (1) or NSAlertAlternateReturn (0).
  68.  */
  69. NSAlert *STGetNewVersionAvailableDialog(NSString *version, BOOL displaySuppressionOption)
  70. {
  71.     NSAlert *alert = [NSAlert alertWithMessageText:STLocalizedString(@"Update new version -> message")
  72.                                      defaultButton:STLocalizedString(@"Update new version -> download")
  73.                                    alternateButton:STLocalizedString(@"Update new version -> not now")
  74.                                        otherButton:nil
  75.                          informativeTextWithFormat:[NSString stringWithFormat:STLocalizedString(@"Update new version -> informative message"), version, STPluginVersion()]];
  76.    
  77.     [alert setShowsSuppressionButton:displaySuppressionOption];
  78.     [[alert suppressionButton] setTitle:STLocalizedString(@"Update new version -> suppresion message")];
  79.    
  80.     return alert;
  81. }
  82.  
  83. @end
  84.