5 public class Stuffkeeper
.DataImageConfig
: Gtk
.HBox
{
6 private string field
= null;
7 private DataSchema schema
= null;
8 private Gtk
.SpinButton spinbutton
= null;
9 /* hack to fix vala bug */
10 static bool quit
= false;
11 private enum PrivateField
{
16 * Listen to changes to this field
18 private void field_changed(DataSchema schema
, string id
, int field
)
20 if(field
== (int)PrivateField
.IMAGE_SIZE
)
23 if(schema
.get_custom_field_integer(id
, PrivateField
.IMAGE_SIZE
, out value
))
25 if(spinbutton
.value
!= value
)
27 //schema.schema_custom_field_changed -= field_changed;
28 this
.spinbutton
.value_changed
.disconnect(toggled
);
29 spinbutton
.value
= value
;
30 //schema.schema_custom_field_changed += field_changed;
31 this
.spinbutton
.value_changed
.connect(toggled
);
40 private void toggled(Gtk
.SpinButton spinbutton
)
42 int value
= (int)spinbutton
.value
;
43 schema
.set_custom_field_integer(field
,PrivateField
.IMAGE_SIZE
,value
);
50 stdout
.printf("Dispose data boolean config\n");
52 /* This gets called twice..
53 * Hack it to have it run only once*/
56 schema
.schema_custom_field_changed
.disconnect(field_changed
);
64 var label
= new Gtk
.Label("Default value");
65 this
.spinbutton
= new Gtk
.SpinButton
.with_range(8, 4192,4);
67 this
.pack_start(label
, false, false,0);
68 this
.pack_start(spinbutton
, true, true,0);
75 public void setup (Stuffkeeper
.DataSchema schema
, string fid
) {
80 if(schema
.get_custom_field_integer(field
, PrivateField
.IMAGE_SIZE
, out value
))
82 this
.spinbutton
.value
= value
;
84 else this
.spinbutton
.value
= 250;
86 this
.spinbutton
.value_changed
.connect(toggled
);
87 schema
.schema_custom_field_changed
.connect(field_changed
);