- found = @container.find { |i| i.label == lbl }
-
- begin
- if ev.count.zero?
- unless found.nil?
- #puts "removing icon #{lbl}"
- @container.delete(found)
- else
- #puts "count == 0, but icon not found (#{lbl})"
- end
- elsif found.nil?
- #puts "adding icon #{lbl}"
- add_icon(lbl)
- else
- #puts "count > 0, but already there (#{lbl})"
- end
- rescue Exception => e
- puts e.message
+ found = evas.find_object(lbl)
+
+ if ev.count.zero? && !found.nil? && @container.can_delete?
+ @container.delete(found)
+ elsif !ev.count.zero? && found.nil? && @container.can_add?
+ @container << MailboxIcon.new(evas, lbl)