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 # Create and return a DrawingArea object
# #
def create_banner def create_banner
da = Gtk::DrawingArea.new da = Gtk::DrawingArea.new
da.set_size_request(600, 60) 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 cr.new_path
da.signal_connect('expose-event') do |widget, event| image = Cairo::ImageSurface.from_png(driver.get_image("banner_assistant.png"))
cr = widget.window.create_cairo_context cr.scale(1.0 / image.width, 1.0 / image.height)
cr.scale(*widget.window.size) cr.set_source(image, 0, 0)
cr.set_line_width(0.04)
cr.new_path cr.paint
image = Cairo::ImageSurface.from_png(driver.get_image("banner_assistant.png")) end
cr.scale(1.0 / image.width, 1.0 / image.height) else
cr.set_source(image, 0, 0) # Ugly, but better than a crash
da = Gtk::Image.new(driver.get_image("banner_assistant.png"))
cr.paint
end end
# da = Gtk::Image.new(driver.get_image("banner_assistant.png"))
return da return da
end end

3
msfgui
View File

@ -16,7 +16,8 @@ begin
require 'gtk2' require 'gtk2'
require 'libglade2' require 'libglade2'
rescue ::Exception => e 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) exit(0)
end end