Skip to content

Commit

Permalink
Merge pull request #16 from davidanthoff/remove-gtk-dep
Browse files Browse the repository at this point in the history
Remove dependency on Gtk.jl for glib error and gc_unref calls.
  • Loading branch information
lobingera authored Jun 10, 2018
2 parents 734501d + 1b89a43 commit 643fe95
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
1 change: 0 additions & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
julia 0.6
Gtk
Cairo
BinDeps
Compat
Expand Down
2 changes: 1 addition & 1 deletion src/Rsvg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ isfile(depsjl) ? include(depsjl) : error("Rsvg not properly ",
"installed. Please run\nPkg.build(\"Rsvg\")")

using Cairo
using Gtk

include("gerror.jl")
include("types.jl")
include("calls.jl")

Expand Down
7 changes: 7 additions & 0 deletions src/calls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ end
handle_new_from_data(data::AbstractString)
"""
handle_new_from_data(data::AbstractString) = handle_new_from_data(data::AbstractString,GError(0,0,0))

"""
handle_free(handle::RsvgHandle)
"""
function handle_free(handle::RsvgHandle)
ccall((:rsvg_handle_free,librsvg), Void, (RsvgHandle,), handle)
end
5 changes: 5 additions & 0 deletions src/gerror.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
struct GError
domain::UInt32
code::Cint
message::Ptr{UInt8}
end
6 changes: 2 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type RsvgHandle

function RsvgHandle(ptr::Ptr{Void})
self = new(ptr)
#finalizer(self, destroy)
finalizer(self, destroy)
self
end
end
Expand All @@ -16,13 +16,11 @@ function destroy(handle::RsvgHandle)
if handle.ptr == C_NULL
return
end
Gtk.GLib.gc_unref(handle)
handle_free(handle)
handle.ptr = C_NULL
nothing
end

GError = Gtk.GLib.GError

"""
RsvgDimensionData is a simple struct of
width::Int32
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Rsvg
using Cairo
using Gtk


using Base.Test
Expand Down

0 comments on commit 643fe95

Please sign in to comment.