gtk+ r20204 - in trunk: . gtk



Author: kristian
Date: Wed May 28 09:02:29 2008
New Revision: 20204
URL: http://svn.gnome.org/viewvc/gtk+?rev=20204&view=rev

Log:
2008-05-28  Kristian Rietveld  <kris imendio com>

	Amendment of bug 485218 - Strange warning encountered.

	* gtk/gtktreemodelsort.[ch]
	(gtk_tree_model_sort_convert_child_iter_to_iter): return a boolean
	indication whether or not the conversion had succeeded.



Modified:
   trunk/ChangeLog
   trunk/gtk/gtktreemodelsort.c
   trunk/gtk/gtktreemodelsort.h

Modified: trunk/gtk/gtktreemodelsort.c
==============================================================================
--- trunk/gtk/gtktreemodelsort.c	(original)
+++ trunk/gtk/gtktreemodelsort.c	Wed May 28 09:02:29 2008
@@ -2060,24 +2060,29 @@
  * @child_iter: A valid #GtkTreeIter pointing to a row on the child model
  * 
  * Sets @sort_iter to point to the row in @tree_model_sort that corresponds to
- * the row pointed at by @child_iter.
+ * the row pointed at by @child_iter.  If @sort_iter was not set, %FALSE
+ * is returned.  Note: a boolean is only returned since 2.14.
+ *
+ * Return value: %TRUE, if @sort_iter was set, i.e. if @sort_iter is a
+ * valid iterator pointer to a visible row in the child model.
  **/
-void
+gboolean
 gtk_tree_model_sort_convert_child_iter_to_iter (GtkTreeModelSort *tree_model_sort,
 						GtkTreeIter      *sort_iter,
 						GtkTreeIter      *child_iter)
 {
+  gboolean ret;
   GtkTreePath *child_path, *path;
 
-  g_return_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort));
-  g_return_if_fail (tree_model_sort->child_model != NULL);
-  g_return_if_fail (sort_iter != NULL);
-  g_return_if_fail (child_iter != NULL);
+  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort), FALSE);
+  g_return_val_if_fail (tree_model_sort->child_model != NULL, FALSE);
+  g_return_val_if_fail (sort_iter != NULL, FALSE);
+  g_return_val_if_fail (child_iter != NULL, FALSE);
 
   sort_iter->stamp = 0;
 
   child_path = gtk_tree_model_get_path (tree_model_sort->child_model, child_iter);
-  g_return_if_fail (child_path != NULL);
+  g_return_val_if_fail (child_path != NULL, FALSE);
 
   path = gtk_tree_model_sort_convert_child_path_to_path (tree_model_sort, child_path);
   gtk_tree_path_free (child_path);
@@ -2085,11 +2090,14 @@
   if (!path)
     {
       g_warning ("%s: The conversion of the child path to a GtkTreeModel sort path failed", G_STRLOC);
-      return;
+      return FALSE;
     }
 
-  gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort), sort_iter, path);
+  ret = gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort),
+                                 sort_iter, path);
   gtk_tree_path_free (path);
+
+  return ret;
 }
 
 /**

Modified: trunk/gtk/gtktreemodelsort.h
==============================================================================
--- trunk/gtk/gtktreemodelsort.h	(original)
+++ trunk/gtk/gtktreemodelsort.h	Wed May 28 09:02:29 2008
@@ -82,7 +82,7 @@
 GtkTreeModel *gtk_tree_model_sort_get_model                  (GtkTreeModelSort *tree_model);
 GtkTreePath  *gtk_tree_model_sort_convert_child_path_to_path (GtkTreeModelSort *tree_model_sort,
 							      GtkTreePath      *child_path);
-void          gtk_tree_model_sort_convert_child_iter_to_iter (GtkTreeModelSort *tree_model_sort,
+gboolean      gtk_tree_model_sort_convert_child_iter_to_iter (GtkTreeModelSort *tree_model_sort,
 							      GtkTreeIter      *sort_iter,
 							      GtkTreeIter      *child_iter);
 GtkTreePath  *gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sort,



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