[glibmm] Add Glib::ObjectBase::freeze_notify()/thaw_notify. Fixes Bug #575533



commit fe5a4a830c714742d83d6d531a638b3eb85476aa
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Sun Jul 26 23:23:41 2009 -0500

    Add Glib::ObjectBase::freeze_notify()/thaw_notify.  Fixes Bug #575533

 ChangeLog                 |    6 ++++++
 glib/glibmm/objectbase.cc |   10 ++++++++++
 glib/glibmm/objectbase.h  |   18 ++++++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7ec7e05..12d4e64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-26  Jonathon Jongsma  <jonathon jongsma collabora co uk>
+
+	* glib/glibmm/objectbase.cc:
+	* glib/glibmm/objectbase.h: add freeze_notify()/thaw_notify.  Fixes
+	  Bug #575533
+
 2009-07-26  Jonathon Jongsma  <jonathon quotidian org>
 
 	* gio/src/memoryinputstream.ccg: fix a build error with explicit
diff --git a/glib/glibmm/objectbase.cc b/glib/glibmm/objectbase.cc
index a7a9504..87e9e0b 100644
--- a/glib/glibmm/objectbase.cc
+++ b/glib/glibmm/objectbase.cc
@@ -278,6 +278,16 @@ sigc::connection ObjectBase::connect_property_changed_with_return(const Glib::us
   return sigc::connection(pConnectionNode->slot_);
 }
 
+void ObjectBase::freeze_notify()
+{
+  g_object_freeze_notify (gobj());
+}
+
+void ObjectBase::thaw_notify()
+{
+  g_object_thaw_notify (gobj());
+}
+
 
 
 bool _gobject_cppinstance_already_deleted(GObject* gobject)
diff --git a/glib/glibmm/objectbase.h b/glib/glibmm/objectbase.h
index 5403121..cbee1d9 100644
--- a/glib/glibmm/objectbase.h
+++ b/glib/glibmm/objectbase.h
@@ -125,6 +125,24 @@ public:
    */
   sigc::connection connect_property_changed_with_return(const Glib::ustring& property_name, const sigc::slot<void>& slot);
 
+  /** Increases the freeze count on object. If the freeze count is non-zero, the
+   * emission of "notify" signals on object is stopped. The signals are queued
+   * until the freeze count is decreased to zero.
+   *
+   * This is necessary for accessors that modify multiple properties to prevent
+   * premature notification while the object is still being modified.
+   */
+  void freeze_notify();
+
+  /** 
+   * Reverts the effect of a previous call to freeze_notify(). The freeze count
+   * is decreased on object and when it reaches zero, all queued "notify"
+   * signals are emitted.
+   *
+   * It is an error to call this function when the freeze count is zero.
+   */
+  void thaw_notify();
+
   //TODO: Why are these virtual?
   /** Increment the reference count for this object.
    * You should never need to do this manually - use the object via a RefPtr instead.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]