- add color to Gtk::Entry by running state, tooooo fun ;-)

git-svn-id: file:///home/svn/framework3/trunk@4374 4d416f70-5f16-0410-b530-b9f4589650da
unstable
fab 2007-02-13 14:38:15 +00:00
parent 1812154275
commit cde840f453
2 changed files with 28 additions and 0 deletions

View File

@ -244,6 +244,8 @@ class MyModuleTree < MyGlade
iter[CATEGORY] = iter[CATEGORY].sub(/[0-9]+/, iter.n_children.to_s)
end
end
# remove iter
no_child.each do |iter|
@model.remove(iter)
end

View File

@ -8,6 +8,9 @@ module Gtk2
class ModuleSearch
include Msf::Ui::Gtk2::MyControls
RUNNING, CLEAR = *(0..2).to_a
#
# Initialize all stuff to perform a search
#
@ -25,6 +28,7 @@ class ModuleSearch
end
end
#
# Perform a search throught the module treeview,
# and return the array result to MyModuleTree::remove
@ -38,17 +42,39 @@ class ModuleSearch
end
end
# Colorize the Gtk::Entry
state(RUNNING)
# pass the found array to the MyModuleTree and remove all not matched iter
$gtk2driver.module_tree.remove(found)
end
#
# Clean the Gtk::Entry and refresh the modules treeview
#
def cancel
# clear the Gtk::Entry
@search_entry.set_text("")
# Colorize the Gtk::Entry
state(CLEAR)
# Refresh the modules treeview
$gtk2driver.module_tree.refresh
end
#
# Colorize the Gtk::Entry by state parameter
#
def state(state)
if (state == RUNNING)
@search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('gray'))
elsif (state == CLEAR)
@search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('white'))
end
end
end
end