public void LinkClicked(string href)
        {
            if (string.IsNullOrEmpty(href) || href.StartsWith("about:"))
            {
                return;
            }

            href = href.Replace("%20", " ");

            if (href.StartsWith("http"))
            {
                SparkleShare.Controller.OpenWebsite(href);
            }
            else if (href.StartsWith("restore://") && this.restore_revision_info == null)
            {
                Regex regex = new Regex("restore://(.+)/([a-f0-9]+)/(.+)/(.{3} [0-9]+ [0-9]+h[0-9]+)/(.+)");
                Match match = regex.Match(href);

                if (match.Success)
                {
                    string author_name = match.Groups [3].Value;
                    string timestamp   = match.Groups [4].Value;

                    this.restore_revision_info = new RevisionInfo()
                    {
                        Folder   = new SparkleFolder(match.Groups [1].Value),
                        Revision = match.Groups [2].Value,
                        FilePath = Uri.UnescapeDataString(match.Groups [5].Value)
                    };

                    string file_name = Path.GetFileNameWithoutExtension(this.restore_revision_info.FilePath) +
                                       " (" + author_name + " " + timestamp + ")" + Path.GetExtension(this.restore_revision_info.FilePath);

                    string target_folder_path = Path.Combine(this.restore_revision_info.Folder.FullPath,
                                                             Path.GetDirectoryName(this.restore_revision_info.FilePath));

                    ShowSaveDialogEvent(file_name, target_folder_path);
                }
            }
            else if (href.StartsWith("back://"))
            {
                this.history_view_active = false;
                SelectedFolder           = this.selected_folder; // TODO: Return to the same position on the page

                UpdateChooserEnablementEvent(true);
            }
            else if (href.StartsWith("history://"))
            {
                this.history_view_active = true;

                ContentLoadingEvent();
                UpdateSizeInfoEvent("…", "…");
                UpdateChooserEnablementEvent(false);

                string folder    = href.Replace("history://", "").Split("/".ToCharArray()) [0];
                string file_path = href.Replace("history://" + folder + "/", "");

                byte [] file_path_bytes = Encoding.Default.GetBytes(file_path);
                file_path = Encoding.UTF8.GetString(file_path_bytes);

                file_path = Uri.UnescapeDataString(file_path);

                foreach (BaseRepository repo in SparkleShare.Controller.Repositories)
                {
                    if (!repo.Name.Equals(folder))
                    {
                        continue;
                    }

                    new Thread(() => {
                        SparkleDelay delay           = new SparkleDelay();
                        List <ChangeSet> change_sets = repo.GetChangeSets(file_path);
                        string html = GetHistoryHTMLLog(change_sets, file_path);
                        delay.Stop();

                        if (!string.IsNullOrEmpty(html))
                        {
                            UpdateContentEvent(html);
                        }
                    }).Start();

                    break;
                }
            }
            else
            {
                if (href.StartsWith("file:///"))
                {
                    href = href.Substring(7);
                }

                SparkleShare.Controller.OpenFile(href);
            }
        }
        public EventLogController()
        {
            SparkleShare.Controller.ShowEventLogWindowEvent += delegate {
                if (!WindowIsOpen)
                {
                    ContentLoadingEvent();
                    UpdateSizeInfoEvent("…", "…");

                    if (this.selected_folder == null)
                    {
                        new Thread(() => {
                            SparkleDelay delay = new SparkleDelay();
                            string html        = HTML;
                            delay.Stop();

                            UpdateChooserEvent(Folders);
                            UpdateChooserEnablementEvent(true);

                            if (!string.IsNullOrEmpty(html))
                            {
                                UpdateContentEvent(html);
                            }

                            UpdateSizeInfoEvent(Size, HistorySize);
                        }).Start();
                    }
                }

                WindowIsOpen = true;
                ShowWindowEvent();
            };

            SparkleShare.Controller.OnIdle += delegate {
                if (this.history_view_active)
                {
                    return;
                }

                ContentLoadingEvent();
                UpdateSizeInfoEvent("…", "…");

                SparkleDelay delay = new SparkleDelay();
                string       html  = HTML;
                delay.Stop();

                if (!string.IsNullOrEmpty(html))
                {
                    UpdateContentEvent(html);
                }

                UpdateSizeInfoEvent(Size, HistorySize);
            };

            SparkleShare.Controller.FolderListChanged += delegate {
                if (this.selected_folder != null && !SparkleShare.Controller.Folders.Contains(this.selected_folder))
                {
                    this.selected_folder = null;
                }

                UpdateChooserEvent(Folders);
                UpdateSizeInfoEvent(Size, HistorySize);
            };
        }