Skip to content

Commit

Permalink
Add some syntax sugar to Gtk::ListStore API.
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopl committed Sep 26, 2021
1 parent bd6ebab commit eacbd17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions gtk.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include:
- src/includes/about_dialog.cr
- src/includes/builder.cr
- src/includes/list_store.cr
- src/includes/message_dialog.cr
- src/includes/tree_view.cr

Expand Down
16 changes: 16 additions & 0 deletions src/includes/list_store.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Gtk
class ListStore
def append(columns : Enumerable(Int32), values : Enumerable) : TreeIter
iter = append
set(iter, columns, values)
iter
end

def set(row : Int32, columns : Enumerable(Int32), values : Enumerable) : TreeIter
tree_path = Gtk::TreePath.new_from_indices({row})
iter = iter(tree_path)
set(iter, columns, values)
iter
end
end
end

0 comments on commit eacbd17

Please sign in to comment.