public class DbMetaData : Object
{
public string icon { get; set; default = ""; }
public string name { get; set; default = ""; }
public string second { get; set; default = ""; }
public string third { get; set; default = ""; }
public string fourth { get; set; default = ""; }
public string fifth { get; set; default = ""; }
}
<object class="GtkColumnViewColumn" id="column_name">
<property name="title" translatable="yes">Name</property>
<property name="resizable">true</property>
<property name="expand">true</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes">
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage">
<property name="pixel_size">32</property>
<binding name="icon_name">
<lookup name="icon" type="DbMetaData">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="wrap">true</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<binding name="label">
<lookup name="name" type="DbMetaData">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
<!-- Follow code throw error -->
<property name="sorter">
<object class="GtkStringSorter">
<property name="expression">
<lookup name="name">this</lookup>
</property>
</object>
</property>
<!-- Follow code works fine, copy from another example -->
<property name="sorter">
<object class="GtkStringSorter" id="sorter_name2">
<property name="expression">
<closure type="gchararray" function="get_file_name">
</closure>
</property>
</object>
</property>
</object>
/* Functions (closures) for GtkSorter */
string get_file_name (FileInfo? info) {
if (null == info) {
return "";
} else {
return strdup(info.get_name());
}
}
How to pass the parameter(DbMetaData instance like parameter info
in example code) to GtkSorter’s expression with GtkColumnViewColumn?
Now I have no idea to solve this issue, could you guys give me a hand? thank you all in advance.