[tasque/viewmodel: 21/78] Added Gtk3 single instance sample solution



commit ca1fb32b42b3489f1ab2f88f0ae7f919b950c69e
Author: Antonius Riha <antoniusriha gmail com>
Date:   Sat Jul 28 15:02:58 2012 +0200

    Added Gtk3 single instance sample solution
    
    Also moved samples in separate folder and exluded from build.

 .../Samples/Gtk3SingleInstanceSolution.cs          |   50 ++++++++++++++++++++
 .../{ => Samples}/WindowsSingleInstanceSolution.cs |    2 +-
 src/Tasque.Gtk/Tasque.Gtk.csproj                   |    4 +-
 3 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/src/Tasque.Gtk/Samples/Gtk3SingleInstanceSolution.cs b/src/Tasque.Gtk/Samples/Gtk3SingleInstanceSolution.cs
new file mode 100644
index 0000000..226557f
--- /dev/null
+++ b/src/Tasque.Gtk/Samples/Gtk3SingleInstanceSolution.cs
@@ -0,0 +1,50 @@
+// 
+// Gtk3SingleInstanceSolution.cs
+//  
+// Author:
+//       Antonius Riha <antoniusriha gmail com>
+// 
+// Copyright (c) 2012 Antonius Riha
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using Gtk;
+
+namespace Tasque.Samples
+{
+	class MainClass
+	{
+		static void Main (string[] args)
+		{
+			Application app = new Application("org.gtk.test34", 0);
+			app.Activated += delegate {
+				var list = app.Windows;
+				if (list != null && list.Length > 0) {
+					list[0].Present ();
+				}
+				else {
+					var window = new Window(WindowType.Toplevel);
+					window.Application = app;
+					window.Show ();
+				}
+			};
+			
+			app.Run (0, "");
+		}
+	}
+}
diff --git a/src/Tasque.Gtk/WindowsSingleInstanceSolution.cs b/src/Tasque.Gtk/Samples/WindowsSingleInstanceSolution.cs
similarity index 99%
rename from src/Tasque.Gtk/WindowsSingleInstanceSolution.cs
rename to src/Tasque.Gtk/Samples/WindowsSingleInstanceSolution.cs
index 9a47cc0..5beff3d 100644
--- a/src/Tasque.Gtk/WindowsSingleInstanceSolution.cs
+++ b/src/Tasque.Gtk/Samples/WindowsSingleInstanceSolution.cs
@@ -26,7 +26,7 @@
 using System;
 using System.Threading;
 
-namespace ConsoleApplication9
+namespace Tasque.Samples
 {
     class Program
     {
diff --git a/src/Tasque.Gtk/Tasque.Gtk.csproj b/src/Tasque.Gtk/Tasque.Gtk.csproj
index 20a28b1..a67df34 100644
--- a/src/Tasque.Gtk/Tasque.Gtk.csproj
+++ b/src/Tasque.Gtk/Tasque.Gtk.csproj
@@ -121,6 +121,8 @@
     <None Include="..\..\data\sounds\notify.wav">
       <Link>data\sounds\notify.wav</Link>
     </None>
+    <None Include="Samples\Gtk3SingleInstanceSolution.cs" />
+    <None Include="Samples\WindowsSingleInstanceSolution.cs" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
@@ -143,7 +145,6 @@
     <Compile Include="TaskTreeView.cs" />
     <Compile Include="TaskWindow.cs" />
     <Compile Include="Utilities.cs" />
-    <Compile Include="WindowsSingleInstanceSolution.cs" />
   </ItemGroup>
   <ItemGroup Condition=" '$(Configuration)' == 'GnomeDebug' or '$(Configuration)' == 'GnomeRelease' ">
     <Compile Include="GnomeApplication.cs" />
@@ -160,6 +161,7 @@
     <Folder Include="data\" />
     <Folder Include="data\icons\" />
     <Folder Include="data\sounds\" />
+    <Folder Include="Samples\" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\libtasque\libtasque.csproj">



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