예제 #1
0
		public AddinInfoView ()
		{
			Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.AddinInfoView.ui", null);
			builder.Autoconnect (this);
			Add ((Box) builder.GetObject ("AddinInfoView"));
			AllowInstall = true;
			titleWidth = labelName.SizeRequest ().Width;
			
			HeaderBox hb = new HeaderBox (1,1,1,1);
			hb.Show ();
			hb.Replace (this);
			
			hb = new HeaderBox (1,0,0,0);
			hb.SetPadding (6,6,6,6);
			hb.Show ();
			hb.GradientBackround = true;
			hb.Replace (eboxButs);
			
			hb = new HeaderBox (0,1,0,0);
			hb.SetPadding (6,6,6,6);
			hb.Show ();
			hb.GradientBackround = true;
			hb.Replace (boxHeader);
			topHeaderBox = hb;

			//Enable our buttons for clicking
			btnDisable.Clicked += OnBtnDisableClicked;
			btnInstall.Clicked += OnBtnInstallClicked;
			btnUninstall.Clicked += OnBtnUninstallClicked;
			btnUpdate.Clicked += OnBtnUpdateClicked;
			urlButton.Clicked += OnUrlButtonClicked;

			ShowAll ();
		}
예제 #2
0
        public SearchEntry()
        {
            entry.HasFrame = false;
            box.PackStart(entry, true, true, 0);
            iconFind = new HoverImageButton(IconSize.Menu, Gtk.Stock.Find);
            box.PackStart(iconFind, false, false, 0);
            iconClean = new HoverImageButton(IconSize.Menu, Gtk.Stock.Clear);
            box.PackStart(iconClean, false, false, 0);
            box.BorderWidth = 1;

            HeaderBox hbox = new HeaderBox(1, 1, 1, 1);

            hbox.Show();
            hbox.Add(box);
            Add(hbox);

            ModifyBg(StateType.Normal, entry.Style.Base(StateType.Normal));
            iconClean.ModifyBg(StateType.Normal, entry.Style.Base(StateType.Normal));
            iconFind.ModifyBg(StateType.Normal, entry.Style.Base(StateType.Normal));

            iconClean.BorderWidth = 1;
            iconClean.CanFocus    = false;
            iconFind.BorderWidth  = 1;
            iconFind.CanFocus     = false;

            iconClean.Clicked += delegate {
                entry.Text = string.Empty;
            };

            iconFind.Clicked += delegate {
                FireSearch();
            };

            entry.Activated += delegate {
                FireSearch();
            };

            ShowAll();
            UpdateIcon();

            entry.Changed += delegate {
                UpdateIcon();
                FireSearch();
            };
        }
예제 #3
0
		public SearchEntry ()
		{
			entry.HasFrame = false;
			box.PackStart (entry, true, true, 0);
			iconFind = new HoverImageButton (IconSize.Menu, Gtk.Stock.Find);
			box.PackStart (iconFind, false, false, 0);
			iconClean = new HoverImageButton (IconSize.Menu, Gtk.Stock.Clear);
			box.PackStart (iconClean, false, false, 0);
			box.BorderWidth = 1;
			
			HeaderBox hbox = new HeaderBox (1,1,1,1);
			hbox.Show ();
			hbox.Add (box);
			Add (hbox);
			
			ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
			iconClean.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
			iconFind.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
			
			iconClean.BorderWidth = 1;
			iconClean.CanFocus = false;
			iconFind.BorderWidth = 1;
			iconFind.CanFocus = false;
			
			iconClean.Clicked += delegate {
				entry.Text = string.Empty;
			};
			
			iconFind.Clicked += delegate {
				FireSearch ();
			};
			
			entry.Activated += delegate {
				FireSearch ();
			};
			
			ShowAll ();
			UpdateIcon ();
			
			entry.Changed += delegate {
				UpdateIcon ();
				FireSearch ();
			};
		}
예제 #4
0
        public AddinInfoView()
        {
            Builder builder = new Gtk.Builder(null, "Mono.Addins.GuiGtk3.interfaces.AddinInfoView.ui", null);

            builder.Autoconnect(this);
            Add((Box)builder.GetObject("AddinInfoView"));
            AllowInstall = true;
            titleWidth   = labelName.SizeRequest().Width;

            HeaderBox hb = new HeaderBox(1, 1, 1, 1);

            hb.Show();
            hb.Replace(this);

            hb = new HeaderBox(1, 0, 0, 0);
            hb.SetPadding(6, 6, 6, 6);
            hb.Show();
            hb.GradientBackround = true;
            hb.Replace(eboxButs);

            hb = new HeaderBox(0, 1, 0, 0);
            hb.SetPadding(6, 6, 6, 6);
            hb.Show();
            hb.GradientBackround = true;
            hb.Replace(boxHeader);
            topHeaderBox = hb;

            //Enable our buttons for clicking
            btnDisable.Clicked   += OnBtnDisableClicked;
            btnInstall.Clicked   += OnBtnInstallClicked;
            btnUninstall.Clicked += OnBtnUninstallClicked;
            btnUpdate.Clicked    += OnBtnUpdateClicked;
            urlButton.Clicked    += OnUrlButtonClicked;

            ShowAll();
        }
        public AddinManagerDialog(Builder builder, IntPtr handle) : base(handle)
        {
            builder.Autoconnect(this);
//			TransientFor = parent;
//			HasSeparator = false;
            addininfoInstalled = new AddinInfoView();
            addininfoInstalled.InstallClicked       += OnInstallClicked;
            addininfoInstalled.UninstallClicked     += OnUninstallClicked;
            addininfoInstalled.UpdateClicked        += OnUpdateClicked;
            addininfoInstalled.EnableDisableClicked += OnEnableDisableClicked;
            eventbox2.Child  = addininfoInstalled;
            addininfoGallery = new AddinInfoView();
            addininfoGallery.InstallClicked       += OnInstallClicked;
            addininfoGallery.UninstallClicked     += OnUninstallClicked;
            addininfoGallery.UpdateClicked        += OnUpdateClicked;
            addininfoGallery.EnableDisableClicked += OnEnableDisableClicked;
            eventbox1.Child  = addininfoGallery;
            addininfoUpdates = new AddinInfoView();
            addininfoUpdates.InstallClicked       += OnInstallClicked;
            addininfoUpdates.UninstallClicked     += OnUninstallClicked;
            addininfoUpdates.UpdateClicked        += OnUpdateClicked;
            addininfoUpdates.EnableDisableClicked += OnEnableDisableClicked;
            eventbox3.Child = addininfoUpdates;

//			Services.PlaceDialog (this, parent);
            Show();

            addininfoInstalled.Init(service);
            addininfoGallery.Init(service);

            addinTree.Selection.Mode = SelectionMode.Multiple;
            tree = new AddinTreeWidget(addinTree);
            addinTree.Selection.Changed += OnSelectionChanged;
            tree.VersionVisible          = false;

            galleryTreeView.Selection.Mode = SelectionMode.Multiple;
            galleryTree = new AddinTreeWidget(galleryTreeView);
            galleryTree.VersionVisible         = false;
            galleryTree.ShowInstalledMarkers   = true;
            galleryTreeView.Selection.Changed += OnGallerySelectionChanged;

            updatesTreeView.Selection.Mode = SelectionMode.Multiple;
            updatesTree = new AddinTreeWidget(updatesTreeView);
            updatesTree.VersionVisible         = false;
            updatesTree.ShowCategories         = false;
            updatesTree.ShowInstalledMarkers   = true;
            updatesTreeView.Selection.Changed += OnGallerySelectionChanged;

            //Wiring more buttons
            buttonUpdateAll.Clicked       += OnUpdateAll;
            buttonRefreshUpdates.Clicked  += OnButtonRefreshClicked;
            buttonRefresh.Clicked         += OnButtonRefreshClicked;
            buttonInstallFromFile.Clicked += OnButtonInstallFromFileClicked;
            repoCombo.Changed             += OnRepoComboChanged;

            repoStore       = new ListStore(typeof(string), typeof(string));
            repoCombo.Model = repoStore;
            CellRendererText crt = new CellRendererText();

            repoCombo.PackStart(crt, true);
            repoCombo.AddAttribute(crt, "text", 0);
            repoCombo.RowSeparatorFunc = delegate(ITreeModel model, TreeIter iter) {
                string val = (string)model.GetValue(iter, 0);
                return(val == "---");
            };

            // Make sure the tree has the focus when switching tabs

            vboxUpdates.FocusChain = new Widget [] { scrolledUpdates, eboxRepoUpdates };
            vboxGallery.FocusChain = new Widget [] { scrolledGallery, eboxRepo };

            // Improve the look of the headers

            HBox tab = new HBox(false, 3);

            tab.PackStart(new Image(Gdk.Pixbuf.LoadFromResource("plugin-22.png")), false, false, 0);
            installedTabLabel = new Label(Catalog.GetString("Installed"));
            tab.PackStart(installedTabLabel, true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            notebook.SetTabLabel(notebook.GetNthPage(0), tab);

            tab = new HBox(false, 3);
            tab.PackStart(new Image(Gdk.Pixbuf.LoadFromResource("plugin-update-22.png")), false, false, 0);
            updatesTabLabel = new Label(Catalog.GetString("Updates"));
            tab.PackStart(updatesTabLabel, true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            notebook.SetTabLabel(notebook.GetNthPage(1), tab);

            tab = new HBox(false, 3);
            tab.PackStart(new Image(Gdk.Pixbuf.LoadFromResource("system-software-update_22.png")), false, false, 0);
            galleryTabLabel = new Label(Catalog.GetString("Gallery"));
            tab.PackStart(galleryTabLabel, true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            notebook.SetTabLabel(notebook.GetNthPage(2), tab);

            // Gradient header for the updates and gallery tabs

            HeaderBox hb = new HeaderBox(1, 0, 1, 1);

            hb.SetPadding(6, 6, 6, 6);
            hb.GradientBackround = true;
            hb.Show();
            hb.Replace(eboxRepo);

            hb = new HeaderBox(1, 0, 1, 1);
            hb.SetPadding(6, 6, 6, 6);
            hb.GradientBackround = true;
            hb.Show();
            hb.Replace(eboxRepoUpdates);

            InsertFilterEntry();

            FillRepos();
            repoCombo.Active = 0;

            LoadAll();

            ShowAll();
        }
예제 #6
0
        void ShowAddin(object data)
        {
            AddinHeader sinfo        = null;
            Addin       installed    = null;
            AddinHeader updateInfo   = null;
            string      repo         = "";
            string      downloadSize = null;

            topHeaderBox.Hide();

            if (data is Addin)
            {
                installed = (Addin)data;
                sinfo     = SetupService.GetAddinHeader(installed);
                var entry = GetUpdate(installed);
                if (entry != null)
                {
                    updateInfo = entry.Addin;
                    selectedEntry.Add(entry);
                }
                foreach (var prop in sinfo.Properties)
                {
                    if (prop.Name.StartsWith("PreviewImage"))
                    {
                        previewImages.Add(new ImageContainer(installed, prop.Value));
                    }
                }
                string icon32 = sinfo.Properties.GetPropertyValue("Icon32");
                if (icon32.Length > 0)
                {
                    titleIcon = new ImageContainer(installed, icon32);
                }
            }
            else if (data is AddinRepositoryEntry)
            {
                AddinRepositoryEntry entry = (AddinRepositoryEntry)data;
                sinfo     = entry.Addin;
                installed = AddinManager.Registry.GetAddin(Addin.GetIdName(sinfo.Id));
                if (installed != null && Addin.CompareVersions(installed.Version, sinfo.Version) > 0)
                {
                    updateInfo = sinfo;
                }
                selectedEntry.Add(entry);
                string rname = !string.IsNullOrEmpty(entry.RepositoryName) ? entry.RepositoryName : entry.RepositoryUrl;
                repo = "<small><b>" + Catalog.GetString("Available in repository:") + "</b>\n" + GLib.Markup.EscapeText(rname) + "\n\n</small>";
                foreach (var prop in sinfo.Properties)
                {
                    if (prop.Name.StartsWith("PreviewImage"))
                    {
                        previewImages.Add(new ImageContainer(entry, prop.Value));
                    }
                }
                string icon32 = sinfo.Properties.GetPropertyValue("Icon32");
                if (icon32.Length > 0)
                {
                    titleIcon = new ImageContainer(entry, icon32);
                }
                int size;
                if (int.TryParse(sinfo.Properties.GetPropertyValue("DownloadSize"), out size))
                {
                    float fs = ((float)size) / 1048576f;
                    downloadSize = fs.ToString("0.00 MB");
                }
            }
            else
            {
                selectedEntry.Clear();
            }

            if (installed != null)
            {
                selectedAddin.Add(installed);
            }

            string missingDepsTxt = null;

            if (sinfo == null)
            {
                btnDisable.Visible   = false;
                btnUninstall.Visible = false;
                btnUpdate.Visible    = false;
            }
            else
            {
                string version;
                string newVersion = null;
                if (installed != null)
                {
                    btnInstall.Visible   = false;
                    btnUpdate.Visible    = updateInfo != null && AllowInstall;
                    btnDisable.Visible   = true;
                    btnDisable.Label     = installed.Enabled ? Catalog.GetString("Disable") : Catalog.GetString("Enable");
                    btnDisable.Visible   = installed.Description.CanDisable;
                    btnUninstall.Visible = installed.Description.CanUninstall;
                    version = installed.Version;
                    var missingDeps = Services.GetMissingDependencies(installed);
                    if (updateInfo != null)
                    {
                        newVersion         = updateInfo.Version;
                        labelHeader.Markup = "<b><span color='black'>" + Catalog.GetString("Update available") + "</span></b>";
//						topHeaderBox.BackgroundColor = new Gdk.Color (0, 132, 208);
                        imageHeader.Pixbuf           = Gdk.Pixbuf.LoadFromResource("update-16.png");
                        topHeaderBox.BackgroundColor = new Gdk.Color(255, 176, 0);
                        topHeaderBox.Show();
                    }
                    else if (missingDeps.Any())
                    {
                        labelHeader.Markup           = "<b><span color='black'>" + Catalog.GetString("This extension package can't be loaded due to missing dependencies") + "</span></b>";
                        topHeaderBox.BackgroundColor = new Gdk.Color(255, 176, 0);
                        imageHeader.SetFromStock(Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
                        topHeaderBox.Show();
                        missingDepsTxt = "";
                        foreach (var mdep in missingDeps)
                        {
                            if (mdep.Found != null)
                            {
                                missingDepsTxt += "\n" + string.Format(Catalog.GetString("Required: {0} v{1}, found v{2}"), mdep.Addin, mdep.Required, mdep.Found);
                            }
                            else
                            {
                                missingDepsTxt += "\n" + string.Format(Catalog.GetString("Missing: {0} v{1}"), mdep.Addin, mdep.Required);
                            }
                        }
                    }
                }
                else
                {
                    btnInstall.Visible   = AllowInstall;
                    btnUpdate.Visible    = false;
                    btnDisable.Visible   = false;
                    btnUninstall.Visible = false;
                    version = sinfo.Version;
                }
                labelName.Markup = "<b><big>" + GLib.Markup.EscapeText(sinfo.Name) + "</big></b>";

                string ver;
                if (newVersion != null)
                {
                    ver  = "<small><b>" + Catalog.GetString("Installed version") + ":</b> " + version + "</small>\n";
                    ver += "<small><b>" + Catalog.GetString("Repository version") + ":</b> " + newVersion + "</small>";
                }
                else
                {
                    ver = "<small><b>" + Catalog.GetString("Version") + " " + version + "</b></small>";
                }

                if (downloadSize != null)
                {
                    ver += "\n<small><b>" + Catalog.GetString("Download size") + ":</b> " + downloadSize + "</small>";
                }
                if (missingDepsTxt != null)
                {
                    ver += "\n\n" + GLib.Markup.EscapeText(Catalog.GetString("The following dependencies required by this extension package are not available:")) + missingDepsTxt;
                }
                labelVersion.Markup = ver;

                string desc = GLib.Markup.EscapeText(sinfo.Description);
                labelDesc.Markup = repo + GLib.Markup.EscapeText(desc);

                foreach (var img in previewImages)
                {
                    vboxDesc.PackStart(img, false, false, 0);
                }

                urlButton.Visible = !string.IsNullOrEmpty(sinfo.Url);
                infoUrl           = sinfo.Url;

                if (titleIcon != null)
                {
                    boxTitle.PackEnd(titleIcon, false, false, 0);
                    labelName.WidthRequest    = titleWidth - 32;
                    labelVersion.WidthRequest = titleWidth - 32;
                }
                else
                {
                    labelName.WidthRequest    = titleWidth;
                    labelVersion.WidthRequest = titleWidth;
                }

                if (IsRealized)
                {
                    SetComponentsBg();
                }
            }
        }
예제 #7
0
        public AddinManagerDialog(Builder builder, IntPtr handle)
            : base(handle)
        {
            builder.Autoconnect (this);
            //			TransientFor = parent;
            //			HasSeparator = false;
            addininfoInstalled = new AddinInfoView ();
            addininfoInstalled.InstallClicked += OnInstallClicked;
            addininfoInstalled.UninstallClicked += OnUninstallClicked;
            addininfoInstalled.UpdateClicked += OnUpdateClicked;
            addininfoInstalled.EnableDisableClicked += OnEnableDisableClicked;
            eventbox2.Child = addininfoInstalled;
            addininfoGallery = new AddinInfoView ();
            addininfoGallery.InstallClicked += OnInstallClicked;
            addininfoGallery.UninstallClicked += OnUninstallClicked;
            addininfoGallery.UpdateClicked += OnUpdateClicked;
            addininfoGallery.EnableDisableClicked += OnEnableDisableClicked;
            eventbox1.Child = addininfoGallery;
            addininfoUpdates = new AddinInfoView ();
            addininfoUpdates.InstallClicked += OnInstallClicked;
            addininfoUpdates.UninstallClicked += OnUninstallClicked;
            addininfoUpdates.UpdateClicked += OnUpdateClicked;
            addininfoUpdates.EnableDisableClicked += OnEnableDisableClicked;
            eventbox3.Child = addininfoUpdates;

            //			Services.PlaceDialog (this, parent);
            Show ();

            addininfoInstalled.Init (service);
            addininfoGallery.Init (service);

            addinTree.Selection.Mode = SelectionMode.Multiple;
            tree = new AddinTreeWidget (addinTree);
            addinTree.Selection.Changed += OnSelectionChanged;
            tree.VersionVisible = false;

            galleryTreeView.Selection.Mode = SelectionMode.Multiple;
            galleryTree = new AddinTreeWidget (galleryTreeView);
            galleryTree.VersionVisible = false;
            galleryTree.ShowInstalledMarkers = true;
            galleryTreeView.Selection.Changed += OnGallerySelectionChanged;

            updatesTreeView.Selection.Mode = SelectionMode.Multiple;
            updatesTree = new AddinTreeWidget (updatesTreeView);
            updatesTree.VersionVisible = false;
            updatesTree.ShowCategories = false;
            updatesTree.ShowInstalledMarkers = true;
            updatesTreeView.Selection.Changed += OnGallerySelectionChanged;

            //Wiring more buttons
            buttonUpdateAll.Clicked += OnUpdateAll;
            buttonRefreshUpdates.Clicked += OnButtonRefreshClicked;
            buttonRefresh.Clicked += OnButtonRefreshClicked;
            buttonInstallFromFile.Clicked += OnButtonInstallFromFileClicked;
            repoCombo.Changed += OnRepoComboChanged;

            repoStore = new ListStore (typeof(string), typeof(string));
            repoCombo.Model = repoStore;
            CellRendererText crt = new CellRendererText ();
            repoCombo.PackStart (crt, true);
            repoCombo.AddAttribute (crt, "text", 0);
            repoCombo.RowSeparatorFunc = delegate(ITreeModel model, TreeIter iter) {
                string val = (string) model.GetValue (iter, 0);
                return val == "---";
            };

            // Make sure the tree has the focus when switching tabs

            vboxUpdates.FocusChain = new Widget [] { scrolledUpdates, eboxRepoUpdates };
            vboxGallery.FocusChain = new Widget [] { scrolledGallery, eboxRepo };

            // Improve the look of the headers

            HBox tab = new HBox (false, 3);
            tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("plugin-22.png")), false, false, 0);
            installedTabLabel = new Label (Catalog.GetString ("Installed"));
            tab.PackStart (installedTabLabel, true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll ();
            notebook.SetTabLabel (notebook.GetNthPage (0), tab);

            tab = new HBox (false, 3);
            tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("plugin-update-22.png")), false, false, 0);
            updatesTabLabel = new Label (Catalog.GetString ("Updates"));
            tab.PackStart (updatesTabLabel, true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll ();
            notebook.SetTabLabel (notebook.GetNthPage (1), tab);

            tab = new HBox (false, 3);
            tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("update-16.png")), false, false, 0);
            galleryTabLabel = new Label (Catalog.GetString ("Gallery"));
            tab.PackStart (galleryTabLabel, true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll ();
            notebook.SetTabLabel (notebook.GetNthPage (2), tab);

            // Gradient header for the updates and gallery tabs

            HeaderBox hb = new HeaderBox (1, 0, 1, 1);
            hb.SetPadding (6,6,6,6);
            hb.GradientBackround = true;
            hb.Show ();
            hb.Replace (eboxRepo);

            hb = new HeaderBox (1, 0, 1, 1);
            hb.SetPadding (6,6,6,6);
            hb.GradientBackround = true;
            hb.Show ();
            hb.Replace (eboxRepoUpdates);

            InsertFilterEntry ();

            FillRepos ();
            repoCombo.Active = 0;

            LoadAll ();

            ShowAll ();
        }