Ejemplo n.º 1
0
        void RecentFilesChanged(object sender, EventArgs e)
        {
            //this can get called by async dispatch after the widget is destroyed
            if (destroyed)
            {
                return;
            }

            foreach (var c in Children)
            {
                this.Remove(c);
                c.Destroy();
            }

            //TODO: pinned files
            foreach (var recent in DesktopService.RecentFiles.GetProjects().Take(itemCount))
            {
                var filename = recent.FileName;
                var accessed = recent.TimeStamp;
                var button   = new WelcomePageLinkButton(recent.DisplayName, "project://" + filename);
                button.Ellipsize = Pango.EllipsizeMode.Middle;
                //FIXME: update times as needed. currently QueryTooltip causes crashes on Windows
                //button.QueryTooltip += delegate (object o, QueryTooltipArgs args) {
                //	args.Tooltip.Text = filename + "\n" + TimeSinceEdited (accessed);
                //	args.RetVal = true;
                //};
                //button.HasTooltip = true;
                button.TooltipText = filename + "\n" + TimeSinceEdited(accessed);
                button.Icon        = GetIcon(filename);
                this.PackStart(button, false, false, 0);
            }

            this.ShowAll();
        }
        public WelcomePageLinksList(XElement el)
        {
            IconSize iconSize    = IconSize.Menu;
            var      iconSizeAtt = el.Attribute("iconSize");

            if (iconSizeAtt != null)
            {
                iconSize = (IconSize)Enum.Parse(typeof(IconSize), (string)iconSizeAtt);
            }

            var homogeneousAtt = el.Attribute("homogeneous");

            if (homogeneousAtt != null)
            {
                this.Homogeneous = (bool)homogeneousAtt;
            }

            foreach (var child in el.Elements())
            {
                if (child.Name != "Link")
                {
                    throw new InvalidOperationException("Unexpected child '" + child.Name + "'");
                }
                var button = new WelcomePageLinkButton(child, iconSize);
                this.PackStart(button, true, false, 0);
            }
        }
Ejemplo n.º 3
0
		void LoadNews ()
		{
			//can get called from async handler
			if (destroyed)
				return;
			
			foreach (var c in Children) {
				this.Remove (c);
				c.Destroy ();
			}
			
			try {
				var news = GetNewsXml ();
				if (news.FirstNode == null) {
					var label = new Label (GettextCatalog.GetString ("No news found.")) { Xalign = 0, Xpad = 6 };
					this.PackStart (label, true, false, 0);
				} else {
					foreach (var child in news.Elements ()) {
						if (child.Name != "link" && child.Name != "Link")
							throw new Exception ("Unexpected child '" + child.Name + "'");
						var button = new WelcomePageLinkButton (child);
						this.PackStart (button, true, false, 0);
					}
				}
			} catch (Exception ex) {
				LoggingService.LogWarning ("Error loading welcome page news.", ex);
			}
			this.ShowAll ();
		}
		void RecentFilesChanged (object sender, EventArgs e)
		{
			//this can get called by async dispatch after the widget is destroyed
			if (destroyed)
				return;
			
			foreach (var c in Children) {
				this.Remove (c);
				c.Destroy ();
			}
			
			//TODO: pinned files
			foreach (var recent in DesktopService.RecentFiles.GetProjects ().Take (itemCount)) {
				var filename = recent.FileName;
				var accessed = recent.TimeStamp;
				var button = new WelcomePageLinkButton (recent.DisplayName, "project://" + filename);
				button.Ellipsize = Pango.EllipsizeMode.Middle;
				//FIXME: update times as needed. currently QueryTooltip causes crashes on Windows
				//button.QueryTooltip += delegate (object o, QueryTooltipArgs args) {
				//	args.Tooltip.Text = filename + "\n" + TimeSinceEdited (accessed);
				//	args.RetVal = true;
				//};
				//button.HasTooltip = true;
				button.TooltipText = filename + "\n" + TimeSinceEdited (accessed);
				button.Icon = GetIcon (filename);
				this.PackStart (button, false, false, 0);
			}
			
			this.ShowAll ();
		}
Ejemplo n.º 5
0
		public WelcomePageLinksList (XElement el)
		{
			IconSize iconSize = IconSize.Menu;
			var iconSizeAtt = el.Attribute ("iconSize");
			if (iconSizeAtt != null) {
				iconSize = (IconSize) Enum.Parse (typeof (IconSize), (string) iconSizeAtt);
			}
			
			var homogeneousAtt = el.Attribute ("homogeneous");
			if (homogeneousAtt != null)
				this.Homogeneous = (bool) homogeneousAtt;
			
			foreach (var child in el.Elements ()) {
				if (child.Name != "Link")
					throw new InvalidOperationException ("Unexpected child '" + child.Name + "'");
				var button = new WelcomePageLinkButton (child, iconSize);
				this.PackEnd (button, true, false, 0);
			}
		}
Ejemplo n.º 6
0
        void LoadNews()
        {
            //can get called from async handler
            if (destroyed)
            {
                return;
            }

            foreach (var c in Children)
            {
                this.Remove(c);
                c.Destroy();
            }

            try {
                var news = GetNewsXml();
                if (news.FirstNode == null)
                {
                    var label = new Label(GettextCatalog.GetString("No news found."))
                    {
                        Xalign = 0, Xpad = 6
                    };
                    this.PackStart(label, true, false, 0);
                }
                else
                {
                    foreach (var child in news.Elements())
                    {
                        if (child.Name != "link" && child.Name != "Link")
                        {
                            throw new Exception("Unexpected child '" + child.Name + "'");
                        }
                        var button = new WelcomePageLinkButton(child);
                        this.PackStart(button, true, false, 0);
                    }
                }
            } catch (Exception ex) {
                LoggingService.LogWarning("Error loading welcome page news.", ex);
            }
            this.ShowAll();
        }