soylent r216 - trunk/libsoylent
- From: svenp svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r216 - trunk/libsoylent
- Date: Mon, 14 Jul 2008 17:37:39 +0000 (UTC)
Author: svenp
Date: Mon Jul 14 17:37:39 2008
New Revision: 216
URL: http://svn.gnome.org/viewvc/soylent?rev=216&view=rev
Log:
added a utility function to get a source from a source-tree
Modified:
   trunk/libsoylent/sl-priv-util.c
Modified: trunk/libsoylent/sl-priv-util.c
==============================================================================
--- trunk/libsoylent/sl-priv-util.c	(original)
+++ trunk/libsoylent/sl-priv-util.c	Mon Jul 14 17:37:39 2008
@@ -23,6 +23,30 @@
 
 #include "sl-priv-util.h"
 
+ESource *
+sl_priv_util_get_source (ESourceList *source_tree, const gchar *name)
+{
+  g_return_val_if_fail (name != NULL, FALSE);
+  
+  GSList *groups = e_source_list_peek_groups (source_tree);
+  for (; groups != NULL; groups = groups->next)
+    {
+      ESourceGroup *group = groups->data;
+      GSList *sources = e_source_group_peek_sources (group);
+      for (; sources != NULL; sources = sources->next)
+        {
+          ESource *source = sources->data;
+          const gchar *source_name = e_source_peek_name (source);
+          if (g_str_equal (name, source_name))
+            {
+              return source;
+            }
+        }
+    }
+    
+  return NULL;
+}
+
 ESourceGroup *
 sl_priv_util_source_tree_get_default_group (ESourceList *source_tree)
 {
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]