public PackageDetails (Package package) { this.Build(); package.ParsePackage (); Gtk.CellRendererText textRenderer = new Gtk.CellRendererText (); requiresTreeView.Model = requiresStore; requiresTreeView.AppendColumn ("Requires", textRenderer, "text", 0); requiresTreeView.HeadersVisible = false; libPathsTreeView.Model = libPathsStore; libPathsTreeView.AppendColumn ("LibPaths", textRenderer, "text", 0); libPathsTreeView.HeadersVisible = false; libsTreeView.Model = libsStore; libsTreeView.AppendColumn ("Libs", textRenderer, "text", 0); libsTreeView.HeadersVisible = false; cflagsTreeView.Model = cflagsStore; cflagsTreeView.AppendColumn ("CFlags", textRenderer, "text", 0); cflagsTreeView.HeadersVisible = false; nameLabel.Text = package.Name; descriptionLabel.Text = package.Description; versionLabel.Text = package.Version; foreach (string req in package.Requires) requiresStore.AppendValues (req); foreach (string libpath in package.LibPaths) libPathsStore.AppendValues (libpath); foreach (string lib in package.Libs) libsStore.AppendValues (lib); foreach (string cflag in package.CFlags) cflagsStore.AppendValues (cflag); }
public EditPackagesDialog(CProject project) { this.Build(); this.project = project; selectedPackages.Project = project; selectedPackages.AddRange (project.Packages); Gtk.CellRendererText textRenderer = new Gtk.CellRendererText (); CellRendererImage pixbufRenderer = new CellRendererImage (); pixbufRenderer.StockId = "md-package"; normalPackageListStore.DefaultSortFunc = NormalPackageCompareNodes; projectPackageListStore.DefaultSortFunc = ProjectPackageCompareNodes; selectedPackageListStore.DefaultSortFunc = SelectedPackageCompareNodes; normalPackageListStore.SetSortColumnId (NormalPackageNameID, Gtk.SortType.Ascending); projectPackageListStore.SetSortColumnId (ProjectPackageNameID, Gtk.SortType.Ascending); selectedPackageListStore.SetSortColumnId (SelectedPackageNameID, Gtk.SortType.Ascending); normalPackageTreeView.SearchColumn = NormalPackageNameID; projectPackageTreeView.SearchColumn = ProjectPackageNameID; selectedPackageTreeView.SearchColumn = SelectedPackageNameID; // <!-- Normal packages --> Gtk.CellRendererToggle normalPackageToggleRenderer = new Gtk.CellRendererToggle (); normalPackageToggleRenderer.Activatable = true; normalPackageToggleRenderer.Toggled += OnNormalPackageToggled; normalPackageToggleRenderer.Xalign = 0; Gtk.TreeViewColumn normalPackageColumn = new Gtk.TreeViewColumn (); normalPackageColumn.Title = "Package"; normalPackageColumn.PackStart (pixbufRenderer, false); normalPackageColumn.PackStart (textRenderer, true); normalPackageColumn.AddAttribute (textRenderer, "text", NormalPackageNameID); normalPackageTreeView.Model = normalPackageListStore; normalPackageTreeView.HeadersVisible = true; normalPackageTreeView.AppendColumn ("", normalPackageToggleRenderer, "active", NormalPackageToggleID); normalPackageTreeView.AppendColumn (normalPackageColumn); normalPackageTreeView.AppendColumn ("Version", textRenderer, "text", NormalPackageVersionID); // <!-- Project packages --> Gtk.CellRendererToggle projectPackageToggleRenderer = new Gtk.CellRendererToggle (); projectPackageToggleRenderer.Activatable = true; projectPackageToggleRenderer.Toggled += OnProjectPackageToggled; projectPackageToggleRenderer.Xalign = 0; Gtk.TreeViewColumn projectPackageColumn = new Gtk.TreeViewColumn (); projectPackageColumn.Title = "Package"; projectPackageColumn.PackStart (pixbufRenderer, false); projectPackageColumn.PackStart (textRenderer, true); projectPackageColumn.AddAttribute (textRenderer, "text", ProjectPackageNameID); projectPackageTreeView.Model = projectPackageListStore; projectPackageTreeView.HeadersVisible = true; projectPackageTreeView.AppendColumn ("", projectPackageToggleRenderer, "active", ProjectPackageToggleID); projectPackageTreeView.AppendColumn (projectPackageColumn); projectPackageTreeView.AppendColumn ("Version", textRenderer, "text", ProjectPackageVersionID); // <!-- Selected packages --> Gtk.TreeViewColumn selectedPackageColumn = new Gtk.TreeViewColumn (); selectedPackageColumn.Title = "Package"; selectedPackageColumn.PackStart (pixbufRenderer, false); selectedPackageColumn.PackStart (textRenderer, true); selectedPackageColumn.AddAttribute (textRenderer, "text", SelectedPackageNameID); selectedPackageTreeView.Model = selectedPackageListStore; selectedPackageTreeView.HeadersVisible = true; selectedPackageTreeView.AppendColumn (selectedPackageColumn); selectedPackageTreeView.AppendColumn ("Version", textRenderer, "text", SelectedPackageVersionID); // Fill up the project tree view packagesOfProjects = GetPackagesOfProjects (project); foreach (Package p in packagesOfProjects) { if (p.Name == project.Name) continue; packages.Add (p); string version = p.Version; bool inProject = selectedPackages.Contains (p); if (!IsPackageInStore (projectPackageListStore, p.Name, version, ProjectPackageNameID, ProjectPackageVersionID)) { projectPackageListStore.AppendValues (inProject, p.Name, version); if (inProject) selectedPackageListStore.AppendValues (p.Name, version); } } // Fill up the normal tree view foreach (string dir in ScanDirs ()) { if (Directory.Exists (dir)) { DirectoryInfo di = new DirectoryInfo (dir); FileInfo[] availablePackages = di.GetFiles ("*.pc"); foreach (FileInfo f in availablePackages) { if (!IsValidPackage (f.FullName)) { continue; } Package package = new Package (f.FullName); packages.Add (package); string name = package.Name; string version = package.Version; bool inProject = selectedPackages.Contains (package); if (!IsPackageInStore (normalPackageListStore, name, version, NormalPackageNameID, NormalPackageVersionID)) { normalPackageListStore.AppendValues (inProject, name, version); if (inProject) selectedPackageListStore.AppendValues (name, version); } } } } }
private List<Package> GetPackagesOfProjects (Project project) { List<Package> packages = new List<Package>(); Package package; foreach (SolutionFolderItem c in project.ParentFolder.Items) { if (null != c && c is CProject) { CProject cproj = (CProject)c; CProjectConfiguration conf = (CProjectConfiguration)cproj.GetConfiguration (IdeApp.Workspace.ActiveConfiguration); if (conf.CompileTarget != CBinding.CompileTarget.Bin) { cproj.WriteMDPkgPackage (conf.Selector); package = new Package (cproj); packages.Add (package); } } } return packages; }
public ProjectPackageEventArgs(CProject project, Package package) { this.project = project; this.package = package; }