public BatteryMonitorAbstractItem (AbstractDockItemProvider owner)
		{
			this.owner = owner;
			DockServices.System.BatteryStateChanged += HandleBatteryStateChanged;
			
			timer = GLib.Timeout.Add (20 * 1000, UpdateBattStat);
		}
		public DockletTile (string addinID, AbstractDockItemProvider provider)
		{
			Addin = PluginManager.AddinFromID (addinID);
			Provider = provider;
			
			SubDescriptionTitle = Catalog.GetString ("Author");
			Enabled = Addin.Enabled;
			
			Name = Addin.Name;
			Description = Addin.Description.Description;
			SubDescriptionText = Addin.Description.Author;
			
			Icon = PluginManager.DefaultPluginIcon;
			
			if (PluginManager.AddinMetadata [Addin].ContainsKey ("icon")) {
				if (PluginManager.AddinMetadata [Addin] ["icon"].Contains ("@"))
					ForcePixbuf = DockServices.Drawing.LoadIcon (PluginManager.AddinMetadata [Addin] ["icon"], 128, -1);
				else
					Icon = string.Format ("{0};;{1}", PluginManager.AddinMetadata [Addin] ["icon"], Icon);
			}
				
			HelpButton = new Gtk.Button ();
			HelpButton.Image = new Gtk.Image (Gtk.Stock.Help, Gtk.IconSize.SmallToolbar);
			HelpButton.Clicked += HandleHelpButtonClicked;
			
			ConfigButton = new Gtk.Button ();
			ConfigButton.Image = new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.SmallToolbar);
			ConfigButton.Clicked += HandleConfigButtonClicked;
			
			UpButton = new Gtk.Button ();
			UpButton.Clicked += HandleUpButtonClicked;
			
			DownButton = new Gtk.Button ();
			DownButton.Clicked += HandleDownButtonClicked;
			
			UpdateInfo ();
			
			if (ConfigurationWindow.Instance.ActiveDock.Preferences.IsVertical) {
				UpButton.Image = new Gtk.Image (Gtk.Stock.GoUp, Gtk.IconSize.SmallToolbar);
				DownButton.Image = new Gtk.Image (Gtk.Stock.GoDown, Gtk.IconSize.SmallToolbar);
				UpButton.TooltipMarkup = Catalog.GetString ("Move this docklet up on the selected dock");
				DownButton.TooltipMarkup = Catalog.GetString ("Move this docklet down on the selected dock");
			} else {
				UpButton.Image = new Gtk.Image (Gtk.Stock.GoBack, Gtk.IconSize.SmallToolbar);
				DownButton.Image = new Gtk.Image (Gtk.Stock.GoForward, Gtk.IconSize.SmallToolbar);
				UpButton.TooltipMarkup = Catalog.GetString ("Move this docklet left on the selected dock");
				DownButton.TooltipMarkup = Catalog.GetString ("Move this docklet right on the selected dock");
			}
			ConfigButton.TooltipMarkup = Catalog.GetString ("Configure this docklet");
			HelpButton.TooltipMarkup = Catalog.GetString ("About this docklet");
			AddButtonTooltip = Catalog.GetString ("Add this docklet to the selected dock");
			RemoveButtonTooltip = Catalog.GetString ("Remove this docklet from the selected dock");
		}
		public ProxyDockItem (AbstractDockItemProvider provider, IPreferences prefs)
		{
			StripMnemonics = false;
			
			Provider = provider;
			Provider.ItemsChanged += HandleProviderItemsChanged;
			this.prefs = prefs;
			
			if (prefs == null) {
				currentPos = 0;
			} else {
				currentPos = prefs.Get<int> ("CurrentIndex", 0);
				
				if (CurrentPosition >= Provider.Items.Count ()) 
					CurrentPosition = 0;
			}
			
			ItemChanged ();
		}
        public ProxyDockItem(AbstractDockItemProvider provider, IPreferences prefs)
        {
            StripMnemonics = false;

            Provider = provider;
            Provider.ItemsChanged += HandleProviderItemsChanged;
            this.prefs             = prefs;

            if (prefs == null)
            {
                currentPos = 0;
            }
            else
            {
                currentPos = prefs.Get <int> ("CurrentIndex", 0);

                if (CurrentPosition >= Provider.Items.Count())
                {
                    CurrentPosition = 0;
                }
            }

            ItemChanged();
        }
		public BatteryMonitorProcItem (AbstractDockItemProvider owner) : base(owner)
		{
		}
		public ProxyDockItem (AbstractDockItemProvider provider) : this (provider, null)
		{
		}
		public override void Dispose ()
		{
			Addin = null;
			Provider = null;
			
			ConfigButton.Clicked -= HandleConfigButtonClicked;
			ConfigButton.Dispose ();
			ConfigButton.Destroy ();
			UpButton.Clicked -= HandleUpButtonClicked;
			UpButton.Dispose ();
			UpButton.Destroy ();
			DownButton.Clicked -= HandleDownButtonClicked;
			DownButton.Dispose ();
			DownButton.Destroy ();
			HelpButton.Clicked -= HandleHelpButtonClicked;
			HelpButton.Dispose ();
			HelpButton.Destroy ();
			
			base.Dispose ();
		}
		public override void OnActiveChanged ()
		{
			if (ConfigurationWindow.Instance.ActiveDock == null)
				return;
			
			Enabled = !Enabled;
			
			if (Enabled) {
				Provider = PluginManager.Enable (Addin);
				ConfigurationWindow.Instance.ActiveDock.Preferences.AddProvider (Provider);
			} else {
				ConfigurationWindow.Instance.ActiveDock.Preferences.RemoveProvider (Provider);
				Provider = null;
			}
			
			UpdateInfo ();
		}
 public ProxyDockItem(AbstractDockItemProvider provider) : this(provider, null)
 {
 }
		void UnregisterItemProvider (AbstractDockItemProvider provider)
		{
			provider.ItemsChanged -= ProviderItemsChanged;
			
			foreach (AbstractDockItem item in provider.Items)
				UnregisterItem (item);
			
			provider.Unregistered ();
			
			UpdateMaxIconSize ();
			DelayedSetSizeRequest ();
		}