Class: Rabbit::ThemeBrowser::Document

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
GetText
Defined in:
lib/rabbit/theme-browser/document.rb

Constant Summary collapse

@@tag_table =
nil

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GetText

included

Constructor Details

#initialize(page) ⇒ Document

Returns a new instance of Document.



41
42
43
44
45
46
47
48
49
50
# File 'lib/rabbit/theme-browser/document.rb', line 41

def initialize(page)
  @page = page
  @name = nil
  @type = nil
  @hovering = false
  @category_buffers = {}
  @theme_buffers = {}
  load_cursor
  init_gui
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



39
40
41
# File 'lib/rabbit/theme-browser/document.rb', line 39

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



39
40
41
# File 'lib/rabbit/theme-browser/document.rb', line 39

def type
  @type
end

#viewObject (readonly)

Returns the value of attribute view.



39
40
41
# File 'lib/rabbit/theme-browser/document.rb', line 39

def view
  @view
end

Class Method Details

.load_tag_table(themes) ⇒ Object



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

def load_tag_table(themes)
  @@tag_table = Gtk::TextTagTable.new
  theme_infos = themes.collect do |entry|
    ["theme-link-#{entry.name}", {}]
  end
  [theme_infos, Tag::INFOS].each do |infos|
    infos.each do |name, properties|
      tag = Gtk::TextTag.new(name)
      properties.each do |key, value|
        tag.set_property(key, value)
      end
      @@tag_table.add(tag)
    end
  end
end

Instance Method Details

#change_buffer(name, type) ⇒ Object



52
53
54
55
# File 'lib/rabbit/theme-browser/document.rb', line 52

def change_buffer(name, type)
  @name, @type = name, type
  __send__("change_to_#{type}_buffer", name)
end