tomboy r2310 - in trunk: . Tomboy Tomboy/Addins/Bugzilla



Author: sharm
Date: Mon Feb  2 04:26:13 2009
New Revision: 2310
URL: http://svn.gnome.org/viewvc/tomboy?rev=2310&view=rev

Log:
* tomboy/Tomboy/Utils.cs:
* tomboy/Tomboy/Tomboy.cs:
* tomboy/Tomboy/Watchers.cs:
* tomboy/Tomboy/Addins/Bugzilla/BugzillaLink.cs: Move
  UrlWatcher.ShowOpeningLocationError to GuiUtils. Use with try/catch
  wherever OpenUrl was called unsafely. Fixes crash from bug #569639.

Modified:
   trunk/ChangeLog
   trunk/Tomboy/Addins/Bugzilla/BugzillaLink.cs
   trunk/Tomboy/Tomboy.cs
   trunk/Tomboy/Utils.cs
   trunk/Tomboy/Watchers.cs

Modified: trunk/Tomboy/Addins/Bugzilla/BugzillaLink.cs
==============================================================================
--- trunk/Tomboy/Addins/Bugzilla/BugzillaLink.cs	(original)
+++ trunk/Tomboy/Addins/Bugzilla/BugzillaLink.cs	Mon Feb  2 04:26:13 2009
@@ -75,7 +75,12 @@
 		{
 			if (BugUrl != string.Empty) {
 				Logger.Log ("Opening url '{0}'...", BugUrl);
-				Services.NativeApplication.OpenUrl (BugUrl);
+				
+				try {
+					Services.NativeApplication.OpenUrl (BugUrl);
+				} catch (Exception e) {
+					GuiUtils.ShowOpeningLocationError (null, BugUrl, e.Message);
+				}
 			}
 			return true;
 		}

Modified: trunk/Tomboy/Tomboy.cs
==============================================================================
--- trunk/Tomboy/Tomboy.cs	(original)
+++ trunk/Tomboy/Tomboy.cs	Mon Feb  2 04:26:13 2009
@@ -302,7 +302,11 @@
 			about.Comments = Catalog.GetString ("A simple and easy to use desktop " +
 			                                    "note-taking application.");
 			Gtk.AboutDialog.SetUrlHook (delegate (Gtk.AboutDialog dialog, string link) {
-				Services.NativeApplication.OpenUrl (link);
+				try {
+					Services.NativeApplication.OpenUrl (link);
+				} catch (Exception e) {
+					GuiUtils.ShowOpeningLocationError (dialog, link, e.Message);
+				}
 			}); 
 			about.Website = Defines.TOMBOY_WEBSITE;
 			about.WebsiteLabel = Catalog.GetString("Homepage");

Modified: trunk/Tomboy/Utils.cs
==============================================================================
--- trunk/Tomboy/Utils.cs	(original)
+++ trunk/Tomboy/Utils.cs	Mon Feb  2 04:26:13 2009
@@ -158,6 +158,21 @@
 				dialog.Destroy ();
 			}
 		}
+		
+		public static void ShowOpeningLocationError (Gtk.Window parent, string url, string error)
+		{
+			string message = String.Format ("{0}: {1}", url, error);
+
+			HIGMessageDialog dialog =
+			        new HIGMessageDialog (parent,
+			                              Gtk.DialogFlags.DestroyWithParent,
+			                              Gtk.MessageType.Info,
+			                              Gtk.ButtonsType.Ok,
+			                              Catalog.GetString ("Cannot open location"),
+			                              message);
+			dialog.Run ();
+			dialog.Destroy ();
+		}
 
 		/// <summary>
 		/// Get a string that is more friendly/pretty for the specified date.

Modified: trunk/Tomboy/Watchers.cs
==============================================================================
--- trunk/Tomboy/Watchers.cs	(original)
+++ trunk/Tomboy/Watchers.cs	Mon Feb  2 04:26:13 2009
@@ -460,21 +460,6 @@
 			}
 		}
 
-		void ShowOpeningLocationError (string url, string error)
-		{
-			string message = String.Format ("{0}: {1}", url, error);
-
-			HIGMessageDialog dialog =
-			        new HIGMessageDialog (Window,
-			                              Gtk.DialogFlags.DestroyWithParent,
-			                              Gtk.MessageType.Info,
-			                              Gtk.ButtonsType.Ok,
-			                              Catalog.GetString ("Cannot open location"),
-			                              message);
-			dialog.Run ();
-			dialog.Destroy ();
-		}
-
 		bool OnUrlTagActivated (NoteTag      sender,
 		                        NoteEditor   editor,
 		                        Gtk.TextIter start,
@@ -484,7 +469,7 @@
 			try {
 				OpenUrl (url);
 			} catch (GLib.GException e) {
-				ShowOpeningLocationError (url, e.Message);
+				GuiUtils.ShowOpeningLocationError (Window, url, e.Message);
 			}
 
 			// Kill the middle button paste...



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]