Sha256: 149213409cec2c71a9afa2e1d1d0e14fbd37c2c7ca71796b434254fa4d3a3104

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'libglade2'

module Catori # {{{
class Gui # {{{
    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
	def start
		Gtk.main
	end
	def destroy
        Gtk.main_quit
        exit
    end
	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
end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
catori-0.2.6 ./lib/catori/Gui.rb
catori-0.2.6 lib/catori/Gui.rb