aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-util.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-07 07:23:57 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-09 02:53:45 +0800
commitfa9051e04051156a9e11e2af72a0d7342f4ea2e4 (patch)
tree0d064bddb366257c660722359dc33f5ef3c610c7 /e-util/e-util.c
parentc9e7aa7aee6b407659843131cc8becdafa71992a (diff)
downloadgsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.gz
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.bz2
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.lz
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.xz
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.zst
gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.zip
Finish killing Bonobo.
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r--e-util/e-util.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 57ec251c55..3c004e57cb 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -407,6 +407,47 @@ e_radio_action_get_current_action (GtkRadioAction *radio_action)
}
/**
+ * e_type_traverse:
+ * @parent_type: the root #GType to traverse from
+ * @func: the function to call for each visited #GType
+ * @user_data: user data to pass to the function
+ *
+ * Calls @func for all instantiable subtypes of @parent_type.
+ *
+ * This is often useful for extending functionality by way of #EModule.
+ * A module may register a subtype of @parent_type in its e_module_load()
+ * function. Then later on the application will call e_type_traverse()
+ * to instantiate all registered subtypes of @parent_type.
+ **/
+void
+e_type_traverse (GType parent_type,
+ ETypeFunc func,
+ gpointer user_data)
+{
+ GType *children;
+ guint n_children, ii;
+
+ g_return_if_fail (func != NULL);
+
+ children = g_type_children (parent_type, &n_children);
+
+ for (ii = 0; ii < n_children; ii++) {
+ GType type = children[ii];
+
+ /* Recurse over the child's children. */
+ e_type_traverse (type, func, user_data);
+
+ /* Skip abstract types. */
+ if (G_TYPE_IS_ABSTRACT (type))
+ continue;
+
+ func (type, user_data);
+ }
+
+ g_free (children);
+}
+
+/**
* e_str_without_underscores:
* @s: the string to strip underscores from.
*