Class: Todoable::UI::MainPanel

Inherits:
Gtk::Stack
  • Object
show all
Defined in:
lib/todoable/ui/gtk/mainpanel.rb

Overview

Main widget within the Todoable window.

The `MainPanel` is responsible for holding the screens within the main window and to provide a mechanism to switch between them. The routing between the child components is done using the method `Gtk::Stack#set_visible_child`

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_uri) ⇒ MainPanel

Returns a new instance of MainPanel



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/todoable/ui/gtk/mainpanel.rb', line 38

def initialize base_uri
  super()

  # Define stack properties
  set_transition_type :slide_up_down

  # Instance that updates the UI when threads have results to
  # present
  @jobqueue = JobQueue.new
  @todoable = Todoable::Todoable.new base_uri

  # This is the list that is currently selected. Defaults to no
  # lists and only gets set when the user clicks in one of the lists
  # on the ListsBox TreeView.
  @selected = nil

  # Populate window with internal UI elements
  @items_box = nil
  add_ui_elements
end

Instance Attribute Details

#jobqueueObject

Returns the value of attribute jobqueue



34
35
36
# File 'lib/todoable/ui/gtk/mainpanel.rb', line 34

def jobqueue
  @jobqueue
end

#selectedObject

Returns the value of attribute selected



36
37
38
# File 'lib/todoable/ui/gtk/mainpanel.rb', line 36

def selected
  @selected
end

#todoableObject

Returns the value of attribute todoable



35
36
37
# File 'lib/todoable/ui/gtk/mainpanel.rb', line 35

def todoable
  @todoable
end

Instance Method Details

#list_items(list) ⇒ Object



59
60
61
62
63
# File 'lib/todoable/ui/gtk/mainpanel.rb', line 59

def list_items list
  set_visible_child "items_box"
  @selected = list
  @items_box.load_items
end