Add the splash screen, some reformatting

git-svn-id: file:///home/svn/framework3/trunk@5233 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2007-12-31 00:23:33 +00:00
parent a233a9c29e
commit dde128f52c
3 changed files with 390 additions and 340 deletions

View File

@ -1,5 +1,5 @@
module Msf module Msf
module Ui module Ui
module Gtk2 module Gtk2
### ###
@ -9,6 +9,7 @@ module Msf
### ###
class GladeXML < GladeXML class GladeXML < GladeXML
def connect(source, target, signal, handler, data, after = false) def connect(source, target, signal, handler, data, after = false)
@handler_proc ||= Proc.new{} @handler_proc ||= Proc.new{}
handler = canonical_handler(handler) handler = canonical_handler(handler)
if target if target
@ -78,13 +79,47 @@ module Msf
end end
end end
###
#
# This class provides the splash screen
#
###
class MySplash < Gtk::Window
include Msf::Ui::Gtk2::MyControls
def initialize
super(Gtk::Window::TOPLEVEL)
set_type_hint(Gdk::Window::TYPE_HINT_SPLASHSCREEN)
set_decorated(false)
set_window_position(Gtk::Window::POS_CENTER)
set_default_size(460,301)
set_border_width(0)
image = Gtk::Image.new(driver.get_icon("splash.png"))
image.queue_draw
add(image)
realize
show_all
end
end
### ###
# #
# This class provides the main window. # This class provides the main window.
# #
### ###
class MyApp < MyGlade class MyApp < MyGlade
attr_accessor :window
include Msf::Ui::Gtk2::MyControls include Msf::Ui::Gtk2::MyControls
def initialize def initialize
@ -255,5 +290,5 @@ module Msf
end end
end end
end end
end end

View File

@ -18,7 +18,7 @@ require 'msf/ui/gtk2/opcode'
require 'msf/ui/gtk2/framework_event_manager' require 'msf/ui/gtk2/framework_event_manager'
module Msf module Msf
module Ui module Ui
module Gtk2 module Gtk2
### ###
@ -67,11 +67,26 @@ module Msf
# Init GTK2 # Init GTK2
Gtk.init Gtk.init
# Initialize the Gtk2 application object
@gtk2app = Msf::Ui::Gtk2::MyApp.new()
# Register event handlers @splash = Msf::Ui::Gtk2::MySplash.new()
done_splash = false
Gtk.idle_add do
if(done_splash)
@gtk2app = Msf::Ui::Gtk2::MyApp.new()
@gtk2app.window.show
@splash.destroy
register_event_handlers register_event_handlers
false
else
@splash.queue_draw
done_splash = true
true
end
end
end end
# #
@ -174,5 +189,5 @@ module Msf
end end
end end
end end
end end

View File

@ -34,7 +34,7 @@ module Msf
obj.description.each_line do |line| obj.description.each_line do |line|
desc << line.strip + "\n" desc << line.strip + "\n"
end end
@buffer.insert_with_tags(start, desc, 'black_italic_wrap') @buffer.insert_with_tags(start, desc, 'black_wrap')
end end
end end