When the user types in the History dialog, search for any text in the 'name' column...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 14 Jan 2008 23:02:11 +0000 (23:02 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 14 Jan 2008 23:02:11 +0000 (23:02 +0000)
git-svn-id: http://svn.voria.com/code@1366 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/dock_history.cpp
synfig-studio/trunk/src/gtkmm/historytreestore.cpp
synfig-studio/trunk/src/gtkmm/historytreestore.h

index d124cd1..9e9a5ba 100644 (file)
@@ -228,6 +228,9 @@ Dock_History::create_action_tree()
                action_tree->append_column(*column);
        }
 
+       action_tree->set_enable_search(true);
+       action_tree->set_search_column(history_tree_model.name);
+       action_tree->set_search_equal_func(sigc::ptr_fun(&studio::HistoryTreeStore::search_func));
 
        action_tree->set_rules_hint();
 //     action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_History::on_row_activate));
index ad4fe57..b9573c8 100644 (file)
@@ -215,3 +215,15 @@ HistoryTreeStore::on_action_status_changed(etl::handle<synfigapp::Action::Undoab
                }
        }
 }
+
+bool
+HistoryTreeStore::search_func(const Glib::RefPtr<Gtk::TreeModel>&,int,const Glib::ustring& x,const Gtk::TreeModel::iterator& iter)
+{
+       const Model model;
+
+       Glib::ustring substr(x.uppercase());
+       Glib::ustring name((*iter)[model.name]);
+       name=name.uppercase();
+
+       return name.find(substr)==Glib::ustring::npos;
+}
index 4c4e23a..3674faf 100644 (file)
@@ -136,6 +136,8 @@ public:
 
        void insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool is_active=true, bool is_undo=true, bool is_redo=false);
 
+       static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
+
        /*
  -- ** -- P R O T E C T E D   M E T H O D S -----------------------------------
        */