void LoadAddins()
        {
            object s = tree.SaveStatus();

            tree.Clear();

            Gtk.TreeIter iter;
            if (!repoCombo.GetActiveIter(out iter))
            {
                return;
            }

            bool showUpdates      = filterComboBox.Active >= 1;
            bool showNotInstalled = filterComboBox.Active <= 1;

            string rep = (string)repoStore.GetValue(iter, 1);

            AddinRepositoryEntry[] reps;
            if (rep == "")
            {
                reps = service.Repositories.GetAvailableAddins();
            }
            else
            {
                reps = service.Repositories.GetAvailableAddins(rep);
            }

            foreach (AddinRepositoryEntry arep in reps)
            {
                Addin sinfo = AddinManager.Registry.GetAddin(arep.Addin.Id);
                if (!Services.InApplicationNamespace(service, arep.Addin.Id))
                {
                    continue;
                }

                if (sinfo == null)
                {
                    if (showNotInstalled)
                    {
                        tree.AddAddin(arep.Addin, arep, true);
                    }
                    continue;
                }

                if (showUpdates && Addin.CompareVersions(sinfo.Version, arep.Addin.Version) <= 0)
                {
                    continue;
                }

                tree.AddAddin(arep.Addin, arep, true);
            }
            FillAddinInfo();

            // Only show the select all button when "Show updates only" is selected
            btnSelectAll.Visible   = filterComboBox.Active == 2;
            btnUnselectAll.Visible = filterComboBox.Active == 2;

            tree.RestoreStatus(s);
        }
Esempio n. 2
0
        void LoadUpdates()
        {
            object s = updatesTree.SaveStatus();

            updatesTree.Clear();

            AddinRepositoryEntry[] reps;
            reps = service.Repositories.GetAvailableAddins(RepositorySearchFlags.LatestVersionsOnly);

            int count = 0;

            foreach (AddinRepositoryEntry arep in reps)
            {
                if (!Services.InApplicationNamespace(service, arep.Addin.Id))
                {
                    continue;
                }

                // Find whatever version is installed
                Addin sinfo = AddinManager.Registry.GetAddin(Addin.GetIdName(arep.Addin.Id));
                if (sinfo == null || !sinfo.Enabled || Addin.CompareVersions(sinfo.Version, arep.Addin.Version) <= 0)
                {
                    continue;
                }

                if (IsFiltered(arep.Addin))
                {
                    continue;
                }

                AddinStatus status = AddinStatus.Installed;
                if (!sinfo.Enabled || Services.GetMissingDependencies(sinfo).Any())
                {
                    status |= AddinStatus.Disabled;
                }

                updatesTree.AddAddin(arep.Addin, arep, status | AddinStatus.HasUpdate);
                count++;
            }

            labelUpdates.Text    = string.Format(Catalog.GetPluralString("{0} update available", "{0} updates available", count), count);
            updatesTabLabel.Text = Catalog.GetString("Updates");
            if (count > 0)
            {
                updatesTabLabel.Text += " (" + count + ")";
            }

            buttonUpdateAll.Visible = count > 0;

            if (count > 0)
            {
                updatesTree.RestoreStatus(s);
            }
            else
            {
                updatesTree.ShowEmptyMessage();
            }
        }
Esempio n. 3
0
        void LoadInstalled()
        {
            object s = tree.SaveStatus();

            int count = 0;

            tree.Clear();
            foreach (Addin ainfo in AddinManager.Registry.GetModules(AddinSearchFlags.IncludeAddins | AddinSearchFlags.LatestVersionsOnly))
            {
                if (Services.InApplicationNamespace(service, ainfo.Id) && !ainfo.Description.IsHidden)
                {
                    AddinHeader ah = SetupService.GetAddinHeader(ainfo);
                    if (IsFiltered(ah))
                    {
                        continue;
                    }
                    AddinStatus st = AddinStatus.Installed;
                    if (!ainfo.Enabled || Services.GetMissingDependencies(ainfo).Any())
                    {
                        st |= AddinStatus.Disabled;
                    }
                    if (addininfoInstalled.GetUpdate(ainfo) != null)
                    {
                        st |= AddinStatus.HasUpdate;
                    }
                    tree.AddAddin(ah, ainfo, st);
                    count++;
                }
            }

            if (count > 0)
            {
                tree.RestoreStatus(s);
            }
            else
            {
                tree.ShowEmptyMessage();
            }

            UpdateAddinInfo();

            installedTabLabel.Text = Catalog.GetString("Installed");

            if (filterEntry.Text.Length != 0 && count > 0)
            {
                installedTabLabel.Text += " (" + count + ")";
            }
        }
        void LoadAddins()
        {
            object s = tree.SaveStatus();

            tree.Clear();
            foreach (Addin ainfo in AddinManager.Registry.GetAddins())
            {
                if (Services.InApplicationNamespace(service, ainfo.Id))
                {
                    tree.AddAddin(SetupService.GetAddinHeader(ainfo), ainfo, ainfo.Enabled, ainfo.IsUserAddin);
                }
            }

            tree.RestoreStatus(s);
            UpdateButtons();
        }
Esempio n. 5
0
        void LoadGallery()
        {
            object s = galleryTree.SaveStatus();

            galleryTree.Clear();

            string rep = GetRepoSelection();

            AddinRepositoryEntry[] reps;
            if (rep == AllRepoMarker)
            {
                reps = service.Repositories.GetAvailableAddins(RepositorySearchFlags.LatestVersionsOnly);
            }
            else
            {
                reps = service.Repositories.GetAvailableAddins(rep, RepositorySearchFlags.LatestVersionsOnly);
            }

            int count = 0;

            foreach (AddinRepositoryEntry arep in reps)
            {
                if (!Services.InApplicationNamespace(service, arep.Addin.Id))
                {
                    continue;
                }

                if (IsFiltered(arep.Addin))
                {
                    continue;
                }

                AddinStatus status = AddinStatus.NotInstalled;

                // Find whatever version is installed
                Addin sinfo = AddinManager.Registry.GetAddin(Addin.GetIdName(arep.Addin.Id));

                if (sinfo != null)
                {
                    status |= AddinStatus.Installed;
                    if (!sinfo.Enabled || Services.GetMissingDependencies(sinfo).Any())
                    {
                        status |= AddinStatus.Disabled;
                    }
                    if (Addin.CompareVersions(sinfo.Version, arep.Addin.Version) > 0)
                    {
                        status |= AddinStatus.HasUpdate;
                    }
                }
                galleryTree.AddAddin(arep.Addin, arep, status);
                count++;
            }

            if (count > 0)
            {
                galleryTree.RestoreStatus(s);
            }
            else
            {
                galleryTree.ShowEmptyMessage();
            }

            galleryTabLabel.Text = Catalog.GetString("Gallery");

            if (filterEntry.Text.Length != 0 && count > 0)
            {
                galleryTabLabel.Text += " (" + count + ")";
            }
        }