From cdb15c5a49419aebdd6552e89327d15b0a1b8bda Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 20 Jun 2010 22:05:11 +0100 Subject: [PATCH] Warn the user for speed issues when uploading certain types of images --- SparkleShare/SparkleHelpers.cs | 35 ++++++++++++++++++++++++++-------- SparkleShare/SparkleRepo.cs | 3 +++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/SparkleShare/SparkleHelpers.cs b/SparkleShare/SparkleHelpers.cs index f37f0d01..4c418064 100644 --- a/SparkleShare/SparkleHelpers.cs +++ b/SparkleShare/SparkleHelpers.cs @@ -15,6 +15,7 @@ // along with this program. If not, see . using Gtk; +using Mono.Unix; using System; using System.IO; using System.Net; @@ -27,6 +28,11 @@ namespace SparkleShare { public static class SparkleHelpers { + public static string _ (string s) + { + return Catalog.GetString (s); + } + // Get's the avatar for a specific email address and size public static Gdk.Pixbuf GetAvatar (string Email, int Size) { @@ -151,52 +157,65 @@ namespace SparkleShare { if (time_span <= TimeSpan.FromSeconds (60)) { if (time_span.Seconds > 1) - return string.Format ("{0} seconds ago", time_span.Seconds); + return string.Format (_("{0} seconds ago"), time_span.Seconds); else return "a second ago"; } if (time_span <= TimeSpan.FromSeconds (60)) { if (time_span.Minutes > 1) - return string.Format ("about {0} minutes ago", time_span.Minutes); + return string.Format (_("about {0} minutes ago"), time_span.Minutes); else return "a minute ago"; } if (time_span <= TimeSpan.FromHours(24)) { if (time_span.Hours > 1) - return string.Format ("about {0} minutes ago", time_span.Hours); + return string.Format (_("about {0} minutes ago"), time_span.Hours); else return "about an hour ago"; } if (time_span <= TimeSpan.FromDays(30)) { if (time_span.Days > 1) - return string.Format ("{0} days ago", time_span.Days); + return string.Format (_("{0} days ago"), time_span.Days); else return "yesterday"; } if (time_span <= TimeSpan.FromDays(365)) { if (time_span.Days > 1) - return string.Format ("{0} months ago", (int) time_span.Days / 30); + return string.Format (_("{0} months ago"), (int) time_span.Days / 30); else return "a month ago"; } if (time_span <= TimeSpan.FromDays(365)) { if (time_span.Days > 1) - return string.Format ("{0} months ago", (int) time_span.Days / 365); + return string.Format (_("{0} months ago"), (int) time_span.Days / 365); else return "a month ago"; } if (time_span.Days > 365) - return string.Format ("{0} months ago", (int) time_span.Days / 365); + return string.Format (_("{0} months ago"), (int) time_span.Days / 365); else return "a year ago"; - } + } + + // Checks for unicorns + public static void CheckForUnicorns (string s) { + s = s.ToLower (); + if (s.Contains ("unicorn") && (s.Contains (".png") || s.Contains (".jpg"))) { + string title = _("Hold your ponies!"); + string subtext = _("SparkleShare is known to be insanely fast with \n" + + "pictures of unicorns. Please make sure your internets\n" + + "are upgraded to the latest version to avoid problems."); + SparkleBubble unicorn_bubble = new SparkleBubble (title, subtext); + unicorn_bubble.Show (); + } + } } diff --git a/SparkleShare/SparkleRepo.cs b/SparkleShare/SparkleRepo.cs index 25435ab2..d9dac422 100644 --- a/SparkleShare/SparkleRepo.cs +++ b/SparkleShare/SparkleRepo.cs @@ -178,6 +178,9 @@ namespace SparkleShare { FetchTimer.Start (); BufferTimer.Start (); + + SparkleHelpers.CheckForUnicorns (Message); + } // Stages the made changes