tasque r154 - in trunk: . src
- From: sharm svn gnome org
- To: svn-commits-list gnome org
- Subject: tasque r154 - in trunk: . src
- Date: Sun, 26 Oct 2008 14:08:56 +0000 (UTC)
Author: sharm
Date: Sun Oct 26 14:08:56 2008
New Revision: 154
URL: http://svn.gnome.org/viewvc/tasque?rev=154&view=rev
Log:
* tasque/src/TaskWindow.cs:
* tasque/src/Application.cs: Support "--quiet" command line option to
start Tasque with its main window hidden at first. Also added
"--backend My.Backend.Class", though the old behavior of just
allowing "My.Backend.Class" is still supported. Thanks to Charles
Schaefer for his help on this patch.
Modified:
trunk/ChangeLog
trunk/src/Application.cs
trunk/src/TaskWindow.cs
Modified: trunk/src/Application.cs
==============================================================================
--- trunk/src/Application.cs (original)
+++ trunk/src/Application.cs Sun Oct 26 14:08:56 2008
@@ -62,6 +62,7 @@
private EventBox eb;
private IBackend backend;
private PreferencesDialog preferencesDialog;
+ private bool quietStart = false;
private DateTime currentDay = DateTime.Today;
@@ -94,8 +95,10 @@
{
get { return Application.Instance.backend; }
set {
+ bool changingBackend = false;
Application tasque = Application.Instance;
if (tasque.backend != null) {
+ changingBackend = true;
// Cleanup the old backend
try {
Logger.Debug ("Cleaning up backend: {0}",
@@ -119,7 +122,11 @@
tasque.backend.GetType ().ToString ());
tasque.backend.Initialize();
- TaskWindow.Reinitialize ();
+ if (!changingBackend) {
+ TaskWindow.Reinitialize (!Instance.quietStart);
+ } else {
+ TaskWindow.Reinitialize (true);
+ }
Logger.Debug("Configuration status: {0}",
tasque.backend.Configured.ToString());
@@ -225,11 +232,36 @@
}
#endif
- // Read the args and check to see if a specific backend is specified
- if (args.Length > 0) {
-Logger.Debug ("args [0]: {0}", args [0]);
- // We're only looking at the first argument
- string potentialBackendClassName = args [0];
+ string potentialBackendClassName = null;
+
+ for (int i = 0; i < args.Length; i++) {
+ switch (args [i]) {
+
+ case "--quiet":
+ quietStart = true;
+ Logger.Debug ("Starting quietly");
+ break;
+
+ case "--backend":
+ if ( (i + 1 < args.Length) &&
+ !string.IsNullOrEmpty (args [i + 1]) &&
+ args [i + 1] [0] != '-') {
+ potentialBackendClassName = args [++i];
+ } // TODO: Else, print usage
+ break;
+
+ default:
+ // Support old argument behavior
+ if (!string.IsNullOrEmpty (args [i]))
+ potentialBackendClassName = args [i];
+ break;
+ }
+ }
+
+ // See if a specific backend is specified
+ if (potentialBackendClassName != null) {
+ Logger.Debug ("Backend specified: " +
+ potentialBackendClassName);
customBackend = null;
Assembly asm = Assembly.GetCallingAssembly ();
@@ -361,8 +393,8 @@
// Pop open the preferences dialog so the user can choose a
// backend service to use.
Application.ShowPreferences ();
- } else {
- TaskWindow.ShowWindow();
+ } else if (!quietStart) {
+ TaskWindow.ShowWindow ();
}
if (backend == null || !backend.Configured){
GLib.Timeout.Add(1000, new GLib.TimeoutHandler(RetryBackend));
@@ -393,7 +425,7 @@
currentDay = DateTime.Today;
// Reinitialize window according to new date
if (TaskWindow.IsOpen)
- TaskWindow.Reinitialize ();
+ TaskWindow.Reinitialize (true);
}
return true;
Modified: trunk/src/TaskWindow.cs
==============================================================================
--- trunk/src/TaskWindow.cs (original)
+++ trunk/src/TaskWindow.cs Sun Oct 26 14:08:56 2008
@@ -509,15 +509,16 @@
/// <summary>
/// This should be called after a new IBackend has been set
/// </summary>
- public static void Reinitialize ()
+ public static void Reinitialize (bool show)
{
if (TaskWindow.taskWindow != null) {
TaskWindow.taskWindow.Hide ();
TaskWindow.taskWindow.Destroy ();
TaskWindow.taskWindow = null;
}
-
- TaskWindow.ShowWindow ();
+
+ if (show)
+ TaskWindow.ShowWindow ();
}
public void HighlightTask (ITask task)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]