[epiphany-extensions/peas: 7/15] greasemonkey: port to libpeas



commit 0ad836f9e2ca19673da24ae8c81158b928c5dfe2
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sun Apr 3 19:14:31 2011 -0500

    greasemonkey: port to libpeas
    
    FIXME: crashes on impl_attach_tab

 extensions/greasemonkey/Makefile.am                |   11 ++---
 .../greasemonkey/ephy-greasemonkey-extension.c     |   13 ++++++
 .../greasemonkey/ephy-greasemonkey-extension.h     |    8 ++-
 extensions/greasemonkey/extension.c                |   46 --------------------
 .../greasemonkey/greasemonkey.ephy-extension.in.in |   11 -----
 extensions/greasemonkey/greasemonkey.plugin.in.in  |    7 +++
 6 files changed, 30 insertions(+), 66 deletions(-)
---
diff --git a/extensions/greasemonkey/Makefile.am b/extensions/greasemonkey/Makefile.am
index 7bc2462..266e003 100644
--- a/extensions/greasemonkey/Makefile.am
+++ b/extensions/greasemonkey/Makefile.am
@@ -5,8 +5,7 @@ libgreasemonkeyextension_la_SOURCES = \
 	ephy-greasemonkey-extension.c	\
 	ephy-greasemonkey-extension.h	\
 	greasemonkey-script.c		\
-	greasemonkey-script.h		\
-	extension.c
+	greasemonkey-script.h
 
 libgreasemonkeyextension_la_CPPFLAGS = \
 	-I$(top_srcdir)/include					\
@@ -26,14 +25,14 @@ libgreasemonkeyextension_la_LIBADD = \
 
 libgreasemonkeyextension_la_LDFLAGS = \
 	-module -avoid-version \
-	-export-symbols $(top_srcdir)/ephy-extension.symbols \
+	-no-undefined \
 	$(AM_LDFLAGS)
 
 extensioninidir = $(extensiondir)
-extensionini_in_files = greasemonkey.ephy-extension.in.in
-extensionini_DATA = $(extensionini_in_files:.ephy-extension.in.in=.ephy-extension)
+extensionini_in_files = greasemonkey.plugin.in.in
+extensionini_DATA = $(extensionini_in_files:.plugin.in.in=.plugin)
 
-%.ephy-extension.in: %.ephy-extension.in.in $(extension_LTLIBRARIES)
+%.plugin.in: %.plugin.in.in $(extension_LTLIBRARIES)
 	$(AM_V_GEN) \
 	sed -e "s|%LIBRARY%|`. ./$(extension_LTLIBRARIES) && echo $$dlname`|" \
 	    -e "s|%EXTENSION_DIR%|$(extensiondir)|" \
diff --git a/extensions/greasemonkey/ephy-greasemonkey-extension.c b/extensions/greasemonkey/ephy-greasemonkey-extension.c
index 59784c9..266c02c 100644
--- a/extensions/greasemonkey/ephy-greasemonkey-extension.c
+++ b/extensions/greasemonkey/ephy-greasemonkey-extension.c
@@ -40,6 +40,8 @@
 #include <dirent.h>
 #include <errno.h>
 
+#include <libpeas/peas.h>
+
 #define EPHY_GREASEMONKEY_EXTENSION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_GREASEMONKEY_EXTENSION, EphyGreasemonkeyExtensionPrivate))
 
 #define WINDOW_DATA_KEY "EphyGreasemonkeyExtensionWindowData"
@@ -676,3 +678,14 @@ ephy_greasemonkey_extension_register_type (GTypeModule *module)
 
 	return type;
 }
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+	greasemonkey_script_register_type (G_TYPE_MODULE (module));
+	ephy_greasemonkey_extension_register_type (G_TYPE_MODULE (module));
+
+	peas_object_module_register_extension_type (module,
+						    EPHY_TYPE_EXTENSION,
+						    EPHY_TYPE_GREASEMONKEY_EXTENSION);
+}
diff --git a/extensions/greasemonkey/ephy-greasemonkey-extension.h b/extensions/greasemonkey/ephy-greasemonkey-extension.h
index 985ec20..ac1ed9e 100644
--- a/extensions/greasemonkey/ephy-greasemonkey-extension.h
+++ b/extensions/greasemonkey/ephy-greasemonkey-extension.h
@@ -24,6 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <libpeas/peas.h>
 
 G_BEGIN_DECLS
 
@@ -40,21 +41,22 @@ typedef struct _EphyGreasemonkeyExtensionPrivate	EphyGreasemonkeyExtensionPrivat
 
 struct _EphyGreasemonkeyExtensionClass
 {
-	GObjectClass parent_class;
+	PeasExtensionBaseClass parent_class;
 };
 
 struct _EphyGreasemonkeyExtension
 {
-	GObject parent_instance;
+	PeasExtensionBase parent_instance;
 
 	/*< private >*/
 	EphyGreasemonkeyExtensionPrivate *priv;
 };
 
 GType	ephy_greasemonkey_extension_get_type		(void);
-
 GType	ephy_greasemonkey_extension_register_type	(GTypeModule *module);
 
+G_MODULE_EXPORT void	peas_register_types		(PeasObjectModule *module);
+
 G_END_DECLS
 
 #endif
diff --git a/extensions/greasemonkey/greasemonkey.plugin.in.in b/extensions/greasemonkey/greasemonkey.plugin.in.in
new file mode 100644
index 0000000..b141503
--- /dev/null
+++ b/extensions/greasemonkey/greasemonkey.plugin.in.in
@@ -0,0 +1,7 @@
+[Plugin]
+Module=%LIBRARY%
+IAge=1
+_Name=Greasemonkey
+_Description=Run user scripts to modify web pages' behavior
+Authors=Adam Hooper <adamh densi com>
+Website=http://www.gnome.org/projects/epiphany/extensions.html



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