- add color to Gtk::Entry by running state, tooooo fun ;-)
git-svn-id: file:///home/svn/framework3/trunk@4374 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
1812154275
commit
cde840f453
|
@ -244,6 +244,8 @@ class MyModuleTree < MyGlade
|
||||||
iter[CATEGORY] = iter[CATEGORY].sub(/[0-9]+/, iter.n_children.to_s)
|
iter[CATEGORY] = iter[CATEGORY].sub(/[0-9]+/, iter.n_children.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# remove iter
|
||||||
no_child.each do |iter|
|
no_child.each do |iter|
|
||||||
@model.remove(iter)
|
@model.remove(iter)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,9 @@ module Gtk2
|
||||||
class ModuleSearch
|
class ModuleSearch
|
||||||
include Msf::Ui::Gtk2::MyControls
|
include Msf::Ui::Gtk2::MyControls
|
||||||
|
|
||||||
|
RUNNING, CLEAR = *(0..2).to_a
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initialize all stuff to perform a search
|
# Initialize all stuff to perform a search
|
||||||
#
|
#
|
||||||
|
@ -25,6 +28,7 @@ class ModuleSearch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Perform a search throught the module treeview,
|
# Perform a search throught the module treeview,
|
||||||
# and return the array result to MyModuleTree::remove
|
# and return the array result to MyModuleTree::remove
|
||||||
|
@ -38,17 +42,39 @@ class ModuleSearch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Colorize the Gtk::Entry
|
||||||
|
state(RUNNING)
|
||||||
|
|
||||||
# pass the found array to the MyModuleTree and remove all not matched iter
|
# pass the found array to the MyModuleTree and remove all not matched iter
|
||||||
$gtk2driver.module_tree.remove(found)
|
$gtk2driver.module_tree.remove(found)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Clean the Gtk::Entry and refresh the modules treeview
|
# Clean the Gtk::Entry and refresh the modules treeview
|
||||||
#
|
#
|
||||||
def cancel
|
def cancel
|
||||||
|
# clear the Gtk::Entry
|
||||||
@search_entry.set_text("")
|
@search_entry.set_text("")
|
||||||
|
|
||||||
|
# Colorize the Gtk::Entry
|
||||||
|
state(CLEAR)
|
||||||
|
|
||||||
|
# Refresh the modules treeview
|
||||||
$gtk2driver.module_tree.refresh
|
$gtk2driver.module_tree.refresh
|
||||||
end
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue