Skip to content

Commit 00a204d

Browse files
committed
more v0.2 compat misses
1 parent ddba817 commit 00a204d

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

src/Gtk.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if VERSION < v"0.3-"
1717
QuoteNode(x) = Base.qn(x)
1818
end
1919
import Base: convert, show, showall, run, size, resize!, length, getindex, setindex!,
20-
insert!, push!, append!, unshift!, shift!, pop!, splice!, delete!,
21-
start, next, done, parent, isempty, empty!, first, last, in,
20+
insert!, push!, append!, unshift!, shift!, pop!, splice!, delete!, deleteat!,
21+
select!, start, next, done, parent, isempty, empty!, first, last, in,
2222
eltype, copy, isvalid, string, sigatomic_begin, sigatomic_end
2323
import Base.Graphics: width, height, getgc
2424
import Cairo: destroy

src/lists.jl

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function unshift!(listStore::GtkListStore, values::Tuple)
144144
end
145145

146146
## insert before
147-
function Base.insert!(listStore::GtkListStoreLeaf, iter::TRI, values)
147+
function insert!(listStore::GtkListStoreLeaf, iter::TRI, values)
148148
newiter = Gtk.mutable(GtkTreeIter)
149149
ccall((:gtk_list_store_insert_before,Gtk.libgtk),Void,(Ptr{GObject},Ptr{GtkTreeIter},Ptr{GtkTreeIter}), listStore, newiter, iter)
150150
list_store_set_values(listStore, newiter, values)
@@ -158,7 +158,7 @@ function delete!(listStore::GtkListStore, iter::TRI)
158158
listStore
159159
end
160160

161-
Base.deleteat!(listStore::GtkListStore, iter::TRI) = delete!(listStore, iter)
161+
deleteat!(listStore::GtkListStore, iter::TRI) = delete!(listStore, iter)
162162

163163

164164
empty!(listStore::GtkListStore) =
@@ -167,18 +167,16 @@ empty!(listStore::GtkListStore) =
167167
## by index
168168

169169
## insert into a list store after index
170-
function Base.insert!(listStore::GtkListStoreLeaf, index::Int, values)
170+
function insert!(listStore::GtkListStoreLeaf, index::Int, values)
171171
index > length(listStore) && return(push!(listStore, values))
172172

173173
iter = iter_from_index(listStore, index)
174174
insert!(listStore, iter, values)
175175
end
176176

177-
Base.deleteat!(listStore::GtkListStoreLeaf, index::Int) = delete!(listStore, iter_from_index(listStore, index))
178-
Base.pop!(listStore::GtkListStoreLeaf) = deleteat!(listStore, length(listStore))
179-
Base.shift!(listSTore::GtkListStoreLeaf) = deleteat!(listStore, 1)
180-
181-
177+
deleteat!(listStore::GtkListStoreLeaf, index::Int) = delete!(listStore, iter_from_index(listStore, index))
178+
pop!(listStore::GtkListStoreLeaf) = deleteat!(listStore, length(listStore))
179+
shift!(listSTore::GtkListStoreLeaf) = deleteat!(listStore, 1)
182180

183181

184182
isvalid(listStore::GtkListStore, iter::TRI) =
@@ -190,10 +188,10 @@ length(listStore::GtkListStore) =
190188

191189
size(listStore::GtkListStore) = (length(listStore), ncolumns(GtkTreeModel(listStore)))
192190

193-
Base.getindex(listStore::GtkListStore, iter::TRI, column::Integer) = getindex(GtkTreeModel(listStore), iter, column)
194-
Base.getindex(listStore::GtkListStore, iter::TRI) = getindex(GtkTreeModel(listStore), iter)
195-
Base.getindex(listStore::GtkListStore, row::Int, column) = getindex(listStore, iter_from_index(listStore, row), column)
196-
Base.getindex(listStore::GtkListStore, row::Int) = getindex(listStore, iter_from_index(listStore, row))
191+
getindex(listStore::GtkListStore, iter::TRI, column::Integer) = getindex(GtkTreeModel(listStore), iter, column)
192+
getindex(listStore::GtkListStore, iter::TRI) = getindex(GtkTreeModel(listStore), iter)
193+
getindex(listStore::GtkListStore, row::Int, column) = getindex(listStore, iter_from_index(listStore, row), column)
194+
getindex(listStore::GtkListStore, row::Int) = getindex(listStore, iter_from_index(listStore, row))
197195

198196

199197

@@ -242,7 +240,7 @@ end
242240

243241
## index can be :parent or :sibling
244242
## insertion can be :after or :before
245-
function Base.insert!(treeStore::GtkTreeStoreLeaf, piter::TRI, values; how::Symbol=:parent, where::Symbol=:after)
243+
function insert!(treeStore::GtkTreeStoreLeaf, piter::TRI, values; how::Symbol=:parent, where::Symbol=:after)
246244

247245
iter = Gtk.mutable(GtkTreeIter)
248246
if how == :parent
@@ -269,16 +267,16 @@ function delete!(treeStore::GtkTreeStore, iter::TRI)
269267
treeStore
270268
end
271269

272-
Base.deleteat!(treeStore::GtkTreeStore, iter::TRI) = delete!(treeStore, iter)
270+
deleteat!(treeStore::GtkTreeStore, iter::TRI) = delete!(treeStore, iter)
273271

274272
## insert by index
275-
function Base.insert!(treeStore::GtkTreeStoreLeaf, index::Vector{Int}, values; how::Symbol=:parent, where::Symbol=:after)
273+
function insert!(treeStore::GtkTreeStoreLeaf, index::Vector{Int}, values; how::Symbol=:parent, where::Symbol=:after)
276274
piter = iter_from_index(treeStore, index)
277275
insert!(treeStore, iter, values; how=how, where=where)
278276
end
279277

280278

281-
function Base.splice!(treeStore::GtkTreeStoreLeaf, index::Vector{Int})
279+
function splice!(treeStore::GtkTreeStoreLeaf, index::Vector{Int})
282280
iter = iter_from_index(treeStore, index)
283281
delete!(treeStore, iter)
284282
end
@@ -472,7 +470,7 @@ length(selection::GtkTreeSelection) =
472470

473471
hasselection(selection::GtkTreeSelection) = length(selection) > 0
474472

475-
Base.select!(selection::GtkTreeSelection, iter::TRI) =
473+
select!(selection::GtkTreeSelection, iter::TRI) =
476474
ccall((:gtk_tree_selection_select_iter,libgtk), Void,
477475
(Ptr{GObject},Ptr{GtkTreeIter}),selection, mutable(iter))
478476

test/gui.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Tests
22
using Gtk.ShortNames, Gtk.GConstants, Base.Graphics
3+
import Gtk.deleteat!
34

45
## Window
56
w = @Window("Window", 400, 300)

0 commit comments

Comments
 (0)