Skip to content

Commit

Permalink
Make all fields in gtk.TreeIter private.
Browse files Browse the repository at this point in the history
With them non-private it's not possible to iterate with
the iterator. That is because the internal fields are
critical to the iteration.
  • Loading branch information
pekim committed Sep 27, 2019
1 parent 575b341 commit aee5779
Show file tree
Hide file tree
Showing 32 changed files with 199 additions and 560 deletions.
4 changes: 4 additions & 0 deletions internal/generate/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ func (f Field) generate(g *jen.Group) {

f.Type.generator.generateDeclaration(g, f.goVarName)
}

func (f *Field) mergeAddenda(addenda *Field) {
f.Private = addenda.Private
}
18 changes: 18 additions & 0 deletions internal/generate/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,21 @@ func (ff Fields) generate(g *jen.Group) {
f.generate(g)
}
}

func (ff Fields) forName(name string) *Field {
for _, field := range ff {
if field.Name == name {
return field
}
}

return nil
}

func (ff Fields) mergeAddenda(addenda Fields) {
for _, addendaField := range addenda {
if field := ff.forName(addendaField.Name); field != nil {
field.mergeAddenda(addendaField)
}
}
}
1 change: 1 addition & 0 deletions internal/generate/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (r *Record) mergeAddenda(addenda *Record) {
r.Constructors.mergeAddenda(addenda.Constructors)
r.Functions.mergeAddenda(addenda.Functions)
r.Methods.mergeAddenda(addenda.Methods)
r.Fields.mergeAddenda(addenda.Fields)
}

func (r *Record) generate(g *jen.Group, version *Version) {
Expand Down
8 changes: 8 additions & 0 deletions internal/gir-files/Gtk-3.0-addenda.gir
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@
<record name="TreePath">
<method blacklist="true" c:identifier="gtk_tree_path_get_indices"/>
</record>


<record name="TreeIter">
<field name="stamp" private="1"/>
<field name="user_data" private="1"/>
<field name="user_data2" private="1"/>
<field name="user_data3" private="1"/>
</record>
</namespace>
</repository>

Expand Down
26 changes: 6 additions & 20 deletions lib/gtk/v-.go

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

26 changes: 6 additions & 20 deletions lib/gtk/v-2.10.go

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

26 changes: 6 additions & 20 deletions lib/gtk/v-2.12.go

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

26 changes: 6 additions & 20 deletions lib/gtk/v-2.14.go

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

26 changes: 6 additions & 20 deletions lib/gtk/v-2.16.go

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

26 changes: 6 additions & 20 deletions lib/gtk/v-2.18.go

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

26 changes: 6 additions & 20 deletions lib/gtk/v-2.2.go

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

Loading

0 comments on commit aee5779

Please sign in to comment.