Inheritance: Gtk.FileChooserDialog
        void ExportButtonClicked(object sender, EventArgs args)
        {
            String             sanitized_title = ExportAllApplicationAddin.SanitizeNoteTitle(Note.Title);
            ExportToHtmlDialog dialog          = new ExportToHtmlDialog(sanitized_title + ".html");
            int    response    = dialog.Run();
            string output_path = dialog.Filename;

            if (response != (int)Gtk.ResponseType.Ok)
            {
                dialog.Destroy();
                return;
            }

            Logger.Debug("Exporting Note '{0}' to '{1}'...", Note.Title, output_path);

            StreamWriter writer        = null;
            string       error_message = null;

            try {
                try {
                    // FIXME: Warn about file existing.  Allow overwrite.
                    File.Delete(output_path);
                } catch {
                }

                writer = new StreamWriter(output_path);
                WriteHTMLForNote(writer, Note, dialog.ExportLinked, dialog.ExportLinkedAll);

                // Save the dialog preferences now that the note has
                // successfully been exported
                dialog.SavePreferences();
                dialog.Destroy();
                dialog = null;

                try {
                    Uri output_uri = new Uri(output_path);
                    Services.NativeApplication.OpenUrl(output_uri.AbsoluteUri,
                                                       Note.Window.Screen);
                } catch (Exception ex) {
                    Logger.Error("Could not open exported note in a web browser: {0}",
                                 ex);

                    string detail = String.Format(
                        Catalog.GetString("Your note was exported to \"{0}\"."),
                        output_path);

                    // Let the user know the note was saved successfully
                    // even though showing the note in a web browser failed.
                    HIGMessageDialog msg_dialog =
                        new HIGMessageDialog(
                            Window,
                            Gtk.DialogFlags.DestroyWithParent,
                            Gtk.MessageType.Info,
                            Gtk.ButtonsType.Ok,
                            Catalog.GetString("Note exported successfully"),
                            detail);
                    msg_dialog.Run();
                    msg_dialog.Destroy();
                }
            } catch (UnauthorizedAccessException) {
                error_message = Catalog.GetString("Access denied.");
            } catch (DirectoryNotFoundException) {
                error_message = Catalog.GetString("Folder does not exist.");
            } catch (Exception e) {
                Logger.Error("Could not export: {0}", e);

                error_message = e.Message;
            } finally {
                if (writer != null)
                {
                    writer.Close();
                }
            }

            if (error_message != null)
            {
                Logger.Error("Could not export: {0}", error_message);

                string msg = String.Format(
                    Catalog.GetString("Could not save the file \"{0}\""),
                    output_path);

                HIGMessageDialog msg_dialog =
                    new HIGMessageDialog(
                        dialog,
                        Gtk.DialogFlags.DestroyWithParent,
                        Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok,
                        msg,
                        error_message);
                msg_dialog.Run();
                msg_dialog.Destroy();
            }

            if (dialog != null)
            {
                dialog.Destroy();
            }
        }
		void ExportButtonClicked (object sender, EventArgs args)
		{
                        String sanitized_title = ExportAllApplicationAddin.SanitizeNoteTitle (Note.Title);
			ExportToHtmlDialog dialog = new ExportToHtmlDialog (sanitized_title + ".html");
			int response = dialog.Run();
			string output_path = dialog.Filename;

			if (response != (int) Gtk.ResponseType.Ok) {
				dialog.Destroy ();
				return;
			}

			Logger.Debug ("Exporting Note '{0}' to '{1}'...", Note.Title, output_path);

			StreamWriter writer = null;
			string error_message = null;

			try {
				try {
					// FIXME: Warn about file existing.  Allow overwrite.
					File.Delete (output_path);
				} catch {
			}

			writer = new StreamWriter (output_path);
				WriteHTMLForNote (writer, Note, dialog.ExportLinked, dialog.ExportLinkedAll);

				// Save the dialog preferences now that the note has
				// successfully been exported
				dialog.SavePreferences ();
				dialog.Destroy ();
				dialog = null;

				try {
					Uri output_uri = new Uri (output_path);
					Services.NativeApplication.OpenUrl (output_uri.AbsoluteUri,
					                                    Note.Window.Screen);
				} catch (Exception ex) {
					Logger.Error ("Could not open exported note in a web browser: {0}",
					            ex);

					string detail = String.Format (
					                        Catalog.GetString ("Your note was exported to \"{0}\"."),
					                        output_path);

					// Let the user know the note was saved successfully
					// even though showing the note in a web browser failed.
					HIGMessageDialog msg_dialog =
					        new HIGMessageDialog (
					        Window,
					        Gtk.DialogFlags.DestroyWithParent,
					        Gtk.MessageType.Info,
					        Gtk.ButtonsType.Ok,
					        Catalog.GetString ("Note exported successfully"),
					        detail);
					msg_dialog.Run ();
					msg_dialog.Destroy ();
				}
			} catch (UnauthorizedAccessException) {
				error_message = Catalog.GetString ("Access denied.");
			} catch (DirectoryNotFoundException) {
				error_message = Catalog.GetString ("Folder does not exist.");
			} catch (Exception e) {
				Logger.Error ("Could not export: {0}", e);

				error_message = e.Message;
			} finally {
				if (writer != null)
					writer.Close ();
			}

			if (error_message != null)
			{
				Logger.Error ("Could not export: {0}", error_message);

				string msg = String.Format (
				                     Catalog.GetString ("Could not save the file \"{0}\""),
				                     output_path);

				HIGMessageDialog msg_dialog =
				        new HIGMessageDialog (
				        dialog,
				        Gtk.DialogFlags.DestroyWithParent,
				        Gtk.MessageType.Error,
				        Gtk.ButtonsType.Ok,
				        msg,
				        error_message);
				msg_dialog.Run ();
				msg_dialog.Destroy ();
			}

			if (dialog != null)
				dialog.Destroy ();
		}