// Adds a repository to the list of repositories
        private void AddRepository(string folder_path)
        {
            // Check if the folder is a Git repository
            if (!Directory.Exists (SparkleHelpers.CombineMore (folder_path, ".git")))
                return;

            SparkleRepo repo = new SparkleRepo (folder_path);

            repo.NewCommit += delegate (object o, NewCommitArgs args) {
                if (NotificationsEnabled && NotificationRaised != null)
                    NotificationRaised (args.Author, args.Email, args.Message, args.RepositoryPath);
            };

            repo.FetchingStarted += delegate {
                UpdateState ();
            };

            repo.FetchingFinished += delegate {
                UpdateState ();
            };

            repo.FetchingFailed += delegate {
                UpdateState ();
            };

            repo.ChangesDetected += delegate {
                UpdateState ();
            };

            repo.PushingStarted += delegate {
                UpdateState ();
            };

            repo.PushingFinished += delegate {
                UpdateState ();
            };

            repo.CommitEndedUpEmpty += delegate {
                UpdateState ();
            };

            repo.PushingFailed += delegate {
                UpdateState ();
            };

            repo.ConflictDetected += delegate {
                if (ConflictNotificationRaised != null)
                    ConflictNotificationRaised ();
            };

            Repositories.Add (repo);

            if (RepositoryListChanged != null)
                RepositoryListChanged ();
        }
Beispiel #2
0
        // Adds a repository to the list of repositories and
        // updates the statusicon menu
        public void AddRepository(string folder_path)
        {
            // Check if the folder is a git repo
            if (!Directory.Exists (SparkleHelpers.CombineMore (folder_path, ".git")))
                return;

            SparkleRepo repo = new SparkleRepo (folder_path);

            repo.NewCommit += delegate (object o, NewCommitArgs args) {
                Application.Invoke (delegate { ShowNewCommitBubble (args.Author, args.Email, args.Message,
                    args.RepositoryName); });
            };

            repo.Commited += delegate (object o, SparkleEventArgs args) {
                Application.Invoke (delegate { CheckForUnicorns (args.Message); });
            };

            repo.FetchingStarted += delegate {
                Application.Invoke (UpdateStatusIconToSyncing);
            };

            repo.FetchingFinished += delegate {
                Application.Invoke (UpdateStatusIconToIdle);
            };

            repo.ChangesDetected += delegate {
                Application.Invoke (UpdateStatusIconToSyncing);
            };

            repo.PushingFinished += delegate {
                Application.Invoke (UpdateStatusIconToIdle);
            };

            repo.CommitEndedUpEmpty += delegate {
                Application.Invoke (UpdateStatusIconToIdle);
            };

            repo.PushingFailed += delegate {
                Application.Invoke (UpdateStatusIconToError);
            };

            repo.ConflictDetected += delegate {
                Application.Invoke (ShowConflictBubble);
            };

            Repositories.Add (repo);

            if (NotificationIcon != null)
                Application.Invoke (delegate { NotificationIcon.CreateMenu (); });
        }