[tasque/transition: 123/213] Pick up previously lost Gtk3 single instance sample solution



commit 63dfffaa84ef5b3c32e2d9635f25d22cb5b9d9b0
Author: Antonius Riha <antoniusriha gmail com>
Date:   Thu Aug 16 21:23:55 2012 +0200

    Pick up previously lost Gtk3 single instance sample solution

 .../Samples/Gtk3SingleInstanceSolution.cs          |   50 ++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 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, "");
+		}
+	}
+}



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