[libpeas] Add way to get a PeasExtension from a PeasExtensionSet
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Add way to get a PeasExtension from a PeasExtensionSet
- Date: Mon, 16 Aug 2010 19:28:36 +0000 (UTC)
commit 436e78704fbc5d5d985d6453decf729ebbede4b6
Author: Bastien Nocera <hadess hadess net>
Date: Wed Aug 11 13:37:10 2010 +0100
Add way to get a PeasExtension from a PeasExtensionSet
So that applications do not need to do their own book-keeping
of the existing PeasExtensions.
https://bugzilla.gnome.org/show_bug.cgi?id=626622
docs/reference/libpeas-sections.txt | 1 +
libpeas/peas-extension-set.c | 30 ++++++++++++++++++++++++++++++
libpeas/peas-extension-set.h | 3 +++
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/libpeas-sections.txt b/docs/reference/libpeas-sections.txt
index afcb288..c7cebbb 100644
--- a/docs/reference/libpeas-sections.txt
+++ b/docs/reference/libpeas-sections.txt
@@ -112,6 +112,7 @@ PeasExtensionSetClass
PeasParameterArray
peas_extension_set_call
peas_extension_set_call_valist
+peas_extension_set_get_extension
peas_extension_set_new
peas_extension_set_newv
peas_extension_set_new_valist
diff --git a/libpeas/peas-extension-set.c b/libpeas/peas-extension-set.c
index 9e3120f..d2e6418 100644
--- a/libpeas/peas-extension-set.c
+++ b/libpeas/peas-extension-set.c
@@ -421,6 +421,36 @@ peas_extension_set_class_init (PeasExtensionSetClass *klass)
}
/**
+ * *peas_extension_set_get_extension:
+ * @set: A #PeasExtensionSet
+ * @info: a #PeasPluginInfo
+ *
+ * Returns the #PeasExtension object corresponding to @info, or %NULL
+ * if the plugin doesn't provide such an extension.
+ *
+ * Returns: a reference to a #PeasExtension or %NULL
+ */
+PeasExtension *
+peas_extension_set_get_extension (PeasExtensionSet *set,
+ PeasPluginInfo *info)
+{
+ GList *l;
+
+ g_return_val_if_fail (PEAS_IS_EXTENSION_SET (set), NULL);
+ g_return_val_if_fail (info != NULL, NULL);
+
+ for (l = set->priv->extensions; l != NULL; l = l->next)
+ {
+ ExtensionItem *item = l->data;
+
+ if (item->info == info)
+ return item->exten;
+ }
+
+ return NULL;
+}
+
+/**
* peas_extension_set_call:
* @set: A #PeasExtensionSet.
* @method_name: the name of the method that should be called.
diff --git a/libpeas/peas-extension-set.h b/libpeas/peas-extension-set.h
index a2e969e..33c3bf4 100644
--- a/libpeas/peas-extension-set.h
+++ b/libpeas/peas-extension-set.h
@@ -95,6 +95,9 @@ gboolean peas_extension_set_call_valist (PeasExtensionSet *set,
const gchar *method_name,
va_list args);
+PeasExtension *peas_extension_set_get_extension (PeasExtensionSet *set,
+ PeasPluginInfo *info);
+
PeasExtensionSet *peas_extension_set_newv (PeasEngine *engine,
GType exten_type,
guint n_parameters,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]