Skip to content

Commit

Permalink
Member glib:name support; minor comment tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Oct 1, 2021
1 parent e119d21 commit 5d7eec3
Show file tree
Hide file tree
Showing 335 changed files with 2,886 additions and 2,820 deletions.
6 changes: 6 additions & 0 deletions gir/girgen/cmt/cmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ func goDoc(v interface{}, indentLvl int, opts []Option) string {
cmt = doc.Synopsis(cmt)
}

if cmt != "" && !strings.HasSuffix(cmt, ".") {
cmt += "."
}

return ReflowLinesIndent(indentLvl, cmt, opts...)
}

Expand Down Expand Up @@ -427,6 +431,8 @@ func format(self, cmt string, opts []Option) string {
}
})

cmt = strings.TrimSpace(cmt)

return cmt
}

Expand Down
3 changes: 3 additions & 0 deletions gir/girgen/strcases/capitalized.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Ps
Pdf
Ngl
Iso
Rle
Xml
Os2
Drm
Expand Down Expand Up @@ -68,6 +69,8 @@ Vrgb
Vbgr
Cogl
Guid
Http
Https
Ascii
Iso8601
[LA]gpl
Expand Down
4 changes: 2 additions & 2 deletions gir/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Repository struct {
func ParseRepository(file string) (*Repository, error) {
f, err := os.Open(file)
if err != nil {
return nil, errors.Wrap(err, "Failed to open file")
return nil, errors.Wrap(err, "failed to open file")
}
defer f.Close()

Expand All @@ -39,7 +39,7 @@ func ParseRepositoryFromReader(r io.Reader) (*Repository, error) {
var repo Repository

if err := xml.NewDecoder(r).Decode(&repo); err != nil {
return nil, errors.Wrap(err, "Failed to decode gir XML")
return nil, errors.Wrap(err, "failed to decode gir XML")
}

return &repo, nil
Expand Down
28 changes: 23 additions & 5 deletions gir/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,34 @@ type Interface struct {
}

type Member struct {
XMLName xml.Name `xml:"http://www.gtk.org/introspection/core/1.0 member"`
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
CIdentifier string `xml:"http://www.gtk.org/introspection/c/1.0 identifier,attr"`
GLibNick string `xml:"http://www.gtk.org/introspection/glib/1.0 nick,attr"`
XMLName xml.Name `xml:"http://www.gtk.org/introspection/core/1.0 member"`

Names []xml.Attr `xml:"name,attr"`
Value string `xml:"value,attr"`
CIdentifier string `xml:"http://www.gtk.org/introspection/c/1.0 identifier,attr"`
GLibNick string `xml:"http://www.gtk.org/introspection/glib/1.0 nick,attr"`

InfoAttrs
InfoElements
}

func (m Member) Name() string {
return m.nameAttr(xml.Name{Local: "name"})
}

func (m Member) GLibName() string {
return m.nameAttr(xml.Name{Space: "http://www.gtk.org/introspection/glib/1.0", Local: "name"})
}

func (m Member) nameAttr(name xml.Name) string {
for _, attr := range m.Names {
if attr.Name == name {
return attr.Value
}
}
return ""
}

type Method struct {
XMLName xml.Name `xml:"http://www.gtk.org/introspection/core/1.0 method"`
CallableAttrs
Expand Down
2 changes: 1 addition & 1 deletion pkg/atk/atkeditabletext.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/atk/atkhyperlink.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/atk/atkhypertext.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5d7eec3

Please sign in to comment.