public CodeFormattingPanelWidget(CodeFormattingPanel panel, OptionsDialog dialog)
        {
            this.Build();
            this.panel  = panel;
            this.dialog = dialog;

            store      = new Gtk.ListStore(typeof(MimeTypePanelData), typeof(Gdk.Pixbuf), typeof(string));
            tree.Model = store;

            boxButtons.Visible = panel.DataObject is PolicySet;
            Gtk.CellRendererText   crt = new Gtk.CellRendererText();
            Gtk.CellRendererPixbuf crp = new Gtk.CellRendererPixbuf();

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn();
            col.Title = GettextCatalog.GetString("File Type");
            col.PackStart(crp, false);
            col.PackStart(crt, true);
            col.AddAttribute(crp, "pixbuf", 1);
            col.AddAttribute(crt, "text", 2);
            tree.AppendColumn(col);
            store.SetSortColumnId(2, Gtk.SortType.Ascending);

            CellRendererComboBox comboCell = new CellRendererComboBox();

            comboCell.Changed += OnPolicySelectionChanged;
            Gtk.TreeViewColumn polCol = tree.AppendColumn(GettextCatalog.GetString("Policy"), comboCell, new Gtk.TreeCellDataFunc(OnSetPolicyData));

            tree.Selection.Changed += delegate
            {
                Gtk.TreeIter it;
                tree.Selection.GetSelected(out it);
                Gtk.TreeViewColumn ccol;
                Gtk.TreePath       path;
                tree.GetCursor(out path, out ccol);
                if (ccol == polCol)
                {
                    tree.SetCursor(path, ccol, true);
                }
            };

            Fill();
            UpdateButtons();

            tree.Selection.Changed += delegate
            {
                UpdateButtons();
            };
        }
		public CodeFormattingPanelWidget (CodeFormattingPanel panel, OptionsDialog dialog)
		{
			this.Build();
			this.panel = panel;
			this.dialog = dialog;
			
			store = new Gtk.ListStore (typeof(MimeTypePanelData), typeof(Gdk.Pixbuf), typeof(string));
			tree.Model = store;
			
			boxButtons.Visible = panel.DataObject is PolicySet;
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			Gtk.CellRendererPixbuf crp = new Gtk.CellRendererPixbuf ();
			
			Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("File Type");
			col.PackStart (crp, false);
			col.PackStart (crt, true);
			col.AddAttribute (crp, "pixbuf", 1);
			col.AddAttribute (crt, "text", 2);
			tree.AppendColumn (col);
			store.SetSortColumnId (2, Gtk.SortType.Ascending);
			
			CellRendererComboBox comboCell = new CellRendererComboBox ();
			comboCell.Changed += OnPolicySelectionChanged;
			Gtk.TreeViewColumn polCol = tree.AppendColumn (GettextCatalog.GetString ("Policy"), comboCell, new Gtk.TreeCellDataFunc (OnSetPolicyData));
			
			tree.Selection.Changed += delegate {
				Gtk.TreeIter it;
				tree.Selection.GetSelected (out it);
				Gtk.TreeViewColumn ccol;
				Gtk.TreePath path;
				tree.GetCursor (out path, out ccol);
				if (ccol == polCol)
					tree.SetCursor (path, ccol, true);
			};

			Fill ();
			UpdateButtons ();
			
			tree.Selection.Changed += delegate {
				UpdateButtons ();
			};
		}