Example #1
0
        public static void LoadIcon(this Gtk.TreeStore treeStore, Gtk.TreeIter iter, int column, string iconId, Gtk.IconSize size)
        {
            var ainfo = animatedTreeStoreIconImages.Select(a => (AnimatedTreeStoreIconInfo)a.Target).FirstOrDefault(a => a != null && a.TreeStore == treeStore && a.Iter.Equals(iter) && a.Column == column);

            if (ainfo != null)
            {
                if (ainfo.IconId == iconId)
                {
                    return;
                }
                UnregisterTreeAnimation(ainfo);
            }
            if (iconId == null)
            {
                treeStore.SetValue(iter, column, CellRendererImage.NullImage);
            }
            else if (IsAnimation(iconId, size))
            {
                var anim = GetAnimatedIcon(iconId);
                ainfo = new AnimatedTreeStoreIconInfo(treeStore, iter, column, anim, iconId);
                animatedTreeStoreIconImages.Add(new WeakReference(ainfo));
            }
            else
            {
                treeStore.SetValue(iter, column, ImageService.GetIcon(iconId));
            }
        }
Example #2
0
 static void UnregisterTreeAnimation(AnimatedTreeStoreIconInfo ainfo)
 {
     ainfo.Dispose();
     animatedTreeStoreIconImages.RemoveAll(a => (AnimatedTreeStoreIconInfo)a.Target == ainfo);
 }
		static void UnregisterTreeAnimation (AnimatedTreeStoreIconInfo ainfo)
		{
			ainfo.Dispose ();
			animatedTreeStoreIconImages.RemoveAll (a => (AnimatedTreeStoreIconInfo)a.Target == ainfo);
		}
		public static void LoadIcon (this Gtk.TreeStore treeStore, Gtk.TreeIter iter, int column, string iconId, Gtk.IconSize size)
		{
			var ainfo = animatedTreeStoreIconImages.Select (a => (AnimatedTreeStoreIconInfo)a.Target).FirstOrDefault (a => a != null && a.TreeStore == treeStore && a.Iter.Equals (iter) && a.Column == column);
			if (ainfo != null) {
				if (ainfo.IconId == iconId)
					return;
				UnregisterTreeAnimation (ainfo);
			}
			if (iconId == null) {
				treeStore.SetValue (iter, column, CellRendererImage.NullImage);
			} else if (IsAnimation (iconId, size)) {
				var anim = GetAnimatedIcon (iconId);
				ainfo = new AnimatedTreeStoreIconInfo (treeStore, iter, column, anim, iconId);
				animatedTreeStoreIconImages.Add (new WeakReference (ainfo));
			} else {
				treeStore.SetValue (iter, column, ImageService.GetIcon (iconId));
			}
		}