Source Properties
Each Banshee.Sources.Source object in Banshee has a Properties property that is a Hyena.Data.PropertyStore object. PropertyStore is essentially an eventful generic dictionary that exposes various Get and Set methods.
The Properties property on Source is used to store arbitrary data on a source, and is especially useful for communicating GUI properties at a non-GUI level.
Common Properties
Source Icons
A source's icon is stored in its property store. It can be set in a few different ways:
Icon.Name - can either be a string or an array of strings. The strings are used to resolve the icon pixbuf from the icon theme. If the value is an array of strings, the values in the array are tried from first to last until an icon is resolved.
Example
Properties.SetString ("Icon.Name", "source-playlist");
Properties.SetStringList ("Icon.Name", "go-home", "user-home", "source-library");
Icon.Pixbuf_* - the actual icon data is stored in this pixbuf after it is resolved from the Icon.Name property. This property can be set directly, but it will always be set by the SourceView widget as a cache. Note: the * means that this property is a template. That is, the * will be replaced with the size of the pixbuf stored in the property. For instance, there may be many Icon.Pixbuf_* properties:
-
Icon.Pixbuf_22- 22px cached pixbuf -
Icon.Pixbuf_48- 48px cached pixbuf
Example
Properties.Get<Gdk.Pixbuf> ("Icon.Pixbuf_22");
ResourceAssembly - the System.Reflection.Assembly object that should be used when looking for icons via IconName that are not found in the theme.
Source Messages
Sources can communicate status messages to the user via a number of message properties. These properties will be displayed in a special source message bar below the view of the active source.
Message.Text - The text of the message
Message.Icon.Name - The name of the icon, follows the same conventions as the main source Icon.* properties
Message.CanCose - A boolean value that sets whether or not the message can be closed by the user
Message.Action.Label - Creates an action button the user can click
Message.Action.IsStock - If the action label property is set, this boolean value tells GTK to treat the label as a stock name
Message.Action.NotifyHandler - A property that takes an EventHandler to be raised then the action is invoked
Message.IsSpinning - A boolean value that sets whether or not the icon is overridden by an animated spinner/throbber
Message.IsHidden - A boolean value that sets whether or not the message is hidden; will be set when the close button is clicked
Example
Properties.SetString ("Message.Text", "Hai! I can has your liberry.");
Properties.SetString ("Message.Icon.Name", "source-library");
Properties.SetBoolean ("Message.CanClose", true);
Properties.SetString ("Message.Action.Label", "Try Again");
Properties.Set<EventHandler> ("Message.Action.NotifyHandler", delegate {
Properties.RemoveStartingWith ("Message.");
});





