Class: ActiveWindow::Controller

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_window/controller.rb

Overview

require ‘libglade2’ require ‘gtk2’

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object


53
54
55
# File 'lib/active_window/controller.rb', line 53

def method_missing(name, *args, &block)
  application.send name, *args, &block
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.


7
8
9
# File 'lib/active_window/controller.rb', line 7

def application
  @application
end

Instance Method Details

#appObject


9
10
11
# File 'lib/active_window/controller.rb', line 9

def app
  application
end

#controllerObject


17
18
19
# File 'lib/active_window/controller.rb', line 17

def controller
  application.controller
end

#databaseObject


25
26
27
# File 'lib/active_window/controller.rb', line 25

def database
  application.database
end

#post_setupObject

called on startup, after setup has been called for all controllers


34
35
# File 'lib/active_window/controller.rb', line 34

def post_setup
end

#pref_get(key) ⇒ Object


43
44
45
46
47
# File 'lib/active_window/controller.rb', line 43

def pref_get(key)
  pref = Preference.find_by_pref(key)
  return pref.value if pref
  return nil
end

#pref_get_or_set(key, value) ⇒ Object


49
50
51
# File 'lib/active_window/controller.rb', line 49

def pref_get_or_set(key,value)
  pref_get(key) || pref_set(key,value)
end

#pref_set(key, value) ⇒ Object


37
38
39
40
41
# File 'lib/active_window/controller.rb', line 37

def pref_set(key,value)
  Preference.delete_all ['pref = ?', key]
  Preference.create(:pref => key, :value => value)
  value
end

#setupObject

called on startup


30
31
# File 'lib/active_window/controller.rb', line 30

def setup
end

#widget(name) ⇒ Object


13
14
15
# File 'lib/active_window/controller.rb', line 13

def widget(name)
  application.widget(name)
end

#windowObject


21
22
23
# File 'lib/active_window/controller.rb', line 21

def window
  application.window
end