Skip to content

Commit

Permalink
Merge pull request conformal#85 from spreadspace/gtk-combobox-additio…
Browse files Browse the repository at this point in the history
…nal-methods

add SetActiveID and GetModel for GtkComboBox
  • Loading branch information
andre-hub committed Feb 6, 2016
2 parents de86b3f + 26a5eaf commit 34dc5ad
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gtk/combo_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ func (v *ComboBox) GetActiveID() string {
return C.GoString((*C.char)(c))
}

// SetActiveID is a wrapper around gtk_combo_box_set_active_id().
func (v *ComboBox) SetActiveID(id string) bool {
cid := C.CString(id)
defer C.free(unsafe.Pointer(cid))
c := C.gtk_combo_box_set_active_id(v.native(), (*C.gchar)(cid))
return gobool(c)
}

// GetModel is a wrapper around gtk_combo_box_get_model().
func (v *ComboBox) GetModel() (*TreeModel, error) {
c := C.gtk_combo_box_get_model(v.native())
if c == nil {
return nil, nilPtrErr
}
obj := wrapObject(unsafe.Pointer(c))
return wrapTreeModel(obj), nil
}

// SetModel is a wrapper around gtk_combo_box_set_model().
func (v *ComboBox) SetModel(model ITreeModel) {
C.gtk_combo_box_set_model(v.native(), model.toTreeModel())
Expand Down

0 comments on commit 34dc5ad

Please sign in to comment.