[libpeas] Cleanup PeasExtensionWrapper
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Cleanup PeasExtensionWrapper
- Date: Sat, 23 Jul 2011 12:40:19 +0000 (UTC)
commit 36ebc8d03a0e6ea78221ed7161fb34aaee493a5e
Author: Garrett Regier <garrettregier gmail com>
Date: Mon Jul 18 03:18:32 2011 -0700
Cleanup PeasExtensionWrapper
- Don't duplicate the PeasExtension docs.
- Ignore it when generating the docs.
- Remove peas-extension-priv.h
- Don't have an "exten-type" property as it could shadow the instance's
property and C plugins would not have the property.
docs/reference/Makefile.am | 2 +-
libpeas/peas-extension-priv.h | 52 --------------
libpeas/peas-extension-wrapper.c | 115 ++------------------------------
libpeas/peas-extension.c | 2 +-
loaders/gjs/peas-extension-gjs.c | 5 +-
loaders/python/peas-extension-python.c | 5 +-
loaders/seed/peas-extension-seed.c | 5 +-
7 files changed, 14 insertions(+), 172 deletions(-)
---
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index df81c16..4e6e144 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -48,7 +48,7 @@ IGNORE_HFILES= \
peas-debug.h \
peas-dirs.h \
peas-engine-priv.h \
- peas-extension-priv.h \
+ peas-extension-wrapper.h \
peas-extension-subclasses.h \
peas-gtk-disable-plugins-dialog.h \
peas-gtk-plugin-manager-store.h \
diff --git a/libpeas/peas-extension-wrapper.c b/libpeas/peas-extension-wrapper.c
index 88f4583..d55fd6e 100644
--- a/libpeas/peas-extension-wrapper.c
+++ b/libpeas/peas-extension-wrapper.c
@@ -26,93 +26,14 @@
#include "peas-extension-wrapper.h"
#include "peas-introspection.h"
-/**
- * SECTION:peas-extension
- * @short_description: Proxy for extensions.
- * @see_also: #PeasExtensionSet
- *
- * #PeasExtension is a proxy class used to access actual extensions
- * implemented using various languages. As such, the application writer will
- * use #PeasExtension instances to call methods on extension provided by
- * loaded plugins.
- *
- * To properly use the proxy instances, you will need GObject-introspection
- * data for the #GInterface or #GObjectClass you want to use as an extension
- * point. For instance, if you wish to use #PeasActivatable, you will need to
- * put the following code excerpt in the engine initialization code, in order
- * to load the required "Peas" typelib:
- *
- * |[
- * g_irepository_require (g_irepository_get_default (),
- * "Peas", "1.0", 0, NULL);
- * ]|
- *
- * You should proceed the same way for any namespace which provides interfaces
- * you want to use as extension points. GObject-introspection data is required
- * for all the supported languages, even for C.
- *
- * #PeasExtension does not provide any way to access the underlying object.
- * The main reason is that some loaders may not rely on proper GObject
- * inheritance for the definition of extensions, and hence it would not be
- * possible for libpeas to provide a functional GObject instance at all.
- * Another reason is that it makes reference counting issues easier to deal
- * with.
- *
- * See peas_extension_call() for more information.
- **/
-
G_DEFINE_ABSTRACT_TYPE (PeasExtensionWrapper, peas_extension_wrapper, G_TYPE_OBJECT);
-/* Properties */
-enum {
- PROP_0,
- PROP_EXTENSION_TYPE
-};
-
static void
peas_extension_wrapper_init (PeasExtensionWrapper *exten)
{
}
static void
-peas_extension_wrapper_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- PeasExtensionWrapper *exten = PEAS_EXTENSION_WRAPPER (object);
-
- switch (prop_id)
- {
- case PROP_EXTENSION_TYPE:
- exten->exten_type = g_value_get_gtype (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-peas_extension_wrapper_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- PeasExtensionWrapper *exten = PEAS_EXTENSION_WRAPPER (object);
-
- switch (prop_id)
- {
- case PROP_EXTENSION_TYPE:
- g_value_set_gtype (value, exten->exten_type);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
peas_extension_wrapper_constructed (GObject *object)
{
PeasExtensionWrapper *exten = PEAS_EXTENSION_WRAPPER (object);
@@ -128,18 +49,11 @@ peas_extension_wrapper_class_init (PeasExtensionWrapperClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->set_property = peas_extension_wrapper_set_property;
- object_class->get_property = peas_extension_wrapper_get_property;
object_class->constructed = peas_extension_wrapper_constructed;
- g_object_class_install_property (object_class, PROP_EXTENSION_TYPE,
- g_param_spec_gtype ("extension-type",
- "Extension Type",
- "The GType of the interface being proxied",
- G_TYPE_NONE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ /* Don't add properties as they could shadow the instance's
+ * and C plugins would not have the property.
+ */
}
GType
@@ -150,28 +64,11 @@ peas_extension_wrapper_get_extension_type (PeasExtensionWrapper *exten)
return exten->exten_type;
}
-/**
- * peas_extension_callv:
- * @exten: A #PeasExtension.
- * @method_name: the name of the method that should be called.
- * @args: the arguments for the method.
- * @return_value: the return falue for the method.
- *
- * Call a method of the object behind @extension, using @args as arguments.
- *
- * See peas_extension_call() for more information.
- *
- * Return value: (transfer full): %TRUE on successful call.
- *
- * Deprecated: 1.2. Use the dynamically implemented interface instead.
- *
- * Rename to: peas_extension_call
- */
gboolean
peas_extension_wrapper_callv (PeasExtensionWrapper *exten,
- const gchar *method_name,
- GIArgument *args,
- GIArgument *return_value)
+ const gchar *method_name,
+ GIArgument *args,
+ GIArgument *return_value)
{
PeasExtensionWrapperClass *klass;
diff --git a/libpeas/peas-extension.c b/libpeas/peas-extension.c
index bec5b2b..16bea52 100644
--- a/libpeas/peas-extension.c
+++ b/libpeas/peas-extension.c
@@ -62,7 +62,7 @@
* See peas_extension_call() for more information.
**/
GType
-peas_extension_get_type ()
+peas_extension_get_type (void)
{
return G_TYPE_OBJECT;
}
diff --git a/loaders/gjs/peas-extension-gjs.c b/loaders/gjs/peas-extension-gjs.c
index fd46b10..1d600f5 100644
--- a/loaders/gjs/peas-extension-gjs.c
+++ b/loaders/gjs/peas-extension-gjs.c
@@ -410,12 +410,11 @@ peas_extension_gjs_new (GType exten_type,
g_return_val_if_fail (js_object != NULL, NULL);
real_type = peas_extension_register_subclass (PEAS_TYPE_EXTENSION_GJS, exten_type);
- gexten = PEAS_EXTENSION_GJS (g_object_new (real_type,
- "extension-type", exten_type,
- NULL));
+ gexten = PEAS_EXTENSION_GJS (g_object_new (real_type, NULL));
gexten->js_context = js_context;
gexten->js_object = js_object;
+ PEAS_EXTENSION_WRAPPER (gexten)->exten_type = exten_type;
JS_AddObjectRoot (gexten->js_context, &gexten->js_object);
return G_OBJECT (gexten);
diff --git a/loaders/python/peas-extension-python.c b/loaders/python/peas-extension-python.c
index e0e88b7..dd01a00 100644
--- a/loaders/python/peas-extension-python.c
+++ b/loaders/python/peas-extension-python.c
@@ -142,11 +142,10 @@ peas_extension_python_new (GType gtype,
GType real_type;
real_type = peas_extension_register_subclass (PEAS_TYPE_EXTENSION_PYTHON, gtype);
- pyexten = PEAS_EXTENSION_PYTHON (g_object_new (real_type,
- "extension-type", gtype,
- NULL));
+ pyexten = PEAS_EXTENSION_PYTHON (g_object_new (real_type, NULL));
pyexten->instance = instance;
+ PEAS_EXTENSION_WRAPPER (pyexten)->exten_type = gtype;
Py_INCREF (instance);
return G_OBJECT (pyexten);
diff --git a/loaders/seed/peas-extension-seed.c b/loaders/seed/peas-extension-seed.c
index 28622bf..0aa66d1 100644
--- a/loaders/seed/peas-extension-seed.c
+++ b/loaders/seed/peas-extension-seed.c
@@ -314,12 +314,11 @@ peas_extension_seed_new (GType exten_type,
g_return_val_if_fail (js_object != NULL, NULL);
real_type = peas_extension_register_subclass (PEAS_TYPE_EXTENSION_SEED, exten_type);
- sexten = PEAS_EXTENSION_SEED (g_object_new (real_type,
- "extension-type", exten_type,
- NULL));
+ sexten = PEAS_EXTENSION_SEED (g_object_new (real_type, NULL));
sexten->js_context = js_context;
sexten->js_object = js_object;
+ PEAS_EXTENSION_WRAPPER (sexten)->exten_type = exten_type;
seed_context_ref (sexten->js_context);
seed_value_protect (sexten->js_context, sexten->js_object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]