Skip to content

Commit

Permalink
Do not use internal packages to connect builder signals.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekim committed Nov 30, 2019
1 parent 1be12c2 commit d55870c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/gtk/builder-connect-signals.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package gtk

import (
"fmt"
"github.com/pekim/gobbi/internal/generate"
"github.com/pekim/gobbi/lib/gobject"
"reflect"
"strings"
Expand Down Expand Up @@ -221,7 +220,15 @@ func gtkBuilderGetConnectMethodForInterfaces(
}

func gtkBuilderGetConnectMethod(signalName string, gtkInstance reflect.Value, className string) (reflect.Value, bool) {
connectMethodName := "Connect" + generate.MakeExportedGoName(signalName)
nameParts := strings.Split(signalName, "-")
goNameParts := []string{}
for _, namePart := range nameParts {
goPart := strings.Title(namePart)
goNameParts = append(goNameParts, goPart)
}
goSignalName := strings.Join(goNameParts, "")

connectMethodName := "Connect" + goSignalName
connectMethod := gtkInstance.MethodByName(connectMethodName)
if !connectMethod.IsValid() {
return reflect.Value{}, false
Expand Down

0 comments on commit d55870c

Please sign in to comment.