Beispiel #1
0
        private void OnSettingChanged(Preferences preferences, string settingKey)
        {
            if (settingKey.CompareTo (Preferences.HideInAllCategory) != 0)
                return;

            categoriesToHide =
                preferences.GetStringList (Preferences.HideInAllCategory);
        }
Beispiel #2
0
        private void Init(string[] args)
        {
            #if OSX
            nativeApp = new OSXApplication ();
            #elif WIN32
            nativeApp = new GtkApplication ();
            #else
            nativeApp = new GnomeApplication ();
            #endif
            nativeApp.Initialize (
                Defines.LocaleDir,
                "Tasque",
                "Tasque",
                args);

            RegisterUIManager ();

            preferences = new Preferences (nativeApp.ConfDir);

            #if !WIN32 && !OSX
            // Register Tasque RemoteControl
            try {
                remoteControl = RemoteControlProxy.Register ();
                if (remoteControl != null) {
                    Logger.Debug ("Tasque remote control active.");
                } else {
                    // If Tasque is already running, open the tasks window
                    // so the user gets some sort of feedback when they
                    // attempt to run Tasque again.
                    RemoteControl remote = null;
                    try {
                        remote = RemoteControlProxy.GetInstance ();
                        remote.ShowTasks ();
                    } catch {}

                    Logger.Debug ("Tasque is already running.  Exiting...");
                    System.Environment.Exit (0);
                }
            } catch (Exception e) {
                Logger.Debug ("Tasque remote control disabled (DBus exception): {0}",
                            e.Message);
            }
            #endif

            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 ();
                try {
                    customBackend = (IBackend)
                        asm.CreateInstance (potentialBackendClassName);
                } catch (Exception e) {
                    Logger.Warn ("Backend specified on args not found: {0}\n\t{1}",
                        potentialBackendClassName, e.Message);
                }
            }

            // Discover all available backends
            LoadAvailableBackends ();

            GLib.Idle.Add(InitializeIdle);
            GLib.Timeout.Add (60000, CheckForDaySwitch);
        }
Beispiel #3
0
        protected void OnSettingChanged(Preferences preferences,
										 string settingKey)
        {
            if (settingKey.CompareTo (Preferences.ShowCompletedTasksKey) != 0)
                return;

            bool newValue =
                preferences.GetBool (Preferences.ShowCompletedTasksKey);
            if (filteredTasks.ShowCompletedTasks == newValue)
                return; // don't do anything if nothing has changed

            filteredTasks.ShowCompletedTasks = newValue;

            Category cat = GetSelectedCategory ();
            if (cat != null)
                Refilter (cat);
        }
Beispiel #4
0
        protected void OnSelectedCategorySettingChanged(
								Preferences preferences,
								string settingKey)
        {
            if (settingKey.CompareTo (Preferences.SelectedCategoryKey) != 0)
                return;

            selectedCategory = GetSelectedCategory ();
            Refilter (selectedCategory);
        }
Beispiel #5
0
        public void Init(string[] args)
        {
            lock (locker) {
                if (initialized)
                {
                    return;
                }
                initialized = true;
            }

            nativeApp.Initialize(
                Defines.LocaleDir,
                "Tasque",
                "Tasque",
                args);

            preferences = new Preferences(nativeApp.ConfDir);

#if !WIN && !OSX
            // Register Tasque RemoteControl
            try {
                remoteControl = RemoteControlProxy.Register();
                if (remoteControl != null)
                {
                    Logger.Debug("Tasque remote control active.");
                }
                else
                {
                    // If Tasque is already running, open the tasks window
                    // so the user gets some sort of feedback when they
                    // attempt to run Tasque again.
                    RemoteControl remote = null;
                    try {
                        remote = RemoteControlProxy.GetInstance();
                        remote.ShowTasks();
                    } catch {}

                    Logger.Debug("Tasque is already running.  Exiting...");
                    System.Environment.Exit(0);
                }
            } catch (Exception e) {
                Logger.Debug("Tasque remote control disabled (DBus exception): {0}",
                             e.Message);
            }
#endif

            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();
                try {
                    customBackend = (IBackend)
                                    asm.CreateInstance(potentialBackendClassName);
                } catch (Exception e) {
                    Logger.Warn("Backend specified on args not found: {0}\n\t{1}",
                                potentialBackendClassName, e.Message);
                }
            }

            // Discover all available backends
            LoadAvailableBackends();

            GLib.Idle.Add(InitializeIdle);
            GLib.Timeout.Add(60000, CheckForDaySwitch);
        }
Beispiel #6
0
        public void Initialize(string[] args)
        {
            if (IsRemoteInstanceRunning ()) {
                Trace.TraceInformation ("Another instance of Tasque is already running.");
                Exit (0);
            }

            RemoteInstanceKnocked += delegate { ShowMainWindow (); };

            preferences = new Preferences (ConfDir);

            ParseArgs (args);

            SetCustomBackend ();

            // Discover all available backends
            LoadAvailableBackends ();

            OnInitialize ();
        }
Beispiel #7
0
        void OnSettingChanged(Preferences preferences, string settingKey)
        {
            if (settingKey.CompareTo (Preferences.HideInAllCategory) != 0)
                return;

            OnCategoryChanged (this, EventArgs.Empty);
        }