[evolution-data-server] Add e_source_selector_get_source_by_path()



commit 7b28d5640294b9366d4fc36b0c17a71bbdc83420
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Jan 18 17:45:34 2011 -0500

    Add e_source_selector_get_source_by_path()
    
    Backported from the "account-mgmt" branch.

 .../libedataserverui/libedataserverui-sections.txt |    1 +
 .../libedataserverui/tmpl/e-source-selector.sgml   |   10 ++++++
 libedataserverui/e-source-selector.c               |   33 ++++++++++++++++++++
 libedataserverui/e-source-selector.h               |    3 ++
 4 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/libedataserverui/libedataserverui-sections.txt b/docs/reference/libedataserverui/libedataserverui-sections.txt
index 80dc6cc..6165102 100644
--- a/docs/reference/libedataserverui/libedataserverui-sections.txt
+++ b/docs/reference/libedataserverui/libedataserverui-sections.txt
@@ -321,6 +321,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
 <SUBSECTION Standard>
 E_SOURCE_SELECTOR
 E_IS_SOURCE_SELECTOR
diff --git a/docs/reference/libedataserverui/tmpl/e-source-selector.sgml b/docs/reference/libedataserverui/tmpl/e-source-selector.sgml
index d45376b..b6909c2 100644
--- a/docs/reference/libedataserverui/tmpl/e-source-selector.sgml
+++ b/docs/reference/libedataserverui/tmpl/e-source-selector.sgml
@@ -214,3 +214,13 @@ ESourceSelector
 @Returns: 
 
 
+<!-- ##### FUNCTION e_source_selector_get_source_by_path ##### -->
+<para>
+
+</para>
+
+ selector: 
+ path: 
+ Returns: 
+
+
diff --git a/libedataserverui/e-source-selector.c b/libedataserverui/e-source-selector.c
index 1655b56..9952f69 100644
--- a/libedataserverui/e-source-selector.c
+++ b/libedataserverui/e-source-selector.c
@@ -1894,3 +1894,36 @@ e_source_selector_set_primary_selection (ESourceSelector *selector,
 	}
 }
 
+/**
+ * e_source_selector_get_source_by_path:
+ * @selector: an #ESourceSelector
+ * @path: a #GtkTreePath
+ *
+ * Returns the #ESource object at @path, or %NULL if @path is invalid.
+ *
+ * Returns: the #ESource object at @path, or %NULL
+ *
+ * Since: 2.92
+ **/
+ESource *
+e_source_selector_get_source_by_path (ESourceSelector *selector,
+                                      GtkTreePath *path)
+{
+	ESource *source = NULL;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+
+	g_return_val_if_fail (E_IS_SOURCE_SELECTOR (selector), NULL);
+	g_return_val_if_fail (path != NULL, NULL);
+
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW (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 0677d0d..73a19a2 100644
--- a/libedataserverui/e-source-selector.h
+++ b/libedataserverui/e-source-selector.h
@@ -109,6 +109,9 @@ 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
+						(ESourceSelector *selector,
+						 GtkTreePath *path);
 
 /* For backward-compatibility */
 #ifndef EDS_DISABLE_DEPRECATED



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