Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Added support to automatically bind events when using Builder. #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joangs
Copy link

@joangs joangs commented Dec 30, 2014

type Test struct {
patata int
}

func (*Test) On_button1_clicked(button *gtk.Button) {
// clicked
}

.....

if builder, err = gtk.BuilderNew(); err != nil {
    log.Fatalf("Error: %s", err.Error())
}

builder.AddFromFile("gui.builder")
builder.BindCallbacks(builder, &Test{})

Changes to be committed:
new file: glib/glib_extra.go
modified: gtk/gtk.go
new file: gtk/gtkbuilder_bridge.go
new file: gtk/gtkbuilder_cgo.go

 Changes to be committed:
	new file:   glib/glib_extra.go
	modified:   gtk/gtk.go
	new file:   gtk/gtkbuilder_bridge.go
	new file:   gtk/gtkbuilder_cgo.go
@omac777
Copy link

omac777 commented Dec 30, 2014

Pardon my ignorance, but is Builder the next generation of glade?

The current samples of gotk3 dynamically create the gui. Your work
seems to imply you have a Builder IDE that currently runs and is
starting to play well with golang. Is that the case? Will that work be
directly integrated within gotk3, Builder or somewhere else?

I noticed a funding campaign going on for Builder, but they never
mentioned any golang support within as part of any of their funding
campaign targets. I believe it should be mentioned as a target.
Gophers I believe would chip in.

Why isn't gotk3 actually not trying to do a funding campaign? Again, I
believe gophers would chip in here too.

Cheers :)

On 12/30/2014 04:24 PM, Joan Garcia i Silano wrote:

type Test struct {
patata int
}

func (*Test) On_button1_clicked(button *gtk.Button) {
// clicked
}

.....

if builder, err = gtk.BuilderNew(); err != nil {
log.Fatalf("Error: %s", err.Error())
}

builder.AddFromFile("gui.builder")
builder.BindCallbacks(builder, &Test{})

Changes to be committed:
new file: glib/glib_extra.go
modified: gtk/gtk.go
new file: gtk/gtkbuilder_bridge.go
new file: gtk/gtkbuilder_cgo.go
You can merge this Pull Request by running:

git pull https://github.com/joangs/gotk3 master

Or you can view, comment on it, or merge it online at:

#98

-- Commit Summary --

  • Added support to automatically bind events when using Builder.

-- File Changes --

A glib/glib_extra.go (24)
M gtk/gtk.go (5)
A gtk/gtkbuilder_bridge.go (70)
A gtk/gtkbuilder_cgo.go (91)

-- Patch Links --

https://github.com/conformal/gotk3/pull/98.patch
https://github.com/conformal/gotk3/pull/98.diff


Reply to this email directly or view it on GitHub:
#98

@joangs
Copy link
Author

joangs commented Dec 30, 2014

The gtk Builder creates a GUI from a description (file, string, etc..), but you must bind the events associated to the GUI objects. You can use glade to edit the GUI and save it in GtkBuilder format.

https://developer.gnome.org/gtk3/stable/GtkBuilder.html

	modified:   glib/glib_extra.go - Error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants