summaryrefslogtreecommitdiff
path: root/redo/tab_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'redo/tab_unix.go')
-rw-r--r--redo/tab_unix.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/redo/tab_unix.go b/redo/tab_unix.go
index e815935..c73796f 100644
--- a/redo/tab_unix.go
+++ b/redo/tab_unix.go
@@ -13,6 +13,7 @@ import "C"
type tab struct {
_widget *C.GtkWidget
+ container *C.GtkContainer
notebook *C.GtkNotebook
tabs []*container
@@ -22,6 +23,7 @@ func newTab() Tab {
widget := C.gtk_notebook_new()
t := &tab{
_widget: widget,
+ container: (*C.GtkContainer)(unsafe.Pointer(widget)),
notebook: (*C.GtkNotebook)(unsafe.Pointer(widget)),
}
// there are no scrolling arrows by default; add them in case there are too many tabs
@@ -32,15 +34,14 @@ func newTab() Tab {
func (t *tab) Append(name string, control Control) {
c := newContainer(control)
t.tabs = append(t.tabs, c)
+ // this calls gtk_container_add(), which, according to gregier in irc.gimp.net/#gtk+, acts just like gtk_notebook_append_page()
+ c.setParent(&controlParent{t.container})
cname := togstr(name)
defer freegstr(cname)
- tab := C.gtk_notebook_append_page(t.notebook,
- // TODO figure out how to keep this private
- c.layoutwidget,
- C.gtk_label_new(cname))
- if tab == -1 {
- panic("gtk_notebook_append_page() failed")
- }
+ C.gtk_notebook_set_tab_label_text(t.notebook,
+ // unfortunately there does not seem to be a gtk_notebook_set_nth_tab_label_text()
+ C.gtk_notebook_get_nth_page(t.notebook, C.gint(len(t.tabs) - 1)),
+ cname)
}
func (t *tab) widget() *C.GtkWidget {