Handle situations were ruby-gtk2 is available, but cairo is not. Fixes #191

git-svn-id: file:///home/svn/framework3/trunk@5407 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2008-02-09 08:17:20 +00:00
parent d8d9db3299
commit cd5d111296
2 changed files with 20 additions and 15 deletions

View File

@ -252,26 +252,30 @@ module Msf
# Create and return a DrawingArea object
#
def create_banner
da = Gtk::DrawingArea.new
da.set_size_request(600, 60)
if(da.window.respond_to?('create_cairo_context'))
Signal
da.signal_connect('expose-event') do |widget, event|
cr = widget.window.create_cairo_context
cr.scale(*widget.window.size)
cr.set_line_width(0.04)
Signal
da.signal_connect('expose-event') do |widget, event|
cr = widget.window.create_cairo_context
cr.scale(*widget.window.size)
cr.set_line_width(0.04)
cr.new_path
image = Cairo::ImageSurface.from_png(driver.get_image("banner_assistant.png"))
cr.scale(1.0 / image.width, 1.0 / image.height)
cr.set_source(image, 0, 0)
cr.new_path
image = Cairo::ImageSurface.from_png(driver.get_image("banner_assistant.png"))
cr.scale(1.0 / image.width, 1.0 / image.height)
cr.set_source(image, 0, 0)
cr.paint
cr.paint
end
else
# Ugly, but better than a crash
da = Gtk::Image.new(driver.get_image("banner_assistant.png"))
end
# da = Gtk::Image.new(driver.get_image("banner_assistant.png"))
return da
end

3
msfgui
View File

@ -16,7 +16,8 @@ begin
require 'gtk2'
require 'libglade2'
rescue ::Exception => e
$stderr.puts "[*] The msfgui interface requires the ruby-gtk2 and ruby-libglade2 package"
$stderr.puts "[*] The msfgui interface requires the ruby-gtk2 and ruby-libglade2 packages"
$stderr.puts "[*] Dependencies include ruby-pango, ruby-glib2, ruby-gdkpixbuf2, and ruby-atk"
exit(0)
end