Class: MittensUi::Notify

Inherits:
Core
  • Object
show all
Defined in:
lib/mittens_ui/notify.rb

Instance Attribute Summary

Attributes inherited from Core

#core_widget

Instance Method Summary collapse

Methods inherited from Core

#hidden?, #hide, #remove, #show

Methods included from Helpers

#icon_map, #list_system_icons, #set_margin_from_opts_for

Constructor Details

#initialize(msg, options = {}) ⇒ Notify

Returns a new instance of Notify.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mittens_ui/notify.rb', line 5

def initialize(msg, options={})
  @activate_timer = options[:timer] || true

  @notify_bar = Gtk::InfoBar.new
  
  @notify_bar.set_show_close_button(true)

  msg_label = Gtk::Label.new(msg)

  @notify_bar.message_type = set_msg_type(options)
  
  @notify_bar.content_area.pack_start(msg_label)

  setup_close_notification

  super(@notify_bar, options)
end

Instance Method Details

#renderObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/mittens_ui/notify.rb', line 23

def render
  $vertical_box.pack_start(@notify_bar) unless $vertical_box.children.include?(@notify_bar)
  $vertical_box.reorder_child(@notify_bar, 0)
  
  @notify_bar.show_all

  trigger_notify_timer if @activate_timer
 
  return self
end