ESourceSelector: Add e_source_selector_ref_source_by_path().
authorMatthew Barnes <mbarnes@redhat.com>
Sat, 21 Apr 2012 14:49:02 +0000 (10:49 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Sat, 21 Apr 2012 17:23:31 +0000 (13:23 -0400)
Replaces e_source_selector_get_source_by_path().

Returns a new ESource reference that the caller must unreference.

docs/reference/libedataserverui/libedataserverui-sections.txt
libedataserverui/e-source-selector.c
libedataserverui/e-source-selector.h

index 254456d..04d87d1 100644 (file)
@@ -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
index 5948d25..9d6986b 100644 (file)
@@ -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;
 }
index fb1dc3e..19c4930 100644 (file)
@@ -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);