Class: Catori::Gui

Inherits:
Object
  • Object
show all
Defined in:
lib/catori/Gui.rb

Overview

{{{

Instance Method Summary collapse

Constructor Details

#initialize(hQuery) ⇒ Gui

{{{



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/catori/Gui.rb', line 5

def initialize (hQuery)# {{{
	Gtk.init
	
	@wTree = GladeXML.new(Catori::LIB_DIR+'/catori/catori_gui.glade') {|handler|
		method(handler)
       }
	widget=@wTree.get_widget('tvSearch')
	ren0=Gtk::CellRendererPixbuf.new
	ren1=Gtk::CellRendererText.new
	col0=Gtk::TreeViewColumn.new("", ren0, :pixbuf=>4)
	widget.append_column(col0)
	col1=Gtk::TreeViewColumn.new("", ren1, :text=>0)
	widget.append_column(col1)
	col2=Gtk::TreeViewColumn.new("Track", ren1, :text=>1)
	widget.append_column(col2)
	col3=Gtk::TreeViewColumn.new("Song", ren1, :text=>2)
	widget.append_column(col3)
	col4=Gtk::TreeViewColumn.new("File", ren1, :text=>3)
	widget.append_column(col4)
	#dibujitos!
	@pix={}
	@pix['album']=Gdk::Pixbuf.new(Catori::LIB_DIR+'/pixmaps/album.png',16,16)
	@pix['artist']=Gdk::Pixbuf.new(Catori::LIB_DIR+'/pixmaps/artist.png',16,16)
	@pix['cd']=Gdk::Pixbuf.new(Catori::LIB_DIR+'/pixmaps/cdr.png',16,16)
	@pix['song']=Gdk::Pixbuf.new(Catori::LIB_DIR+'/pixmaps/song.png',16,16)

end

Instance Method Details

#destroyObject



35
36
37
38
# File 'lib/catori/Gui.rb', line 35

def destroy
    Gtk.main_quit
    exit
end

#on_bSearch_clickedObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/catori/Gui.rb', line 39

def on_bSearch_clicked
	hQuery={}
	%w{artist album title cd file}.each {|tag|
		p 'tb'+tag
		val=@wTree.get_widget('tb'+tag).text
		hQuery[tag]=val if val!=""
	}
	return if hQuery.size==0
	query=Query.new(hQuery)
	query.gtk(@wTree.get_widget('tvSearch'),@pix)
end

#startObject



32
33
34
# File 'lib/catori/Gui.rb', line 32

def start
	Gtk.main
end