[libpeas] Privatize PeasExtensionClass



commit ab6e1616cecfa630afe79bac2e4b8744961d5d64
Author: Garrett Regier <alias301 gmail com>
Date:   Mon Mar 21 06:38:05 2011 -0700

    Privatize PeasExtensionClass
    
    Subclassing PeasExtension has never been supported. Only loaders
    embedded in libpeas should use such subclasses.

 libpeas/peas-extension-priv.h             |   18 +++++++++++++++++-
 libpeas/peas-extension.h                  |   23 -----------------------
 loaders/c/peas-extension-c.h              |    2 +-
 loaders/python/peas-extension-python.h    |    2 +-
 loaders/seed/peas-extension-seed.h        |    2 +-
 tests/libpeas/testing/testing-extension.c |   21 ---------------------
 tests/libpeas/testing/testing-extension.h |    2 --
 7 files changed, 20 insertions(+), 50 deletions(-)
---
diff --git a/libpeas/peas-extension-priv.h b/libpeas/peas-extension-priv.h
index ee4416e..aad7ece 100644
--- a/libpeas/peas-extension-priv.h
+++ b/libpeas/peas-extension-priv.h
@@ -22,10 +22,26 @@
 #ifndef __PEAS_EXTENSION_PRIV_H__
 #define __PEAS_EXTENSION_PRIV_H__
 
-#include "peas-extension-priv.h"
+#include "peas-extension.h"
 
 G_BEGIN_DECLS
 
+#define PEAS_EXTENSION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PEAS_TYPE_EXTENSION, PeasExtensionClass))
+#define PEAS_IS_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PEAS_TYPE_EXTENSION))
+#define PEAS_EXTENSION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PEAS_TYPE_EXTENSION, PeasExtensionClass))
+
+typedef struct _PeasExtensionClass    PeasExtensionClass;
+
+struct _PeasExtensionClass {
+  GObjectClass parent_class;
+
+  /*< private >*/
+  gboolean   (*call)                      (PeasExtension  *exten,
+                                           const gchar    *method,
+                                           GIArgument     *args,
+                                           GIArgument     *return_value);
+};
+
 struct _PeasExtensionPrivate {
   GType exten_type;
   gboolean constructed;
diff --git a/libpeas/peas-extension.h b/libpeas/peas-extension.h
index c1f3a56..81b125d 100644
--- a/libpeas/peas-extension.h
+++ b/libpeas/peas-extension.h
@@ -32,13 +32,9 @@ G_BEGIN_DECLS
  */
 #define PEAS_TYPE_EXTENSION            (peas_extension_get_type())
 #define PEAS_EXTENSION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), PEAS_TYPE_EXTENSION, PeasExtension))
-#define PEAS_EXTENSION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PEAS_TYPE_EXTENSION, PeasExtensionClass))
 #define PEAS_IS_EXTENSION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), PEAS_TYPE_EXTENSION))
-#define PEAS_IS_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PEAS_TYPE_EXTENSION))
-#define PEAS_EXTENSION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PEAS_TYPE_EXTENSION, PeasExtensionClass))
 
 typedef struct _PeasExtension         PeasExtension;
-typedef struct _PeasExtensionClass    PeasExtensionClass;
 typedef struct _PeasExtensionPrivate  PeasExtensionPrivate;
 
 /**
@@ -54,25 +50,6 @@ struct _PeasExtension {
   PeasExtensionPrivate *priv;
 };
 
-/**
- * PeasExtensionClass:
- *
- * The #PeasExtensionClass structure contains only private data and should
- * only be accessed using the provided API.  You should not inherit from this
- * class.
- */
-struct _PeasExtensionClass {
-  GObjectClass parent_class;
-
-  /*< private >*/
-  gboolean   (*call)                      (PeasExtension  *exten,
-                                           const gchar    *method,
-                                           GIArgument     *args,
-                                           GIArgument     *return_value);
-
-  gpointer padding[8];
-};
-
 /*
  * Public methods
  */
diff --git a/loaders/c/peas-extension-c.h b/loaders/c/peas-extension-c.h
index a2f75f7..1f133a4 100644
--- a/loaders/c/peas-extension-c.h
+++ b/loaders/c/peas-extension-c.h
@@ -22,7 +22,7 @@
 #ifndef __PEAS_EXTENSION_C_H__
 #define __PEAS_EXTENSION_C_H__
 
-#include <libpeas/peas-extension.h>
+#include <libpeas/peas-extension-priv.h>
 
 G_BEGIN_DECLS
 
diff --git a/loaders/python/peas-extension-python.h b/loaders/python/peas-extension-python.h
index 476ae69..5f8ab41 100644
--- a/loaders/python/peas-extension-python.h
+++ b/loaders/python/peas-extension-python.h
@@ -22,7 +22,7 @@
 #ifndef __PEAS_EXTENSION_PYTHON_H__
 #define __PEAS_EXTENSION_PYTHON_H__
 
-#include <libpeas/peas-extension.h>
+#include <libpeas/peas-extension-priv.h>
 /* _POSIX_C_SOURCE is defined in Python.h and in limits.h included by
  * <libpeas/peas-extension.h>, so we unset it here to avoid a warning.
  * Yep, that's bad. */
diff --git a/loaders/seed/peas-extension-seed.h b/loaders/seed/peas-extension-seed.h
index 43082a6..568716e 100644
--- a/loaders/seed/peas-extension-seed.h
+++ b/loaders/seed/peas-extension-seed.h
@@ -22,7 +22,7 @@
 #ifndef __PEAS_EXTENSION_SEED_H__
 #define __PEAS_EXTENSION_SEED_H__
 
-#include <libpeas/peas-extension.h>
+#include <libpeas/peas-extension-priv.h>
 #include <seed.h>
 
 G_BEGIN_DECLS
diff --git a/tests/libpeas/testing/testing-extension.c b/tests/libpeas/testing/testing-extension.c
index 661e39e..59a0515 100644
--- a/tests/libpeas/testing/testing-extension.c
+++ b/tests/libpeas/testing/testing-extension.c
@@ -203,27 +203,6 @@ testing_extension_reload_ (PeasEngine *engine)
 }
 
 void
-testing_extension_call_invalid_ (PeasEngine *engine)
-{
-  PeasPluginInfo *info;
-  PeasExtension *extension;
-
-  testing_util_push_log_hook ("*Method 'IntrospectionCallable.invalid' not found*");
-
-  info = peas_engine_get_plugin_info (engine, extension_plugin);
-
-  g_assert (peas_engine_load_plugin (engine, info));
-
-  extension = peas_engine_create_extension (engine, info,
-                                            INTROSPECTION_TYPE_CALLABLE,
-                                            NULL);
-
-  peas_extension_call (extension, "invalid", NULL);
-
-  g_object_unref (extension);
-}
-
-void
 testing_extension_call_no_args_ (PeasEngine *engine)
 {
   PeasPluginInfo *info;
diff --git a/tests/libpeas/testing/testing-extension.h b/tests/libpeas/testing/testing-extension.h
index 8e2b3fc..1f8ad56 100644
--- a/tests/libpeas/testing/testing-extension.h
+++ b/tests/libpeas/testing/testing-extension.h
@@ -49,7 +49,6 @@ void testing_extension_provides_invalid_          (PeasEngine *engine);
 void testing_extension_create_valid_              (PeasEngine *engine);
 void testing_extension_create_invalid_            (PeasEngine *engine);
 void testing_extension_reload_                    (PeasEngine *engine);
-void testing_extension_call_invalid_              (PeasEngine *engine);
 void testing_extension_call_no_args_              (PeasEngine *engine);
 void testing_extension_call_with_return_          (PeasEngine *engine);
 void testing_extension_call_single_arg_           (PeasEngine *engine);
@@ -85,7 +84,6 @@ void testing_extension_properties_readwrite_      (PeasEngine *engine);
 \
   _EXTENSION_TEST (loader, "reload", reload); \
 \
-  _EXTENSION_TEST (loader, "call-invalid", call_invalid); \
   _EXTENSION_TEST (loader, "call-no-args", call_no_args); \
   _EXTENSION_TEST (loader, "call-with-return", call_with_return); \
   _EXTENSION_TEST (loader, "call-single-arg", call_single_arg); \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]