Class: Rabbit::ThemeBrowser::Tree

Inherits:
Object
  • Object
show all
Includes:
GetText
Defined in:
lib/rabbit/theme-browser/tree.rb

Constant Summary collapse

MODEL =
[
  [:name, String],
  [:title, String],
  [:type, String],
]

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GetText

N_, _, bindtextdomain, locale=

Constructor Details

#initialize(page) ⇒ Tree

Returns a new instance of Tree.



18
19
20
21
# File 'lib/rabbit/theme-browser/tree.rb', line 18

def initialize(page)
  @page = page
  init_gui
end

Instance Attribute Details

#viewObject (readonly)

Returns the value of attribute view.



16
17
18
# File 'lib/rabbit/theme-browser/tree.rb', line 16

def view
  @view
end

Instance Method Details

#select(name, type) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rabbit/theme-browser/tree.rb', line 23

def select(name, type)
  name_column = column(:name)
  depth = type == "category" ? 1 : 2
  @view.model.each do |model, path, iter|
    if depth == path.depth and name == iter.get_value(name_column)
      @view.expand_to_path(path)
      @view.selection.select_iter(iter)
      break
    end
  end
end