diff options
author | Christian Persch <chpe@src.gnome.org> | 2009-02-07 23:01:40 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2009-02-07 23:01:40 +0800 |
commit | 642eb45983933bf096844c0acb6b841fd5fa9ad3 (patch) | |
tree | 0dab374171c9ae190c2b82142d4fb208483f4360 | |
parent | 2e94ce01ab4c2e802e3123cdf325be4c10af6a59 (diff) | |
download | gsoc2013-epiphany-642eb45983933bf096844c0acb6b841fd5fa9ad3.tar.gz gsoc2013-epiphany-642eb45983933bf096844c0acb6b841fd5fa9ad3.tar.zst gsoc2013-epiphany-642eb45983933bf096844c0acb6b841fd5fa9ad3.zip |
Add gobject introspection support; use --enable-introspection.
svn path=/trunk/; revision=8755
-rw-r--r-- | configure.ac | 44 | ||||
-rw-r--r-- | src/Makefile.am | 71 | ||||
-rw-r--r-- | src/ephy-main.c | 21 |
3 files changed, 133 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 8f63bac5b..5aa994c1e 100644 --- a/configure.ac +++ b/configure.ac @@ -211,12 +211,51 @@ fi AC_CHECK_HEADERS([X11/XF86keysym.h]) +EPIPHANY_FEATURES= + +# ********************* +# GObject Introspection +# ********************* + +AC_MSG_CHECKING([whether to enable GObject introspection support]) +AC_ARG_ENABLE([introspection], + [AS_HELP_STRING([--enable-introspection],[Enable GObject introspection (default: disabled)])], + [],[enable_introspection=no]) +AC_MSG_RESULT([$enable_introspection]) + +G_IR_SCANNER= +G_IR_COMPILER= +G_IR_GENERATE= +GIRDIR= +GIRTYPELIBDIR= + +if test "$enable_introspection" = "yes"; then + EPIPHANY_FEATURES="$EPIPHANY_FEATURES introspection" + + GOBJECT_INTROSPECTION_REQUIRED=0.6.2 + PKG_CHECK_MODULES([INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED]) + + G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)" + G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)" + G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)" + GIRDIR="$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)" + GIRTYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + + AC_DEFINE([ENABLE_INTROSPECTION],[1],[Define to enable GObject introspection support]) +fi + +AC_SUBST([G_IR_SCANNER]) +AC_SUBST([G_IR_COMPILER]) +AC_SUBST([G_IR_GENERATE]) +AC_SUBST([GIRDIR]) +AC_SUBST([GIRTYPELIBDIR]) + +AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"]) + # ****** # Python # ****** -EPIPHANY_FEATURES= - AC_MSG_CHECKING([whether Python support is requested]) AC_ARG_ENABLE([python], @@ -562,6 +601,7 @@ Epiphany was configured with the following options: Zeroconf bookmarks support : $enable_zeroconf NetworkManager support : $enable_network_manager + GObject introspection : $enable_introspection Python support : $enable_python Build tests : $enable_tests " diff --git a/src/Makefile.am b/src/Makefile.am index 6ec12826e..b6e08414f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -216,6 +216,11 @@ epiphany_LDADD = \ $(DBUS_LIBS) \ $(LIBINTL) +if ENABLE_INTROSPECTION +epiphany_CFLAGS += $(INTROSPECTION_CFLAGS) +epiphany_LDADD += $(INTROSPECTION_LIBS) +endif + if ENABLE_PYTHON epiphany_LDADD += \ libpyphany.la \ @@ -494,4 +499,68 @@ check-python-binding: #check-local: check-python-binding -endif +endif # ENABLE_PYTHON + +if ENABLE_INTROSPECTION +EPHY_GIR_H_FILES = \ + $(top_srcdir)/embed/ephy-command-manager.h \ + $(top_srcdir)/embed/ephy-cookie-manager.h \ + $(top_srcdir)/embed/ephy-embed-event.h \ + $(top_srcdir)/embed/ephy-embed-factory.h \ + $(top_srcdir)/embed/ephy-embed.h \ + $(top_srcdir)/embed/ephy-embed-persist.h \ + $(top_srcdir)/embed/ephy-embed-shell.h \ + $(top_srcdir)/embed/ephy-embed-single.h \ + $(top_srcdir)/embed/ephy-favicon-cache.h \ + $(top_srcdir)/embed/ephy-history.h \ + $(top_srcdir)/embed/ephy-password-manager.h \ + $(top_srcdir)/embed/ephy-permission-manager.h \ + $(top_srcdir)/lib/ephy-dialog.h \ + $(top_srcdir)/lib/ephy-node-db.h \ + $(top_srcdir)/lib/ephy-node.h \ + $(top_srcdir)/lib/ephy-state.h \ + $(top_srcdir)/lib/egg/egg-editable-toolbar.h \ + $(top_srcdir)/lib/egg/egg-toolbars-model.h \ + $(top_srcdir)/lib/widgets/ephy-search-entry.h \ + $(top_srcdir)/lib/widgets/ephy-spinner.h \ + $(top_srcdir)/src/bookmarks/ephy-bookmarks.h \ + $(top_srcdir)/src/ephy-extension.h \ + $(top_srcdir)/src/ephy-extensions-manager.h \ + $(top_srcdir)/src/ephy-find-toolbar.h \ + $(top_srcdir)/src/ephy-link-action.h \ + $(top_srcdir)/src/ephy-link.h \ + $(top_srcdir)/src/ephy-location-action.h \ + $(top_srcdir)/src/ephy-notebook.h \ + $(top_srcdir)/src/ephy-session.h \ + $(top_srcdir)/src/ephy-shell.h \ + $(top_srcdir)/src/ephy-statusbar.h \ + $(top_srcdir)/src/ephy-toolbar.h \ + $(top_srcdir)/src/ephy-window.h \ + $(NULL) + +Epiphany-$(EPIPHANY_API_VERSION).gir: epiphany $(G_IR_SCANNER) + $(G_IR_SCANNER) -v \ + --namespace Epiphany \ + --nsversion=$(EPIPHANY_API_VERSION) \ + --add-include-path=. \ + --add-include-path=$(srcdir) \ + --include=Gtk-2.0 \ + --include=libxml2-2.0 \ + --program=./epiphany \ + --output $@ \ + --pkg epiphany-$(EPIPHANY_API_VERSION) \ + $(EPHY_GIR_H_FILES) + +girdir = $(GIRDIR) +gir_DATA = Epiphany-$(EPIPHANY_API_VERSION).gir + +typelibsdir = $(GIRTYPELIBDIR) +typelibs_DATA = Epiphany-$(EPIPHANY_API_VERSION).typelib + +Epiphany-$(EPIPHANY_API_VERSION).typelib: Epiphany-$(EPIPHANY_API_VERSION).gir $(G_IR_COMPILER) + g-ir-compiler Epiphany-$(EPIPHANY_API_VERSION).gir -o Epiphany-$(EPIPHANY_API_VERSION).typelib + +EXTRA_DIST += Epiphany-$(EPIPHANY_API_VERSION).gir +CLEANFILES += $(gir_DATA) $(typelibs_DATA) + +endif # ENABLE_INTROSPECTION diff --git a/src/ephy-main.c b/src/ephy-main.c index 5f361b665..aa4519be6 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -45,6 +45,10 @@ #include <errno.h> #include <string.h> +#ifdef ENABLE_INTROSPECTION +#include <girepository.h> +#endif + #ifdef HAVE_LIBNOTIFY #include <libnotify/notify.h> #endif @@ -79,6 +83,19 @@ option_version_cb (const gchar *option_name, return FALSE; } +#ifdef ENABLE_INTROSPECTION +static gboolean +option_introspection_dump_cb (const gchar *option_name, + const gchar *value, + gpointer data, + GError **error) +{ + g_irepository_dump (value, NULL); + exit (0); + return TRUE; +} +#endif /* ENABLE_INTROSPECTION */ + static const GOptionEntry option_entries[] = { { "new-tab", 'n', 0, G_OPTION_ARG_NONE, &open_in_new_tab, @@ -101,6 +118,10 @@ static const GOptionEntry option_entries[] = "", N_("URL …")}, { "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL }, +#ifdef ENABLE_INTROSPECTION + { "introspect-dump", 0, G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_CALLBACK, option_introspection_dump_cb, NULL, NULL }, +#endif { NULL } }; |