gtkmm r1081 - in trunk: . gtk/src



Author: murrayc
Date: Mon Jan 19 12:08:00 2009
New Revision: 1081
URL: http://svn.gnome.org/viewvc/gtkmm?rev=1081&view=rev

Log:
2009-01-19  Murray Cumming  <murrayc murrayc com>

* gtk/src/treepath.ccg:
* gtk/src/treepath.hg: empty(): Also check for a null underlying 


Modified:
   trunk/ChangeLog
   trunk/gtk/src/treepath.ccg
   trunk/gtk/src/treepath.hg

Modified: trunk/gtk/src/treepath.ccg
==============================================================================
--- trunk/gtk/src/treepath.ccg	(original)
+++ trunk/gtk/src/treepath.ccg	Mon Jan 19 12:08:00 2009
@@ -28,7 +28,7 @@
 
 TreePath::TreePath(TreePath::size_type n, TreePath::value_type value)
 :
-  gobject_ (gtk_tree_path_new())
+  gobject_(gtk_tree_path_new())
 {
   for(; n > 0; --n)
     gtk_tree_path_append_index(gobject_, value);
@@ -47,7 +47,7 @@
 
 TreePath& TreePath::operator=(const TreeModel::iterator& iter)
 {
-  TreePath temp (iter);
+  TreePath temp(iter);
   swap(temp);
   return *this;
 }
@@ -63,8 +63,16 @@
   return gtk_tree_path_get_depth(gobject_);
 }
 
+TreePath::operator bool() const
+{
+  return !empty();
+}
+
 bool TreePath::empty() const
 {
+  if(!gobject_)
+    return false;
+
   return (gtk_tree_path_get_depth(gobject_) == 0);
 }
 

Modified: trunk/gtk/src/treepath.hg
==============================================================================
--- trunk/gtk/src/treepath.hg	(original)
+++ trunk/gtk/src/treepath.hg	Mon Jan 19 12:08:00 2009
@@ -88,6 +88,11 @@
   // I think it's OK for this assignment to be implicit.  It's very useful.
   TreePath& operator=(const TreeModel::iterator& iter);
 
+  /** Checks that the path is not empty, by calling empty().
+   * @newin2p16
+   */
+  operator bool() const;
+
   template <class In> inline void assign(In pbegin, In pend);
   template <class In>        void append(In pbegin, In pend);
 



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