Пример #1
0
        void BuildContent()
        {
            foreach (var col in WelcomePageBranding.Content.Root.Elements("Column"))
            {
                var colWidget = new Gtk.VBox(false, WelcomePageBranding.Spacing);
                var widthAtt  = col.Attribute("minWidth");
                if (widthAtt != null)
                {
                    int width = (int)widthAtt;
                    colWidget.SizeRequested += delegate(object o, SizeRequestedArgs args)
                    {
                        var req = args.Requisition;
                        req.Width        = Math.Max(req.Width, width);
                        args.Requisition = req;
                    };
                }
                colBox.PackStart(colWidget, false, false, 0);

                foreach (var el in col.Elements())
                {
                    string title = (string)(el.Attribute("title") ?? el.Attribute("_title"));
                    if (!string.IsNullOrEmpty(title))
                    {
                        title = GettextCatalog.GetString(title);
                    }

                    Widget w;
                    switch (el.Name.LocalName)
                    {
                    case "Links":
                        w = new WelcomePageLinksList(el);
                        break;

                    case "RecentProjects":
                        w = new WelcomePageRecentProjectsList(el);
                        break;

                    case "NewsFeed":
                        w = new WelcomePageNewsFeed(el);
                        break;

                    default:
                        throw new InvalidOperationException("Unknown welcome page element '" + el.Name + "'");
                    }

                    AddSection(colWidget, title, w);
                }
            }
        }
Пример #2
0
		void BuildContent ()
		{
			foreach (var col in WelcomePageBranding.Content.Root.Elements ("Column")) {
				var colWidget = new Gtk.VBox (false, WelcomePageBranding.Spacing);
				var widthAtt = col.Attribute ("minWidth");
				if (widthAtt != null) {
					int width = (int) widthAtt;
					colWidget.SizeRequested += delegate (object o, SizeRequestedArgs args) {
						var req = args.Requisition;
						req.Width = Math.Max (req.Width, width);
						args.Requisition = req;
					};
				}
				colBox.PackStart (colWidget, false, false, 0);
				
				foreach (var el in col.Elements ()) {
					string title = (string) (el.Attribute ("title") ?? el.Attribute ("_title"));
					if (!string.IsNullOrEmpty (title))
						title = GettextCatalog.GetString (title);
					
					Widget w;
					switch (el.Name.LocalName) {
					case "Links":
						w = new WelcomePageLinksList (el);
						break;
					case "RecentProjects":
						w = new WelcomePageRecentProjectsList (el);
						break;
					case "NewsFeed":
						w = new WelcomePageNewsFeed (el);
						break;
					default:
						throw new InvalidOperationException ("Unknown welcome page element '" + el.Name + "'");
					}
					
					AddSection (colWidget, title, w);
				}
			}
		}