Skip to content

Commit

Permalink
Merge pull request #14 from JuliaGtk/gtk4
Browse files Browse the repository at this point in the history
port to Gtk4
  • Loading branch information
jonathanBieler authored Mar 21, 2024
2 parents 1cda19b + dac5d95 commit d755f0c
Show file tree
Hide file tree
Showing 9 changed files with 3,719 additions and 210 deletions.
14 changes: 9 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name = "GtkSourceWidget"
uuid = "6ceb4976-07da-5329-b1cb-20978726f1f4"
version = "1.0.1"
version = "2.0.0"

[deps]
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
Gtk4 = "9db2cae5-386f-4011-9d63-a5602296539b"
GtkSourceView_jll = "bf9c6edb-e643-5064-a5c3-0f96a1285812"
BitFlags = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

[compat]
Gtk = "1"
GtkSourceView_jll = "4.4.0"
julia = "1.3"
BitFlags = "0.1.5"
CEnum = "0.4, 0.5"
Gtk4 = "0.6"
GtkSourceView_jll = "5.1.0"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
13 changes: 13 additions & 0 deletions examples/simple.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using GtkSourceWidget, Gtk4

win=GtkWindow("test",400,400)
sv = GtkSourceView()
win[] = sv

buff = sv.buffer
langman = GtkSourceLanguageManager()
lang = GtkSourceWidget.language(langman,"julia")
buff.text = open("simple.jl","r") do f
read(f,String)
end
GtkSourceWidget.G_.set_language(buff,lang)
68 changes: 68 additions & 0 deletions gen/gen.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using GI
GI.prepend_search_path("/usr/lib64/girepository-1.0")
GI.prepend_search_path("/usr/local/lib64/girepository-1.0")

toplevel, exprs, exports = GI.output_exprs()

path="../src/gen"

ns = GINamespace(:GtkSource,"5")

## constants, enums, and flags

const_mod = Expr(:block)

const_exports = Expr(:export)

c = GI.all_const_exprs!(const_mod, const_exports, ns; skiplist= [])
push!(const_mod.args, const_exports)

push!(exprs, const_mod)

## export constants, enums, and flags code
GI.write_to_file(path,"gtksourceview_consts",toplevel)

## structs and objects

toplevel, exprs, exports = GI.output_exprs()
GI.struct_cache_expr!(exprs)
GI.all_interfaces!(exprs,exports,ns;skiplist=[])
GI.all_objects!(exprs,exports,ns,skiplist=[],constructor_skiplist=[])

disguised = []
special = []
struct_skiplist=vcat(disguised, special, [])

struct_skiplist = GI.all_struct_exprs!(exprs,exports,ns;excludelist=struct_skiplist)
GI.all_callbacks!(exprs, exports, ns)

push!(exprs,exports)

GI.write_to_file(path,"gtksourceview_structs",toplevel)

## struct methods

toplevel, exprs, exports = GI.output_exprs()

GI.all_struct_methods!(exprs,ns,struct_skiplist=vcat(struct_skiplist,[]);print_detailed=true)

## object methods

objects=GI.get_all(ns,GI.GIObjectInfo)

object_skiplist=[]

skiplist=[:get_default]

GI.all_object_methods!(exprs,ns;skiplist=skiplist,object_skiplist=object_skiplist,interface_helpers=false)
GI.all_interface_methods!(exprs,ns;skiplist=[],interface_skiplist=[])

GI.write_to_file(path,"gtksourceview_methods",toplevel)

## functions

toplevel, exprs, exports = GI.output_exprs()

GI.all_functions!(exprs,ns,skiplist=skiplist)

GI.write_to_file(path,"gtksourceview_functions",toplevel)
Loading

0 comments on commit d755f0c

Please sign in to comment.