コード例 #1
0
ファイル: GtkApplicationBase.cs プロジェクト: GNOME/tasque
        protected void InitializeIdle()
        {
            string backend = null;
            if (customBackendId != null)
                backend = customBackendId;
            else {
                var backendIdString = preferences.Get (PreferencesKeys.CurrentBackend);
                Logger.Debug ("CurrentBackend specified in Preferences: {0}",
                              backendIdString);
                var bs = backendManager.AvailableBackends.SingleOrDefault (
                    b => b.Key == backendIdString).Key;
                if (!string.IsNullOrWhiteSpace (bs))
                    backend = bs;
            }

            backendManager.SetBackend (backend);

            trayIcon = GtkTray.CreateTray (this);

            BackendManager.BackendChanging += delegate {
                backendWasNullBeforeChange = BackendManager.CurrentBackend == null;
            };

            BackendManager.BackendInitialized += delegate {
                if (backendWasNullBeforeChange)
                    TaskWindow.Reinitialize (!quietStart, this);
                else
                    TaskWindow.Reinitialize (true, this);

                if (trayIcon != null)
                    trayIcon.RefreshTrayIconTooltip ();
            };

            if (backendManager.CurrentBackend == null) {
                // Pop open the preferences dialog so the user can choose a
                // backend service to use.
                ShowPreferences ();
            } else if (!quietStart)
                TaskWindow.ShowWindow (this);

            if (backendManager.CurrentBackend == null ||
                !backendManager.IsBackendConfigured) {
                GLib.Timeout.Add (1000, new GLib.TimeoutHandler (delegate {
                    try {
                        if (backendManager.CurrentBackend != null &&
                            !backendManager.IsBackendConfigured) {
                            backendManager.ReInitializeBackend ();
                        }
                    } catch (Exception e) {
                        Logger.Error ("{0}", e.Message);
                    }
                    return backendManager.CurrentBackend == null ||
                        !backendManager.IsBackendConfigured;
                }));
            }

            OnInitializeIdle ();
        }
コード例 #2
0
        protected void InitializeIdle()
        {
            string backend = null;

            if (customBackendId != null)
            {
                backend = customBackendId;
            }
            else
            {
                var backendIdString = preferences.Get(PreferencesKeys.CurrentBackend);
                Logger.Debug("CurrentBackend specified in Preferences: {0}",
                             backendIdString);
                var bs = backendManager.AvailableBackends.SingleOrDefault(
                    b => b.Key == backendIdString).Key;
                if (!string.IsNullOrWhiteSpace(bs))
                {
                    backend = bs;
                }
            }

            backendManager.SetBackend(backend);

            trayIcon = GtkTray.CreateTray(this);

            BackendManager.BackendChanging += delegate {
                backendWasNullBeforeChange = BackendManager.CurrentBackend == null;
            };

            BackendManager.BackendInitialized += delegate {
                if (backendWasNullBeforeChange)
                {
                    TaskWindow.Reinitialize(!quietStart, this);
                }
                else
                {
                    TaskWindow.Reinitialize(true, this);
                }

                if (trayIcon != null)
                {
                    trayIcon.RefreshTrayIconTooltip();
                }
            };

            if (backendManager.CurrentBackend == null)
            {
                // Pop open the preferences dialog so the user can choose a
                // backend service to use.
                ShowPreferences();
            }
            else if (!quietStart)
            {
                TaskWindow.ShowWindow(this);
            }

            if (backendManager.CurrentBackend == null ||
                !backendManager.IsBackendConfigured)
            {
                GLib.Timeout.Add(1000, new GLib.TimeoutHandler(delegate {
                    try {
                        if (backendManager.CurrentBackend != null &&
                            !backendManager.IsBackendConfigured)
                        {
                            backendManager.ReInitializeBackend();
                        }
                    } catch (Exception e) {
                        Logger.Error("{0}", e.Message);
                    }
                    return(backendManager.CurrentBackend == null ||
                           !backendManager.IsBackendConfigured);
                }));
            }

            OnInitializeIdle();
        }