[libpeas] Remove PeasEngine's custom constructor
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Remove PeasEngine's custom constructor
- Date: Tue, 22 Sep 2015 08:09:39 +0000 (UTC)
commit 12bedd69a6e6db7f139ea0e97d16a6efbcc53faf
Author: Garrett Regier <garrettregier gmail com>
Date: Mon Sep 21 21:41:30 2015 -0700
Remove PeasEngine's custom constructor
This allows it to use a fast-path in GObject
and generally cleans up the code.
libpeas/peas-engine.c | 47 ++++++++++++++++++-----------------------------
1 files changed, 18 insertions(+), 29 deletions(-)
---
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index a667c88..0f3349d 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -325,8 +325,17 @@ peas_engine_init (PeasEngine *engine)
{
PeasEnginePrivate *priv = GET_PRIV (engine);
- /* Set the default engine here and not in constructor() to make sure
- * that if a plugin is loaded and calls peas_engine_get_default()
+ /* Don't need to use atomics as peas_engine_shutdown()
+ * is private API and as such is not multithread-safe
+ */
+ if (shutdown)
+ {
+ g_error ("libpeas cannot create a plugin engine "
+ "as it has been shutdown.");
+ }
+
+ /* Set the default engine here to make sure that if a
+ * plugin is loaded and calls peas_engine_get_default()
* that this engine is returned and not another.
*
* While peas_engine_get_default() is not thread-safe
@@ -372,32 +381,6 @@ peas_engine_garbage_collect (PeasEngine *engine)
}
}
-static GObject *
-peas_engine_constructor (GType type,
- guint n_construct_params,
- GObjectConstructParam *construct_params)
-{
- /* We don't support calling PeasEngine API without module support */
- if (!g_module_supported ())
- {
- g_error ("libpeas is not able to create the "
- "plugins engine as modules are not supported.");
- }
-
- /* Don't need to use atomics as peas_engine_shutdown()
- * is private API and as such is not multithread-safe
- */
- if (shutdown)
- {
- g_error ("libpeas cannot create a plugin engine "
- "as it has been shutdown.");
- }
-
- return G_OBJECT_CLASS (peas_engine_parent_class)->constructor (type,
- n_construct_params,
- construct_params);
-}
-
static void
peas_engine_set_property (GObject *object,
guint prop_id,
@@ -513,7 +496,6 @@ peas_engine_class_init (PeasEngineClass *klass)
GType the_type = G_TYPE_FROM_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->constructor = peas_engine_constructor;
object_class->set_property = peas_engine_set_property;
object_class->get_property = peas_engine_get_property;
object_class->dispose = peas_engine_dispose;
@@ -635,6 +617,13 @@ peas_engine_class_init (PeasEngineClass *klass)
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
+ /* We don't support calling PeasEngine API without module support */
+ if (!g_module_supported ())
+ {
+ g_error ("libpeas is not able to create the "
+ "plugins engine as modules are not supported.");
+ }
+
/* We are doing some global initialization here as there is currently no
* global init function for libpeas. */
peas_debug_init ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]