All pastes #1409 Raw Edit

Anonymous

public ruby v1 · immutable
#1409 ·published 2004-10-12 15:23 UTC
rendered paste body
	def initialize_menu		menu = Gtk::Menu::new()				item_info = Gtk::MenuItem::new('Append song to playlist')		item_info.name = 'append_song'		item_info.signal_connect('activate') { |item| menu_handler(item) }		menu.append(item_info)		menu.show_all 		@widget.signal_connect('button-press-event') { |widget, event|			#pp widget			if(event.kind_of?(Gdk::EventButton))				menu.popup(nil, nil, event.button, event.time) if(event.button == 3)				false			end		}	end	def menu_handler(menu_item)		case menu_item.name		when "append_song"			filepath = @widget.selection.selected[1]			if filepath				@mpd.send_command("add \"#{filepath}\"")			else				pp @widget.selection.selected			end		end	end