[evolution-data-server] ESourceSelector: Add e_source_selector_ref_source_by_path().



commit 22286d95aca65285951a77e029b741c053430704
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Apr 21 10:49:02 2012 -0400

    ESourceSelector: Add e_source_selector_ref_source_by_path().
    
    Replaces e_source_selector_get_source_by_path().
    
    Returns a new ESource reference that the caller must unreference.

 .../libedataserverui/libedataserverui-sections.txt |    2 +-
 libedataserverui/e-source-selector.c               |   13 ++++++-------
 libedataserverui/e-source-selector.h               |    2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/docs/reference/libedataserverui/libedataserverui-sections.txt b/docs/reference/libedataserverui/libedataserverui-sections.txt
index 254456d..04d87d1 100644
--- a/docs/reference/libedataserverui/libedataserverui-sections.txt
+++ b/docs/reference/libedataserverui/libedataserverui-sections.txt
@@ -408,7 +408,7 @@ e_source_selector_get_primary_selection
 e_source_selector_set_primary_selection
 e_source_selector_get_primary_source_group
 e_source_selector_peek_primary_selection
-e_source_selector_get_source_by_path
+e_source_selector_ref_source_by_path
 <SUBSECTION Standard>
 E_SOURCE_SELECTOR
 E_IS_SOURCE_SELECTOR
diff --git a/libedataserverui/e-source-selector.c b/libedataserverui/e-source-selector.c
index 5948d25..9d6986b 100644
--- a/libedataserverui/e-source-selector.c
+++ b/libedataserverui/e-source-selector.c
@@ -1900,18 +1900,21 @@ e_source_selector_set_primary_selection (ESourceSelector *selector,
 }
 
 /**
- * e_source_selector_get_source_by_path:
+ * e_source_selector_ref_source_by_path:
  * @selector: an #ESourceSelector
  * @path: a #GtkTreePath
  *
  * Returns the #ESource object at @path, or %NULL if @path is invalid.
  *
+ * The returned #ESource is referenced for thread-safety and must be
+ * unreferenced with g_object_unref() when finished with it.
+ *
  * Returns: the #ESource object at @path, or %NULL
  *
- * Since: 3.0
+ * Since: 3.6
  **/
 ESource *
-e_source_selector_get_source_by_path (ESourceSelector *selector,
+e_source_selector_ref_source_by_path (ESourceSelector *selector,
                                       GtkTreePath *path)
 {
 	ESource *source = NULL;
@@ -1926,9 +1929,5 @@ e_source_selector_get_source_by_path (ESourceSelector *selector,
 	if (gtk_tree_model_get_iter (model, &iter, path))
 		gtk_tree_model_get (model, &iter, 0, &source, -1);
 
-	/* Return a borrowed reference. */
-	if (source != NULL)
-		g_object_unref (source);
-
 	return source;
 }
diff --git a/libedataserverui/e-source-selector.h b/libedataserverui/e-source-selector.h
index fb1dc3e..19c4930 100644
--- a/libedataserverui/e-source-selector.h
+++ b/libedataserverui/e-source-selector.h
@@ -112,7 +112,7 @@ void		e_source_selector_set_primary_selection
 						 ESource *source);
 ESourceGroup *	e_source_selector_get_primary_source_group
 						(ESourceSelector *selector);
-ESource *	e_source_selector_get_source_by_path
+ESource *	e_source_selector_ref_source_by_path
 						(ESourceSelector *selector,
 						 GtkTreePath *path);
 



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