From f1515b509037bb1dc641ae7784ff13ba61a8d50e Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 25 Jul 2014 17:50:54 +0200 Subject: Add the necessary machinery to generate the introspection data from eom Annotations are still missing, but this provides enough for basic introspection usage Based on eog commit b316c9e0b30a8c6d67feb8f21a20268e18c8cc3d From Claudio Saavedra --- configure.ac | 11 +++++++++++ src/Makefile.am | 44 ++++++++++++++++++++++++++++++++++++-------- src/main.c | 6 ++++++ 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index d237baf..ad6932b 100644 --- a/configure.ac +++ b/configure.ac @@ -128,6 +128,16 @@ EOM_MODULES="gtk+-$GTK_API_VERSION >= $GTK_REQUIRED \ mate-icon-theme >= $MATE_ICON_THEME_REQUIRED \ shared-mime-info >= $SHARED_MIME_INFO_REQUIRED" +# Introspection +GOBJECT_INTROSPECTION_CHECK([0.9.3]) + +if test "$found_introspection" = "yes"; then + have_introspection=yes + AC_DEFINE([HAVE_INTROSPECTION], [1], [Define to enable GObject Introspection]) +else + have_introspection=no +fi + # *************** # ZLIB (required) # *************** @@ -522,4 +532,5 @@ Configure summary: RSVG support ...............: ${have_rsvg} Colour management support ..: ${have_lcms} D-Bus activation............: ${have_dbus} + GObject Introspection.......: ${have_introspection} " diff --git a/src/Makefile.am b/src/Makefile.am index 9f17e3d..8480ef5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -70,7 +70,7 @@ INST_H_FILES = \ eom-jobs.h \ eom-plugin.h -libeom_la_SOURCES = \ +libeom_c_files = \ eom-application.c \ eom-session.c \ eom-debug.c \ @@ -110,7 +110,10 @@ libeom_la_SOURCES = \ eom-plugin-engine.c \ eom-clipboard-handler.c \ uta.c \ - zoom.c \ + zoom.c + +libeom_la_SOURCES = \ + $(libeom_c_files) \ $(BUILT_SOURCES) \ $(NOINST_H_FILES) \ $(INST_H_FILES) @@ -119,7 +122,7 @@ if HAVE_EXIF INST_H_FILES += \ eom-exif-util.h \ eom-exif-details.h -libeom_la_SOURCES += \ +libeom_c_files += \ eom-exif-util.c \ eom-exif-details.c endif @@ -144,12 +147,10 @@ libeom_la_SOURCES += \ eom-exif-details.c endif HAVE_EXEMPI -libeom_la_CFLAGS = \ +libeom_la_CPPFLAGS = \ -I$(top_srcdir)/jpegutils \ -I$(top_srcdir)/cut-n-paste/toolbar-editor \ -I$(top_srcdir)/cut-n-paste/totem-screensaver \ - $(EOM_CFLAGS) \ - $(WARN_CFLAGS) \ -DG_LOG_DOMAIN=\"EOM\" \ -DEOM_PREFIX=\""${prefix}"\" \ -DEOM_DATA_DIR=\""$(pkgdatadir)"\" \ @@ -157,6 +158,10 @@ libeom_la_CFLAGS = \ -DEOM_PIXMAPS_DIR=\""$(datadir)/pixmaps/eom"\" \ -DEOM_PLUGIN_DIR=\""$(libdir)/eom/plugins"\" +libeom_la_CFLAGS = \ + $(EOM_CFLAGS) \ + $(WARN_CFLAGS) + libeom_la_LIBADD = \ $(EOM_LIBS) @@ -186,7 +191,8 @@ eom_CFLAGS = \ -I$(top_srcdir)/cut-n-paste/totem-screensaver \ $(EOM_CFLAGS) \ -DEOM_DATA_DIR=\""$(pkgdatadir)"\" \ - -DEOM_LOCALE_DIR=\""$(datadir)/locale"\" + -DEOM_LOCALE_DIR=\""$(datadir)/locale"\" \ + $(INTROSPECTION_CFLAGS) eom_LDADD = \ libeom.la \ @@ -194,7 +200,8 @@ eom_LDADD = \ $(LIBJPEG) \ $(toolbar_LIB) \ $(screensaver_LIB) \ - $(jpeg_LIB) + $(jpeg_LIB) \ + $(INTROSPECTION_LIBS) BUILT_SOURCES = \ eom-enum-types.c \ @@ -231,6 +238,27 @@ endif CLEANFILES = $(BUILT_SOURCES) +if HAVE_INTROSPECTION +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = Eom-1.0.gir +INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all $(libeom_la_CPPFLAGS) + +Eom-1.0.gir: eom +Eom_1_0_gir_INCLUDES = Gtk-${GTK_API_VERSION} +Eom_1_0_gir_FILES = $(INST_H_FILES) $(libeom_c_files) $(BUILT_SOURCES) +Eom_1_0_gir_VERSION = 1.0 +Eom_1_0_gir_PROGRAM = $(builddir)/eom +Eom_1_0_gir_NAMESPACE = Eom +Eom_1_0_gir_CFLAGS = $(EOM_CFLAGS) +girdir = $(datadir)/eom/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/eom/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif + dist-hook: cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/src/main.c b/src/main.c index ff59af5..99d801a 100644 --- a/src/main.c +++ b/src/main.c @@ -30,6 +30,9 @@ #include #include #endif +#ifdef HAVE_INSTROSPECTION +#include +#endif #include "eom-session.h" #include "eom-debug.h" @@ -196,6 +199,9 @@ main (int argc, char **argv) /* Option groups are free'd together with the context * Using gtk_get_option_group here initializes gtk during parsing */ g_option_context_add_group (ctx, gtk_get_option_group (TRUE)); +#ifdef HAVE_INTROSPECTION + g_option_context_add_group (ctx, g_irepository_get_option_group ()); +#endif if (!g_option_context_parse (ctx, &argc, &argv, &error)) { gchar *help_msg; -- cgit v1.2.1