[tasque] Clean out INativeApplication interface



commit bdbd5213114d226039c50e16997f891933f8af82
Author: Antonius Riha <antoniusriha gmail com>
Date:   Thu Jan 3 16:56:57 2013 +0100

    Clean out INativeApplication interface

 src/Gtk.Tasque/GtkApplicationBase.cs |   19 +++++--------------
 src/Gtk.Tasque/GtkTray.cs            |    2 +-
 src/Gtk.Tasque/TaskWindow.cs         |    2 +-
 src/libtasque/INativeApplication.cs  |    5 +----
 src/libtasque/NativeApplication.cs   |   25 ++++++-------------------
 src/tasque/Program.cs                |    1 -
 6 files changed, 14 insertions(+), 40 deletions(-)
---
diff --git a/src/Gtk.Tasque/GtkApplicationBase.cs b/src/Gtk.Tasque/GtkApplicationBase.cs
index d6fb036..7c7004f 100644
--- a/src/Gtk.Tasque/GtkApplicationBase.cs
+++ b/src/Gtk.Tasque/GtkApplicationBase.cs
@@ -65,6 +65,8 @@ namespace Tasque
 				CheckForDaySwitch ();
 				return true;
 			});
+
+			Gtk.Application.Run ();
 			
 			base.OnInitialize ();
 		}
@@ -89,16 +91,6 @@ namespace Tasque
 			
 			base.OnInitializeIdle ();
 		}
-		
-		public override void StartMainLoop ()
-		{
-			Gtk.Application.Run ();
-		}
-		
-		public override void QuitMainLoop ()
-		{
-			Gtk.Application.Quit ();
-		}
 
 #if ENABLE_NOTIFY_SHARP
 		public override void ShowAppNotification (string summary, string body)
@@ -168,14 +160,13 @@ namespace Tasque
 				trayIcon.RefreshTrayIconTooltip ();
 		}
 
-		protected override void OnQuitting ()
+		protected override void OnExit (int exitCode)
 		{
 			if (Backend != null)
 				UnhookFromTooltipTaskGroupModels ();
-			
 			TaskWindow.SavePosition (Preferences);
-			
-			base.OnQuitting ();
+			Application.Quit ();
+			base.OnExit (exitCode);
 		}
 		
 		protected override void ShowMainWindow ()
diff --git a/src/Gtk.Tasque/GtkTray.cs b/src/Gtk.Tasque/GtkTray.cs
index a563628..71a66c5 100644
--- a/src/Gtk.Tasque/GtkTray.cs
+++ b/src/Gtk.Tasque/GtkTray.cs
@@ -183,7 +183,7 @@ namespace Tasque
 				new ActionEntry ("RefreshAction", Stock.Execute, Catalog.GetString ("Refresh Tasks ..."),
 				                 null, null, delegate { application.Backend.Refresh(); }),
 
-				new ActionEntry ("QuitAction", Stock.Quit, delegate { application.Quit (); })
+				new ActionEntry ("QuitAction", Stock.Quit, delegate { application.Exit (); })
 			});
 			
 			ToggleTaskWindowAction = new Gtk.Action ("ToggleTaskWindowAction", Catalog.GetString ("Toggle Task Window"));
diff --git a/src/Gtk.Tasque/TaskWindow.cs b/src/Gtk.Tasque/TaskWindow.cs
index 09f984c..24142ff 100644
--- a/src/Gtk.Tasque/TaskWindow.cs
+++ b/src/Gtk.Tasque/TaskWindow.cs
@@ -191,7 +191,7 @@ namespace Tasque
 						Gtk.AccelFlags.Visible);
 			
 			globalKeys.AddAccelerator (delegate (object sender, EventArgs e) {
-				application.Quit (); },
+				application.Exit (); },
 						(uint) Gdk.Key.q,
 						Gdk.ModifierType.ControlMask,
 						Gtk.AccelFlags.Visible);
diff --git a/src/libtasque/INativeApplication.cs b/src/libtasque/INativeApplication.cs
index 182166d..1fef995 100644
--- a/src/libtasque/INativeApplication.cs
+++ b/src/libtasque/INativeApplication.cs
@@ -13,13 +13,10 @@ namespace Tasque
 		TaskGroupModel TomorrowTasks { get; }
 		string ConfDir { get; }
 		Preferences Preferences { get; }
-		void Exit (int exitcode);
-		void Quit ();
+		void Exit (int exitcode = 0);
 		void Initialize (string [] args);
-		void QuitMainLoop ();
 		void ShowPreferences ();
 		void ShowAppNotification (string summary, string body);
-		void StartMainLoop ();
 		event EventHandler Exiting;
 		event EventHandler BackendChanged;
 	}
diff --git a/src/libtasque/NativeApplication.cs b/src/libtasque/NativeApplication.cs
index a1250ad..4ab1572 100644
--- a/src/libtasque/NativeApplication.cs
+++ b/src/libtasque/NativeApplication.cs
@@ -107,30 +107,21 @@ namespace Tasque
 		#region Exit and Quit
 		public void Exit (int exitcode)
 		{
+			Logger.Info ("Exit called - terminating application");
+
+			if (backend != null)
+				backend.Cleanup ();
+
 			OnExit (exitcode);
-			
 			if (Exiting != null)
 				Exiting (this, EventArgs.Empty);
-			
+
 			Environment.Exit (exitcode);
 		}
 		
 		public event EventHandler Exiting;
 		
 		protected virtual void OnExit (int exitCode) {}
-		
-		public void Quit ()
-		{
-			Logger.Info ("Quit called - terminating application");
-			OnQuitting ();
-			
-			if (backend != null)
-				backend.Cleanup ();
-			
-			QuitMainLoop ();
-		}
-		
-		protected virtual void OnQuitting () {}
 		#endregion
 		
 		#region Backend
@@ -179,10 +170,6 @@ namespace Tasque
 		}
 		#endregion
 
-		public abstract void QuitMainLoop ();
-
-		public abstract void StartMainLoop ();
-
 		/// <summary>
 		/// Determines whether this a remote instance is running.
 		/// </summary>
diff --git a/src/tasque/Program.cs b/src/tasque/Program.cs
index 9491917..4041152 100644
--- a/src/tasque/Program.cs
+++ b/src/tasque/Program.cs
@@ -83,7 +83,6 @@ namespace Tasque
 				SetProcessName ("Tasque");
 
 				application.Initialize (args);
-				application.StartMainLoop ();
 			} catch (Exception e) {
 				Logger.Debug ("Exception is: {0}", e);
 				application.Exit (-1);



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