OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 30 Jul 2010 20:41:12 +0000 (20:41 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 30 Jul 2010 20:41:12 +0000 (20:41 +0000)
- Fix Growl for Windows feature.

git-svn-id: svn://localhost/HandBrake/trunk@3462 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Functions/GrowlCommunicator.cs [deleted file]
win/C#/HandBrake.ApplicationServices/Services/Encode.cs
win/C#/HandBrakeCS.csproj
win/C#/frmMain.cs

diff --git a/win/C#/Functions/GrowlCommunicator.cs b/win/C#/Functions/GrowlCommunicator.cs
deleted file mode 100644 (file)
index 5db2478..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*  GrowlCommunicator.cs $\r
-    This file is part of the HandBrake source code.\r
-    Homepage: <http://handbrake.fr>.\r
-    It may be used under the terms of the GNU General Public License. */\r
-\r
-namespace Handbrake.Functions\r
-{\r
-    using System;\r
-    using Growl.Connector;\r
-\r
-    /// <summary>\r
-    /// Provides all functionality for communicating with Growl for Windows.\r
-    /// </summary>\r
-    /// <remarks>\r
-    /// This class is implemented as a static class because:\r
-    ///     1. It allows nearly all of the Growl-related code to be in one place\r
-    ///     2. It prevents the main form, queue handler, and any other part of Handbrake from having to declare\r
-    ///        or track any new instance variables\r
-    /// </remarks>\r
-    public static class GrowlCommunicator\r
-    {\r
-        /// <summary>\r
-        /// The <see cref="GrowlConnector"/> that actually talks to Growl\r
-        /// </summary>\r
-        private static GrowlConnector growl;\r
-\r
-        /// <summary>\r
-        /// The Handbrake application instance that is registered with Growl\r
-        /// </summary>\r
-        private static Application application;\r
-\r
-        /// <summary>\r
-        /// Notification shown upon completion of encoding\r
-        /// </summary>\r
-        private static NotificationType encodeOrQueueCompleted = new NotificationType("EncodeOrQueue", "HandBrake Status");\r
-\r
-        /// <summary>\r
-        /// Checks to see if Growl is currently running on the local machine.\r
-        /// </summary>\r
-        /// <returns>\r
-        /// <c>true</c> if Growl is running;\r
-        /// <c>false</c> otherwise\r
-        /// </returns>\r
-        public static bool IsRunning()\r
-        {\r
-            Initialize();\r
-\r
-            return growl.IsGrowlRunning();\r
-        }\r
-\r
-        /// <summary>\r
-        /// Registers Handbrake with the local Growl instance\r
-        /// </summary>\r
-        /// <remarks>\r
-        /// This should usually be called at application start-up\r
-        /// </remarks>\r
-        public static void Register()\r
-        {\r
-            Initialize();\r
-            growl.Register(application, new[] {encodeOrQueueCompleted});\r
-        }\r
-\r
-        /// <summary>\r
-        /// Sends a notification to Growl. (Since Handbrake currently only supports one type of notification with\r
-        /// static text, this is a shortcut method).\r
-        /// </summary>\r
-        /// <param name="title">\r
-        /// The title.\r
-        /// </param>\r
-        /// <param name="text">\r
-        /// The text to display.\r
-        /// </param>\r
-        public static void Notify(string title, string text)\r
-        {\r
-            Notification notification = new Notification(application.Name, encodeOrQueueCompleted.Name, String.Empty, \r
-                                                         title, text);\r
-            growl.Notify(notification);\r
-        }\r
-\r
-        /// <summary>\r
-        /// Sends a notification to Growl. (This is the more generic version that could be used in the future if \r
-        /// more notification types are implemented)\r
-        /// </summary>\r
-        /// <param name="notificationType">The <see cref="NotificationType">type</see> of notification to send</param>\r
-        /// <param name="title">The notification title</param>\r
-        /// <param name="text">The notification text</param>\r
-        /// <param name="imageUrl">The notification image as a url</param>\r
-        public static void Notify(NotificationType notificationType, string title, string text, string imageUrl)\r
-        {\r
-            Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title, \r
-                                                         text)\r
-                                            {\r
-                                                Icon = imageUrl\r
-                                            };\r
-\r
-            growl.Notify(notification);\r
-        }\r
-\r
-        /// <summary>\r
-        /// Initializes the GrowlCommunicator\r
-        /// </summary>\r
-        private static void Initialize()\r
-        {\r
-            if (growl == null)\r
-            {\r
-                growl = new GrowlConnector\r
-                            {\r
-                                EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText\r
-                            };\r
-\r
-                application = new Application("Handbrake")\r
-                                  {\r
-                                      Icon = Properties.Resources.logo64\r
-                                  };\r
-            }\r
-        }\r
-    }\r
-}
\ No newline at end of file
index 9ca8cdf..ee1673a 100644 (file)
@@ -60,6 +60,7 @@ namespace HandBrake.ApplicationServices.Services
         public Encode()\r
         {\r
             this.EncodeStarted += Encode_EncodeStarted;\r
+            GrowlCommunicator.Register();\r
         }\r
 \r
         #region Delegates and Event Handlers\r
index 203886d..7323783 100644 (file)
     <Compile Include="frmUpdater.designer.cs">\r
       <DependentUpon>frmUpdater.cs</DependentUpon>\r
     </Compile>\r
-    <Compile Include="Functions\GrowlCommunicator.cs" />\r
     <Compile Include="Functions\PresetLoader.cs" />\r
     <Compile Include="Functions\QueryGenerator.cs" />\r
     <Compile Include="Functions\Main.cs" />\r
index 642eb1f..ef6efdf 100644 (file)
@@ -17,6 +17,7 @@ namespace Handbrake
     using System.Windows.Forms;\r
     using Functions;\r
 \r
+    using HandBrake.ApplicationServices.Functions;\r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Parsing;\r
     using HandBrake.ApplicationServices.Services;\r
@@ -26,6 +27,8 @@ namespace Handbrake
     using Presets;\r
     using Properties;\r
 \r
+    using Main = Handbrake.Functions.Main;\r
+\r
     /// <summary>\r
     /// The Main Window\r
     /// </summary>\r