IsInternalLibrary() публичный Метод

public IsInternalLibrary ( string lib ) : bool
lib string
Результат bool
        public void LoadWidgets(ProjectBackend project)
        {
            if (project == null)
            {
                box.Hide();
                return;
            }

            box.Show();

            foreach (PaletteGroup g in groups.Values)
            {
                box.Remove(g);
                g.Destroy();
            }

            groups.Clear();

            foreach (string[] grp in visibleGroups)
            {
                AddOrGetGroup(grp[0], grp[1]);
            }

            ArrayList classes = new ArrayList();

            if (libraries == null)
            {
                foreach (ClassDescriptor klass in Registry.AllClasses)
                {
                    if (klass.SupportsGtkVersion(project.TargetGtkVersion))
                    {
                        classes.Add(klass);
                    }
                }
            }
            else if (project != null)
            {
                foreach (WidgetLibrary lib in libraries)
                {
                    bool isInternalLib = project.IsInternalLibrary(lib.Name);
                    foreach (ClassDescriptor cd in lib.AllClasses)
                    {
                        if (!cd.Deprecated && cd.Category.Length > 0 && (isInternalLib || !cd.IsInternal) && cd.SupportsGtkVersion(project.TargetGtkVersion))
                        {
                            classes.Add(cd);
                        }
                    }
                }
            }

            classes.Sort(this);

            foreach (ClassDescriptor klass in classes)
            {
                if (!groups.Contains(klass.Category))
                {
                    continue;
                }

                WidgetFactory factory;
                if (klass.Category == "window")
                {
                    factory = new WindowFactory(project, klass);
                }
                else
                {
                    factory = new WidgetFactory(project, klass);
                }

                AddOrGetGroup(klass.Category).Append(factory);
            }

            if (localActionsBox != null)
            {
                localActionsBox.Destroy();
            }
            if (globalActionsBox != null)
            {
                globalActionsBox.Destroy();
            }

            PaletteGroup widgetGroup = AddOrGetGroup("actions", Catalog.GetString("Actions"));

            localActionsBox  = new ActionGroupBox();
            globalActionsBox = new ActionGroupBox();
            widgetGroup.Append(localActionsBox);
            widgetGroup.Append(globalActionsBox);

            if (project != null)
            {
                widgetGroup.Sensitive = true;
                localActionsBox.SetActionGroups(selection != null ? selection.LocalActionGroups : null);
                globalActionsBox.SetActionGroups(project.ActionGroups);
            }
            else
            {
                widgetGroup.Sensitive = false;
                localActionsBox.SetActionGroups(null);
                globalActionsBox.SetActionGroups(null);
            }

            // This is a workaround. In looks like the palette is not correctly
            // redrawn if it is rebuilt while it is not visible (the dock is hidden in MD).
            GLib.Idle.Add(delegate
            {
                ShowAll();
                return(false);
            });
        }
Пример #2
0
		public void LoadWidgets (ProjectBackend project)
		{
			if (project == null) {
				box.Hide ();
				return;
			}
			
			box.Show ();
			
			foreach (PaletteGroup g in groups.Values) {
				box.Remove (g);
				g.Destroy ();
			}
				
			groups.Clear ();
			
			foreach (string[] grp in visibleGroups)
				AddOrGetGroup (grp[0], grp[1]);

			ArrayList classes = new ArrayList ();
			if (libraries == null) {
				foreach (ClassDescriptor klass in Registry.AllClasses)
					if (klass.SupportsGtkVersion (project.TargetGtkVersion))
					    classes.Add (klass);
			} else if (project != null) {
				foreach (WidgetLibrary lib in libraries) {
					bool isInternalLib = project.IsInternalLibrary (lib.Name);
					foreach (ClassDescriptor cd in lib.AllClasses) {
						if (!cd.Deprecated && cd.Category.Length > 0 && (isInternalLib || !cd.IsInternal) && cd.SupportsGtkVersion (project.TargetGtkVersion))
							classes.Add (cd);
					}
				}
			}
			
			classes.Sort (this);

			foreach (ClassDescriptor klass in classes) {

				if (!groups.Contains (klass.Category))
					continue;
					
				WidgetFactory factory;
				if (klass.Category == "window")
					factory = new WindowFactory (project, klass);
				else
					factory = new WidgetFactory (project, klass);

				AddOrGetGroup(klass.Category).Append (factory);
			}

			if (localActionsBox != null)
				localActionsBox.Destroy ();
			if (globalActionsBox != null)
				globalActionsBox.Destroy ();
				
			PaletteGroup widgetGroup = AddOrGetGroup ("actions", Catalog.GetString ("Actions"));
			localActionsBox = new ActionGroupBox ();
			globalActionsBox = new ActionGroupBox ();
			widgetGroup.Append (localActionsBox);
			widgetGroup.Append (globalActionsBox);
			
			if (project != null) {
				widgetGroup.Sensitive = true;
				localActionsBox.SetActionGroups (selection != null ? selection.LocalActionGroups : null);
				globalActionsBox.SetActionGroups (project.ActionGroups);
			} else {
				widgetGroup.Sensitive = false;
				localActionsBox.SetActionGroups (null);
				globalActionsBox.SetActionGroups (null);
			}
			
			// This is a workaround. In looks like the palette is not correctly
			// redrawn if it is rebuilt while it is not visible (the dock is hidden in MD).
			GLib.Idle.Add (delegate {
				ShowAll ();
				return false;
			});
		}