[vinagre] Convert plugins to use VinagreStaticExtension



commit 9ba6959f8e8e8bbb9287d1e4726e534ecc6568d3
Author: David King <amigadave amigadave com>
Date:   Fri Jun 10 18:59:59 2011 +0200

    Convert plugins to use VinagreStaticExtension
    
    This removes libpeas support from plugins, making them use the simpler
    static extension class.

 Makefile.am                                      |    4 ++++
 plugins/rdp/vinagre-rdp-plugin.c                 |   22 ++++++++++------------
 plugins/rdp/vinagre-rdp-plugin.h                 |    9 ++++-----
 plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c |   22 ++++++++++------------
 plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h |    9 ++++-----
 plugins/spice/vinagre-spice-plugin.c             |   22 ++++++++++------------
 plugins/spice/vinagre-spice-plugin.h             |    9 ++++-----
 plugins/ssh/vinagre-ssh-plugin.c                 |   22 ++++++++++------------
 plugins/ssh/vinagre-ssh-plugin.h                 |    9 ++++-----
 plugins/vnc/vinagre-vnc-plugin.c                 |   22 ++++++++++------------
 plugins/vnc/vinagre-vnc-plugin.h                 |    9 ++++-----
 11 files changed, 74 insertions(+), 85 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e9f26c0..91a76f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,6 +40,10 @@ vinagre_vinagre_LDADD = \
 	$(VINAGRE_LIBS) \
 	$(GTKVNC_LIBS) \
 	$(INTROSPECTION_LIBS)
+	$(rdp_plugin) \
+	$(spice_plugin) \
+	$(ssh_plugin) \
+	libvnc.la
 
 vinagrehdir = $(includedir)/vinagre- VINAGRE_ABI_VERSION@/vinagre
 
diff --git a/plugins/rdp/vinagre-rdp-plugin.c b/plugins/rdp/vinagre-rdp-plugin.c
index 3daa3cd..dfb4c9c 100644
--- a/plugins/rdp/vinagre-rdp-plugin.c
+++ b/plugins/rdp/vinagre-rdp-plugin.c
@@ -34,12 +34,12 @@
 
 static void vinagre_rdp_protocol_iface_init (VinagreProtocolInterface *iface);
 
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (VinagreRdpPlugin,
-				vinagre_rdp_plugin,
-				PEAS_TYPE_EXTENSION_BASE,
-				0,
-				G_IMPLEMENT_INTERFACE_DYNAMIC (VINAGRE_TYPE_PROTOCOL,
-							       vinagre_rdp_protocol_iface_init))
+G_DEFINE_TYPE_EXTENDED (VinagreRdpPlugin,
+			vinagre_rdp_plugin,
+			VINAGRE_TYPE_STATIC_EXTENSION,
+			0,
+			G_IMPLEMENT_INTERFACE (VINAGRE_TYPE_PROTOCOL,
+					       vinagre_rdp_protocol_iface_init))
 
 static const gchar *
 impl_get_protocol (VinagreProtocol *plugin)
@@ -144,13 +144,11 @@ vinagre_rdp_plugin_class_init (VinagreRdpPluginClass *klass)
 {
 }
 
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
+__attribute__((constructor)) void
+rdp_register_types (void)
 {
-  vinagre_rdp_plugin_register_type (G_TYPE_MODULE (module));
-  peas_object_module_register_extension_type (module,
-					      VINAGRE_TYPE_PROTOCOL,
-					      VINAGRE_TYPE_RDP_PLUGIN);
+  g_type_init ();
+  volatile dontoptimiseaway = vinagre_rdp_plugin_get_type ();
 }
 
 /* vim: set ts=8: */
diff --git a/plugins/rdp/vinagre-rdp-plugin.h b/plugins/rdp/vinagre-rdp-plugin.h
index 0e53590..db4256d 100644
--- a/plugins/rdp/vinagre-rdp-plugin.h
+++ b/plugins/rdp/vinagre-rdp-plugin.h
@@ -23,7 +23,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <libpeas/peas.h>
+
+#include "vinagre/vinagre-static-extension.h"
 
 G_BEGIN_DECLS
 
@@ -42,18 +43,16 @@ typedef struct _VinagreRdpPluginClass	VinagreRdpPluginClass;
 
 struct _VinagreRdpPlugin
 {
-  PeasExtensionBase parent_instance;
+  VinagreStaticExtension parent_instance;
 };
 
 struct _VinagreRdpPluginClass
 {
-  PeasExtensionBaseClass parent_class;
+  VinagreStaticExtensionClass parent_class;
 };
 
 GType vinagre_rdp_plugin_get_type (void) G_GNUC_CONST;
 
-G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
-
 G_END_DECLS
 
 #endif /* __VINAGRE_RDP_PLUGIN_H__ */
diff --git a/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c b/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c
index 347b9df..91d4368 100644
--- a/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c
+++ b/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c
@@ -34,12 +34,12 @@
 #define WINDOW_DATA_KEY "VinagreVNCPluginWindowData"
 
 static void vnc_activatable_iface_init (PeasActivatableInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (VinagreReverseVncPlugin,
-				vinagre_reverse_vnc_plugin,
-				PEAS_TYPE_EXTENSION_BASE,
-				0,
-				G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
-							       vnc_activatable_iface_init))
+G_DEFINE_TYPE_EXTENDED (VinagreReverseVncPlugin,
+			vinagre_reverse_vnc_plugin,
+			VINAGRE_TYPE_STATIC_EXTENSION,
+			0,
+			G_IMPLEMENT_INTERFACE (VINAGRE_TYPE_ACTIVATABLE,
+					       vnc_activatable_iface_init))
 
 struct _VinagreReverseVncPluginPrivate
 {
@@ -234,13 +234,11 @@ vnc_activatable_iface_init (PeasActivatableInterface *iface)
   iface->deactivate = impl_deactivate;
 }
 
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
+__attribute__((constructor)) void
+reverse_vnc_register_types (void)
 {
-  vinagre_reverse_vnc_plugin_register_type (G_TYPE_MODULE (module));
-  peas_object_module_register_extension_type (module,
-					      PEAS_TYPE_ACTIVATABLE,
-					      VINAGRE_TYPE_REVERSE_VNC_PLUGIN);
+  g_type_init ();
+  volatile dontoptimiseaway = vinagre_reverse_vnc_plugin_get_type ();
 }
 
 /* vim: set ts=8: */
diff --git a/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h b/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h
index c5e3684..b7f70d6 100644
--- a/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h
+++ b/plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h
@@ -24,7 +24,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <libpeas/peas.h>
+
+#include "vinagre/vinagre-static-extension.h"
 
 G_BEGIN_DECLS
 
@@ -44,19 +45,17 @@ typedef struct _VinagreReverseVncPluginPrivate	VinagreReverseVncPluginPrivate;
 
 struct _VinagreReverseVncPlugin
 {
-  PeasExtensionBase parent_instance;
+  VinagreStaticExtension parent_instance;
   VinagreReverseVncPluginPrivate *priv;
 };
 
 struct _VinagreReverseVncPluginClass
 {
-  PeasExtensionBaseClass parent_class;
+  VinagreStaticExtensionClass parent_class;
 };
 
 GType vinagre_reverse_vnc_plugin_get_type (void) G_GNUC_CONST;
 
-G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
-
 G_END_DECLS
 
 #endif /* __VINAGRE_REVERSE_VNC_PLUGIN_H__ */
diff --git a/plugins/spice/vinagre-spice-plugin.c b/plugins/spice/vinagre-spice-plugin.c
index 2a1c182..b4d8a99 100644
--- a/plugins/spice/vinagre-spice-plugin.c
+++ b/plugins/spice/vinagre-spice-plugin.c
@@ -35,12 +35,12 @@
 
 static void vinagre_spice_protocol_iface_init (VinagreProtocolInterface *iface);
 
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (VinagreSpicePlugin,
-				vinagre_spice_plugin,
-				PEAS_TYPE_EXTENSION_BASE,
-				0,
-				G_IMPLEMENT_INTERFACE_DYNAMIC (VINAGRE_TYPE_PROTOCOL,
-							       vinagre_spice_protocol_iface_init))
+G_DEFINE_TYPE_EXTENDED (VinagreSpicePlugin,
+			vinagre_spice_plugin,
+			VINAGRE_TYPE_STATIC_EXTENSION,
+			0,
+			G_IMPLEMENT_INTERFACE (VINAGRE_TYPE_PROTOCOL,
+					       vinagre_spice_protocol_iface_init))
 
 static const gchar *
 impl_get_protocol (VinagreProtocol *plugin)
@@ -348,13 +348,11 @@ vinagre_spice_plugin_class_init (VinagreSpicePluginClass *klass)
 {
 }
 
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
+__attribute__((constructor)) void
+spice_register_types (PeasObjectModule *module)
 {
-  vinagre_spice_plugin_register_type (G_TYPE_MODULE (module));
-  peas_object_module_register_extension_type (module,
-					      VINAGRE_TYPE_PROTOCOL,
-					      VINAGRE_TYPE_SPICE_PLUGIN);
+  g_type_init ();
+  volatile dontoptimiseaway = vinagre_spice_plugin_get_type ();
 }
 
 /* vim: set ts=8: */
diff --git a/plugins/spice/vinagre-spice-plugin.h b/plugins/spice/vinagre-spice-plugin.h
index 55bdf72..5ddb676 100644
--- a/plugins/spice/vinagre-spice-plugin.h
+++ b/plugins/spice/vinagre-spice-plugin.h
@@ -24,7 +24,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <libpeas/peas.h>
+
+#include "vinagre/vinagre-static-extension.h"
 
 G_BEGIN_DECLS
 
@@ -43,18 +44,16 @@ typedef struct _VinagreSpicePluginClass	VinagreSpicePluginClass;
 
 struct _VinagreSpicePlugin
 {
-  PeasExtensionBase parent_instance;
+  VinagreStaticExtension parent_instance;
 };
 
 struct _VinagreSpicePluginClass
 {
-  PeasExtensionBaseClass parent_class;
+  VinagreStaticExtensionClass parent_class;
 };
 
 GType vinagre_spice_plugin_get_type (void) G_GNUC_CONST;
 
-G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
-
 G_END_DECLS
 
 #endif /* __VINAGRE_SPICE_PLUGIN_H__ */
diff --git a/plugins/ssh/vinagre-ssh-plugin.c b/plugins/ssh/vinagre-ssh-plugin.c
index 8838c0b..bde7b8e 100644
--- a/plugins/ssh/vinagre-ssh-plugin.c
+++ b/plugins/ssh/vinagre-ssh-plugin.c
@@ -38,12 +38,12 @@
 #endif
 
 static void vinagre_ssh_protocol_iface_init (VinagreProtocolInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (VinagreSshPlugin,
-				vinagre_ssh_plugin,
-				PEAS_TYPE_EXTENSION_BASE,
-				0,
-				G_IMPLEMENT_INTERFACE_DYNAMIC (VINAGRE_TYPE_PROTOCOL,
-							       vinagre_ssh_protocol_iface_init))
+G_DEFINE_TYPE_EXTENDED (VinagreSshPlugin,
+			vinagre_ssh_plugin,
+			VINAGRE_TYPE_STATIC_EXTENSION,
+			0,
+			G_IMPLEMENT_INTERFACE (VINAGRE_TYPE_PROTOCOL,
+					       vinagre_ssh_protocol_iface_init))
 
 static const gchar *
 impl_get_protocol (VinagreProtocol *plugin)
@@ -193,13 +193,11 @@ vinagre_ssh_plugin_init (VinagreSshPlugin *plugin)
 {
 }
 
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
+__attribute__((constructor)) void
+ssh_register_types (void)
 {
-  vinagre_ssh_plugin_register_type (G_TYPE_MODULE (module));
-  peas_object_module_register_extension_type (module,
-					      VINAGRE_TYPE_PROTOCOL,
-					      VINAGRE_TYPE_SSH_PLUGIN);
+  g_type_init ();
+  volatile dontoptimiseaway = vinagre_ssh_plugin_get_type ();
 }
 
 /* vim: set ts=8: */
diff --git a/plugins/ssh/vinagre-ssh-plugin.h b/plugins/ssh/vinagre-ssh-plugin.h
index 31f9ae6..3c65125 100644
--- a/plugins/ssh/vinagre-ssh-plugin.h
+++ b/plugins/ssh/vinagre-ssh-plugin.h
@@ -23,7 +23,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <libpeas/peas.h>
+
+#include "vinagre/vinagre-static-extension.h"
 
 G_BEGIN_DECLS
 
@@ -42,18 +43,16 @@ typedef struct _VinagreSshPluginClass	VinagreSshPluginClass;
 
 struct _VinagreSshPlugin
 {
-  PeasExtensionBase parent_instance;
+  VinagreStaticExtension parent_instance;
 };
 
 struct _VinagreSshPluginClass
 {
-  PeasExtensionBaseClass parent_class;
+  VinagreStaticExtensionClass parent_class;
 };
 
 GType vinagre_ssh_plugin_get_type (void) G_GNUC_CONST;
 
-G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
-
 G_END_DECLS
 
 #endif /* __VINAGRE_SSH_PLUGIN_H__ */
diff --git a/plugins/vnc/vinagre-vnc-plugin.c b/plugins/vnc/vinagre-vnc-plugin.c
index 4327385..774b938 100644
--- a/plugins/vnc/vinagre-vnc-plugin.c
+++ b/plugins/vnc/vinagre-vnc-plugin.c
@@ -36,12 +36,12 @@
 #include "vinagre-vnc-tab.h"
 
 static void vinagre_vnc_protocol_iface_init (VinagreProtocolInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (VinagreVncPlugin,
-				vinagre_vnc_plugin,
-				PEAS_TYPE_EXTENSION_BASE,
-				0,
-				G_IMPLEMENT_INTERFACE_DYNAMIC (VINAGRE_TYPE_PROTOCOL,
-							       vinagre_vnc_protocol_iface_init))
+G_DEFINE_TYPE_EXTENDED (VinagreVncPlugin,
+			vinagre_vnc_plugin,
+			VINAGRE_TYPE_STATIC_EXTENSION,
+			0,
+			G_IMPLEMENT_INTERFACE (VINAGRE_TYPE_PROTOCOL,
+					       vinagre_vnc_protocol_iface_init))
 
 static const GOptionEntry vinagre_vnc_args[] =
 {
@@ -410,13 +410,11 @@ vinagre_vnc_protocol_iface_init (VinagreProtocolInterface *iface)
   iface->get_file_filter = impl_get_file_filter;
 }
 
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
+__attribute__((constructor)) void
+vnc_register_types (void)
 {
-  vinagre_vnc_plugin_register_type (G_TYPE_MODULE (module));
-  peas_object_module_register_extension_type (module,
-					      VINAGRE_TYPE_PROTOCOL,
-					      VINAGRE_TYPE_VNC_PLUGIN);
+  g_type_init ();
+  volatile dontoptimiseaway = vinagre_vnc_plugin_get_type ();
 }
 
 /* vim: set ts=8: */
diff --git a/plugins/vnc/vinagre-vnc-plugin.h b/plugins/vnc/vinagre-vnc-plugin.h
index 2ceaf45..e597362 100644
--- a/plugins/vnc/vinagre-vnc-plugin.h
+++ b/plugins/vnc/vinagre-vnc-plugin.h
@@ -24,7 +24,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <libpeas/peas.h>
+
+#include "vinagre/vinagre-static-extension.h"
 
 G_BEGIN_DECLS
 
@@ -43,18 +44,16 @@ typedef struct _VinagreVncPluginClass	VinagreVncPluginClass;
 
 struct _VinagreVncPlugin
 {
-  PeasExtensionBase parent_instance;
+  VinagreStaticExtension parent_instance;
 };
 
 struct _VinagreVncPluginClass
 {
-  PeasExtensionBaseClass parent_class;
+  VinagreStaticExtensionClass parent_class;
 };
 
 GType vinagre_vnc_plugin_get_type (void) G_GNUC_CONST;
 
-G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
-
 G_END_DECLS
 
 #endif /* __VINAGRE_VNC_PLUGIN_H__ */



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