Class: ServiceListStore

Inherits:
Gtk::ListStore
  • Object
show all
Includes:
Column_ID
Defined in:
lib/yasysdui/service_list.rb

Constant Summary

Constants included from Column_ID

Column_ID::Active, Column_ID::Descr, Column_ID::Load, Column_ID::Native_info, Column_ID::State, Column_ID::Sub, Column_ID::Unit

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServiceListStore

Returns a new instance of ServiceListStore.



26
27
28
# File 'lib/yasysdui/service_list.rb', line 26

def initialize
	super(String, String, String, String, String, String, String)
end

Class Method Details

.new_all_serviceObject



21
22
23
24
25
# File 'lib/yasysdui/service_list.rb', line 21

def self.new_all_service
	sl = ServiceListStore.new
	sl.load_catalog
	sl
end

Instance Method Details

#append_managed_service(name) ⇒ Object



39
40
41
42
43
# File 'lib/yasysdui/service_list.rb', line 39

def append_managed_service(name)
	if service =  ServiceCatalog.instance[name] 
		append_service(service)
	end
end

#append_service(service) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/yasysdui/service_list.rb', line 44

def append_service(service)
	row = self.append 
	row[ Unit ] = service
       row[ Load ] = service.load
       row[ Active ] = service.active
       row[ Sub ] = service.sub
	row[ Descr  ] = service.descr
       row[ Native_info ] = service.native_info
       row[ State ] = service.state
end

#load_catalogObject



29
30
31
32
33
# File 'lib/yasysdui/service_list.rb', line 29

def load_catalog
  sci = ServiceCatalog.instance
  puts "Loading Catalog with #{sci.size} item(s)"
  sci.each_value{|s| append_service(s) }
end

#reloadObject



34
35
36
37
38
# File 'lib/yasysdui/service_list.rb', line 34

def reload
  clear  # clear Gtk::ListStore
  ServiceCatalog.instance.rebuild
  load_catalog
end

#sort_by_unitObject



54
55
56
# File 'lib/yasysdui/service_list.rb', line 54

def sort_by_unit
  self.set_sort_column_id( Unit, :ascending)
end