I was looking this topic.
https://forum.gtkd.org/groups/GtkD/thread/525/
When I try to compile this sample code:
import gtk.Main;
import gtk.MainWindow;
import gtk.Box;
import gtk.Entry;
import gtk.EditableIF;
import gtk.TreeModelFilter;
import gtk.TreeView;
import gtk.HBox;
import gtk.VBox;
import gtk.Label;
import gtk.ListStore;
import gtk.TreeViewColumn;
import gtk.CellRendererText;
import gtk.TreeModel;
import gtk.TreeIter;
import std.conv;
import std.stdio;
class MyWindow: MainWindow
{
Box mainBox;
Entry filterEntry;
TreeModelFilter filter;
TreeIter iter;
this()
{
super("TreeView Example");
setSizeRequest(500, 200);
filterEntry = new Entry();
auto filterLabel= new Label("Artist search");
auto tree = new TreeView();
auto box = new VBox(false, 0);
auto dataModel = new ListStore([GType.STRING, GType.STRING]);
auto artistColumn = new TreeViewColumn("Artist", new
CellRendererText(), "text", 0);
tree.appendColumn(artistColumn);
auto songColumn = new TreeViewColumn("Song title", new
CellRendererText(), "text", 1);
tree.appendColumn(songColumn);
iter = dataModel.createIter();
dataModel.setValue(iter, 0, "This is a test");
dataModel.setValue(iter, 1, "Sample song");
iter = dataModel.createIter();
dataModel.setValue(iter, 0, "This is a test");
dataModel.setValue(iter, 1, "Another song");
iter = dataModel.createIter();
dataModel.setValue(iter, 0, "Another artist");
dataModel.setValue(iter, 1, "Test song");
filter = new TreeModelFilter(dataModel, null);
filter.setVisibleFunc(cast(GtkTreeModelFilterVisibleFunc)
&filterTree, null, null);
tree.setModel(filter);
auto mainBox = new HBox(false, 0);
mainBox.packStart(filterLabel, false, false, 5);
mainBox.packStart(filterEntry, true, true, 5);
box.packStart(mainBox, false, false, 5);
box.packStart(tree, true, true, 5);
add(box);
showAll();
}
static extern(C) int filterTree(GtkTreeModel* gtkModel,
GtkTreeIter* gtkIter, void* data)
{
auto model1 = new TreeModel(gtkModel, false);
auto it1 = new TreeIter(gtkIter, false);
string artistName = to!string(model1.getValue(it1, 0));
return true;
}
void onFilterEntryTextChanged(EditableIF filterEntry)
{
filter.refilter();
}
// void onFilterEntryTextChanged(ParamSpec param, ObjectG object)
// {
// filter.refilter();
// }
}
void main(string[] args)
{
Main.init(args);
new MyWindow();
Main.run();
}
I get a lot of undefined reference to errors like this:
dmd -O -m64 -I../import -L-l:libgtkd-3.a -L-L../lib64 test.d -oftest
../lib64/libgtkd-3.a(VBox.o): In function_THUNK0':<br>generated/gtkd/gtk/VBox.d:(.text+0x8): undefined reference to
D3gtk3Box3Box9mixin2019getOrientableStructMFbZPS4gtkc8gtktypes13GtkOrientable'<br>../lib64/libgtkd-3.a(VBox.o): In function `THUNK2':
generated/gtkd/gtk/VBox.d:(.text+0x28): undefined reference to_D3gtk3Box3Box9__mixin2014getOrientationMFZE4gtkc8gtktypes14GtkOrientation'<br>../lib64/libgtkd-3.a(VBox.o): In function
THUNK3':<br>generated/gtkd/gtk/VBox.d:(.text+0x38): undefined reference to `D3gtk3Box3Box9mixin2014setOrientationMFE4gtkc8gtktypes14GtkOrientationZv'<br>../lib64/libgtkd-3.a(VBox.o): In function `_THUNK4':<br>generated/gtkd/gtk/VBox.d:(.text+0x45): undefined reference to `_D3gtk6Widget6Widget10mixin74820getImplementorStructMFbZPS4gtkc8atktypes14AtkImplementor'
../lib64/libgtkd-3.a(VBox.o): In function_THUNK6':<br>generated/gtkd/gtk/VBox.d:(.text+0x65): undefined reference to
D3gtk6Widget6Widget10mixin74813refAccessibleMFZC3atk9ObjectAtk9ObjectAtk'<br>../lib64/libgtkd-3.a(VBox.o): In function `THUNK7':
generated/gtkd/gtk/VBox.d:(.text+0x75): undefined reference to_D3gtk6Widget6Widget10__mixin74918getBuildableStructMFbZPS4gtkc8gtktypes12GtkBuildable'<br>../lib64/libgtkd-3.a(VBox.o): In function
THUNK9':<br>generated/gtkd/gtk/VBox.d:(.text+0x95): undefined reference to `D3gtk6Widget6Widget10mixin7498addChildMFC3gtk7Builder7BuilderC7gobject7ObjectG7ObjectGAyaZv'<br>../lib64/libgtkd-3.a(VBox.o): In function `_THUNK10':<br>generated/gtkd/gtk/VBox.d:(.text+0xa5): undefined reference to `_D3gtk6Widget6Widget10mixin74914constructChildMFC3gtk7Builder7BuilderAyaZC7gobject7ObjectG7ObjectG'
../lib64/libgtkd-3.a(VBox.o): In function_THUNK11':<br>generated/gtkd/gtk/VBox.d:(.text+0xb5): undefined reference to
D3gtk6Widget6Widget10mixin74914customFinishedMFC3gtk7Builder7BuilderC7gobject7ObjectG7ObjectGAyaPvZv'<br>../lib64/libgtkd-3.a(VBox.o): In function `THUNK12':
generated/gtkd/gtk/VBox.d:(.text+0xc5): undefined reference to_D3gtk6Widget6Widget10__mixin74912customTagEndMFC3gtk7Builder7BuilderC7gobject7ObjectG7ObjectGAyaPPvZv'<br>../lib64/libgtkd-3.a(VBox.o): In function
THUNK13':<br>generated/gtkd/gtk/VBox.d:(.text+0xd5): undefined reference to `D3gtk6Widget6Widget10mixin74914customTagStartMFC3gtk7Builder7BuilderC7gobject7ObjectG7ObjectGAyaJS4gtkc9glibtypes13GMarkupParserJPvZb'<br>../lib64/libgtkd-3.a(VBox.o): In function `_THUNK14':<br>generated/gtkd/gtk/VBox.d:(.text+0xe5): undefined reference to `_D3gtk6Widget6Widget10mixin74916getInternalChildMFC3gtk7Builder7BuilderAyaZC7gobject7ObjectG7ObjectG'
../lib64/libgtkd-3.a(VBox.o): In function_THUNK15':<br>generated/gtkd/gtk/VBox.d:(.text+0xf5): undefined reference to
D3gtk6Widget6Widget10mixin74916buildableGetNameMFZAya'<br>../lib64/libgtkd-3.a(VBox.o): In function `THUNK16':
generated/gtkd/gtk/VBox.d:(.text+0x105): undefined reference to_D3gtk6Widget6Widget10__mixin74914parserFinishedMFC3gtk7Builder7BuilderZv'<br>../lib64/libgtkd-3.a(VBox.o): In function
THUNK17':<br>generated/gtkd/gtk/VBox.d:(.text+0x115): undefined reference to `D3gtk6Widget6Widget10mixin74920setBuildablePropertyMFC3gtk7Builder7BuilderAyaC7gobject5Value5ValueZv'<br>../lib64/libgtkd-3.a(VBox.o): In function `_THUNK18':<br>generated/gtkd/gtk/VBox.d:(.text+0x125): undefined reference to `_D3gtk6Widget6Widget10mixin74916buildableSetNameMFAyaZv'
../lib64/libgtkd-3.a(VBox.o):(.data.D3gtk4VBox4VBox6vtblZ+0x190): undefined reference to `D3gtk6Widget6Widget10mixin74820getImplementorStructMFbZPS4gtkc8atktypes14AtkImplementor'<br>../lib64/libgtkd-3.a(VBox.o):(.data._D3gtk4VBox4VBox6vtblZ+0x198): undefined reference to_D3gtk6Widget6Widget10__mixin74813refAccessibleMFZC3atk9ObjectAtk9ObjectAtk'<br>../lib64/libgtkd-3.a(VBox.o):(.data._D3gtk4VBox4VBox6__vtblZ+0x1a0): undefined reference to
D3gtk6Widget6Widget10mixin74918getBuildableStructMFbZPS4gtkc8gtktypes12GtkBuildable'<br>../lib64/libgtkd-3.a(VBox.o):(.data.D3gtk4VBox4VBox6vtblZ+0x1a8): undefined reference to `_D3gtk6Widget6Widget10mixin7498addChildMFC3gtk7Builder7BuilderC7gobject7ObjectG7ObjectGAyaZv'
../lib64/libgtkd-3.a(VBox.o):(.data.D3gtk4VBox4VBox6vtblZ+0x1b0): undefined reference to `D3gtk6Widget6Widget10__mixin74914constructChildMFC3gtk7Builder7BuilderAyaZC7gobject7ObjectG7ObjectG