require 'libglade2' require 'yaml' 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