Module: SSHTunnel::UI::Helpers::Common::TreeViewHelper

Included in:
ApplicationWindowHelper, HostWindowHelper
Defined in:
lib/ssh-hull/ui/helpers/common/tree_view_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_column(treeview, renderer, label, attributes) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ssh-hull/ui/helpers/common/tree_view_helper.rb', line 21

def add_column(treeview, renderer, label, attributes)
  visible  = attributes.delete(:visible) { true }
  sortable = attributes.delete(:sortable) { true }

  column = Gtk::TreeViewColumn.new(label, renderer, attributes)
  column.visible = visible

  if sortable
    column.clickable = true
    column.sort_column_id = attributes[:text] if attributes[:text]
  end

  treeview.append_column(column)
end

#add_image_column(treeview, label, attributes) ⇒ Object



15
16
17
18
# File 'lib/ssh-hull/ui/helpers/common/tree_view_helper.rb', line 15

def add_image_column(treeview, label, attributes)
  renderer = Gtk::CellRendererPixbuf.new
  add_column(treeview, renderer, label, attributes)
end

#add_text_column(treeview, label, attributes) ⇒ Object



9
10
11
12
# File 'lib/ssh-hull/ui/helpers/common/tree_view_helper.rb', line 9

def add_text_column(treeview, label, attributes)
  renderer = Gtk::CellRendererText.new
  add_column(treeview, renderer, label, attributes)
end