Class: Todoable::UI::ItemsTreeView

Inherits:
Gtk::TreeView
  • Object
show all
Defined in:
lib/todoable/ui/gtk/items.rb

Constant Summary

COLUMN_INSTANCE =
0
COLUMN_ID =
1
COLUMN_NAME =
2
COLUMN_FINISHED =
3
COLUMN_FINISHED_BUTTON =
4
COLUMN_DELETE =
5

Instance Method Summary collapse

Constructor Details

#initialize(listsbox, mainpanel) ⇒ ItemsTreeView

Returns a new instance of ItemsTreeView



108
109
110
111
112
113
114
# File 'lib/todoable/ui/gtk/items.rb', line 108

def initialize listsbox, mainpanel
  @model = Gtk::ListStore.new Object, String, String, String, String, String
  super @model
  @listsbox = listsbox
  @mainpanel = mainpanel
  setup_columns
end

Instance Method Details

#append(item) ⇒ Object



116
117
118
119
120
121
122
123
124
125
# File 'lib/todoable/ui/gtk/items.rb', line 116

def append item
  @model.append.set_values [
item,
item.id,
"<big>#{item.name}</big>",
item.finished_at,
item.finished_at == nil ? "emblem-ok-symbolic" : "",
"edit-delete-symbolic"
]
end

#clearObject



127
128
129
# File 'lib/todoable/ui/gtk/items.rb', line 127

def clear
  @model.clear
end