コード例 #1
0
ファイル: widgets.go プロジェクト: sqp/godock
// Separator adds a simple horizontal separator.
//
func Separator(key *cftype.Key) {
	// GtkWidget *pAlign = gtk_alignment_new (.5, .5, 0.8, 1.);
	// g_object_set (pAlign, "height-request", 12, NULL);
	widget := newgtk.Separator(gtk.ORIENTATION_HORIZONTAL)
	// gtk_container_add (GTK_CONTAINER (pAlign), pOneWidget);
	key.PackWidget(widget, false, false, 0)
}
コード例 #2
0
ファイル: others.go プロジェクト: sqp/godock
// PackComboBoxWithIndexHandbooker creates a combo box filled with the getList call.
//
func PackComboBoxWithIndexHandbooker(key *cftype.Key, index map[string]datatype.Handbooker) {
	model := newModelSimple()
	model.SetSortColumnId(RowName, gtk.SORT_ASCENDING)
	widget, getValue := NewComboBoxWithModel(model, key.Log(), false, false, false)

	value := key.Value().String()

	details := handbook.New(key.Log())
	key.PackWidget(details, false, false, 0)

	widget.Connect("changed", func() {
		name := key.Value().String()
		pack, ok := index[name]
		if ok {
			details.SetPackage(pack)
		} else {
			key.Log().NewErr("key missing", "ComboHandbook select preview:", name)
		}
	})

	fields := datatype.IndexHandbooksToFields(index)
	saved := indexiter.NewByString(widget, key.Log())
	iter := fillModelWithFields(key, model, fields, value, saved)
	widget.SetActiveIter(iter) // Set iter after connect, to update with current value.

	key.PackKeyWidget(key,
		getValue,
		func(uncast interface{}) { saved.SetActive(uncast.(string)) },
		widget,
	)
}