Class: Rabbit::Command::RabbitSlide::TextMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbit/command/rabbit-slide.rb

Direct Known Subclasses

SlideBaseNameMapper, SlideIDMapper

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ TextMapper

Returns a new instance of TextMapper.


323
324
325
# File 'lib/rabbit/command/rabbit-slide.rb', line 323

def initialize(data)
  @data = data
end

Instance Method Details

#apply(entry) ⇒ Object


340
341
342
# File 'lib/rabbit/command/rabbit-slide.rb', line 340

def apply(entry)
  apply_value(entry.text)
end

#attach(entry) ⇒ Object


327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/rabbit/command/rabbit-slide.rb', line 327

def attach(entry)
  entry.signal_connect(:notify) do |_widget, param_spec|
    if param_spec.name == "text"
      if valid?(_widget.text)
        _widget.style_context.remove_class(Gtk::STYLE_CLASS_ERROR)
      else
        _widget.style_context.add_class(Gtk::STYLE_CLASS_ERROR)
      end
    end
  end
  entry.text = value if value
end