class MainRouter

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)

Attributes

last_notifier[RW]
mainwindow[RW]
mymodule[RW]
notifier[RW]

Public Class Methods

new(mainwindow) click to toggle source
Calls superclass method
# File lib/MainRouter.rb, line 7
def initialize(mainwindow)
        @mainwindow=mainwindow
        @last_notifier=nil
        @mymodule=nil
        super()
end

Public Instance Methods

reset_child() click to toggle source
# File lib/MainRouter.rb, line 17
def reset_child
      #used by F5 refresh
              unless mymodule.nil?
                      child.destroy unless child.destroyed?
                      @mymodule=nil
              end
              @last_notifier=nil
end
update(notifier) click to toggle source
# File lib/MainRouter.rb, line 26
def update(notifier)
        if ['help','quit'].include?(notifier.modname)
                case notifier.modname
                        when "quit"
                                notifier=last_notifier
                                @mainwindow.destroy if @mainwindow.shut_down?
                        when "help" then 
                                notifier=last_notifier
                                ManqodHelp.new.populate.show_all
                end
                else
        mainwindow.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
        child.destroy unless child.nil?
        @mymodule=nil
        @notifier=notifier
        case notifier.modname
                when "listing" then set_child(Mylist::MyListHolder.new(self))
                when "about" then set_child(About.new())
                when "config" then set_child(MyConfig.new())
                when "relation_builder" then set_child(RelationBuilder.new())
                when "form" then set_child(Myform::MyFormHolder.new("embedded",notifier,"dry",notifier.target))
  end
  @mymodule=child.destroyed? ? nil : child
  Gtk.show_thread_changes

        unless mymodule.nil? || @mainwindow.destroyed?
                begin
                        mymodule.update(notifier)
                rescue => err
                        tell_exception("internal error occured",backtrace_to_debug(err),"main","error")
                end
                @mainwindow.set_title(mymodule.title)
                mymodule.show_all
                @last_notifier=@notifier
        end
        mainwindow.window.set_cursor(nil) unless @mainwindow.destroyed?
        end
end