- signal_connect a cancel button to clear the module search and refresh the modules treeview
git-svn-id: file:///home/svn/framework3/trunk@4372 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
bac18df17c
commit
08ff6d905f
|
@ -147,6 +147,22 @@
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="search_cancel_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="search_button">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -76,7 +76,7 @@ class MyApp < MyGlade
|
|||
$gtk2driver.log_text = @viewlogs
|
||||
|
||||
# Initialize the search class
|
||||
ModuleSearch.new(@search_entry, @search_button)
|
||||
ModuleSearch.new(@search_entry, @search_button, @search_cancel_button)
|
||||
|
||||
# Update the StatusBar with all framework modules
|
||||
refresh()
|
||||
|
|
|
@ -11,13 +11,18 @@ class ModuleSearch
|
|||
#
|
||||
# Initialize all stuff to perform a search
|
||||
#
|
||||
def initialize(search_entry, search_button)
|
||||
def initialize(search_entry, search_button, search_cancel_button)
|
||||
@search_entry = search_entry
|
||||
@search_button = search_button
|
||||
@cancel_button = search_cancel_button
|
||||
|
||||
@search_button.signal_connect('clicked') do
|
||||
search(@search_entry.text)
|
||||
end
|
||||
|
||||
@cancel_button.signal_connect('clicked') do
|
||||
cancel()
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -36,6 +41,14 @@ class ModuleSearch
|
|||
# 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
|
||||
@search_entry.set_text("")
|
||||
$gtk2driver.module_tree.refresh
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue