Add function LayerTreeStore::queue_rebuild(). Nothing uses it yet.
[synfig.git] / synfig-studio / trunk / src / gtkmm / layertreestore.cpp
index cb8440d..04e5814 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -69,6 +70,7 @@ static LayerTreeStore::Model& ModelHack()
 
 LayerTreeStore::LayerTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
        Gtk::TreeStore                  (ModelHack()),
+       queued                                  (false),
        canvas_interface_               (canvas_interface_)
 {
        layer_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
@@ -97,7 +99,8 @@ LayerTreeStore::LayerTreeStore(etl::loose_handle<synfigapp::CanvasInterface> can
 
 LayerTreeStore::~LayerTreeStore()
 {
-       synfig::info("LayerTreeStore::~LayerTreeStore(): Deleted");
+       if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
+               synfig::info("LayerTreeStore::~LayerTreeStore(): Deleted");
 }
 
 int
@@ -584,8 +587,24 @@ LayerTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, const Gtk
 }
 
 void
+LayerTreeStore::queue_rebuild()
+{
+       if (queued) return;
+       queued = false;
+       queue_connection.disconnect();
+       queue_connection=Glib::signal_timeout().connect(
+               sigc::bind_return(
+                       sigc::mem_fun(*this,&LayerTreeStore::rebuild),
+                       false
+               )
+       ,150);
+}
+
+void
 LayerTreeStore::rebuild()
 {
+       if (queued) queued = false;
+
        //etl::clock timer;timer.reset();
 
        //synfig::warning("---------rebuilding layer table---------");