import gtk.Main;
import gtk.MainWindow;
import gtk.ListStore;
import gtk.TreeView;
import gtk.CellRendererText;
import gtk.TreeViewColumn;
import gtk.CellRendererSpin;
import gtk.TreePath;
import gtk.TreeIter;
import gtk.Adjustment;
import gobject.Value;
import std.conv;
class MyWindow: MainWindow
{
this()
{
super("Cell Renderer Spin Example");
setDefaultSize(200, 200);
auto model = new ListStore([GType.STRING, GType.INT]);
void addFruit(string isim, int adet)
{
auto iterator = model.createIter();
model.setValue(iterator, 0, isim);
model.setValue(iterator, 1, adet);
}
addFruit("Oranges", 5);
addFruit("Apples", 4);
addFruit("Bananas", 2);
auto view = new TreeView(model);
auto rendererText = new CellRendererText();
auto columnText = new TreeViewColumn("Fruit", rendererText, "text", 0);
view.appendColumn(columnText);
auto rendererSpin = new CellRendererSpin();
rendererSpin.addOnEdited((path, newValue, rendererText)
{onAmountEdited(path, newValue, rendererText, model);});
rendererSpin.setProperty("editable", true);
auto adjustment = new Adjustment(0, 0, 100, 1, 10, 0);
auto adjustment_ = new Value();
adjustment_.init(adjustment.getType());
adjustment_.setObject(adjustment);
rendererSpin.setProperty("adjustment", adjustment_);
auto columnSpin = new TreeViewColumn("Amount", rendererSpin, "text", 1);
view.appendColumn(columnSpin);
add(view);
showAll();
}
void onAmountEdited(string path, string newValue, CellRendererText rendererText, ListStore model)
{
auto path_ = new TreePath(path);
auto iterator = new TreeIter(model, path_);
model.setValue(iterator, 1, to!int(newValue));
}
}
void main(string[] args)
{
Main.init(args);
auto myWindow = new MyWindow();
Main.run();
}
When I try to compile and run this program I get warning messages like this.
GLib-GObject-CRITICAL **: gobjectnotify: assertion `GISOBJECT (object)' failed
GLib-GObject-WARNING **: gobjectnotify: object class
GtkIMContextCedillaTranslit' has no property named
accessible-value'
Any ideas?