From 5403b20a5c6a008fe024094549795beeb70ababa Mon Sep 17 00:00:00 2001 From: Jasper St. Pierre Date: Sat, 26 Feb 2011 11:42:19 -0500 Subject: [PATCH] Start work on introspection support. https://bugs.freedesktop.org/show_bug.cgi?id=34770 --- configure.ac | 1 + m4/introspection.m4 | 94 ++++++++++++++++++++++++++++++++++++++++ telepathy-logger/Makefile.am | 34 ++++++++++++++ telepathy-logger/event.c | 8 ++-- telepathy-logger/log-manager.c | 6 +- 5 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 m4/introspection.m4 diff --git a/configure.ac b/configure.ac index 7802db9..4554478 100644 --- a/configure.ac +++ b/configure.ac @@ -97,6 +97,7 @@ GLIB_GSETTINGS GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal` AC_SUBST(GLIB_GENMARSHAL) +GOBJECT_INTROSPECTION_CHECK([0.9.6]) GTK_DOC_CHECK([1.10]) diff --git a/m4/introspection.m4 b/m4/introspection.m4 new file mode 100644 index 0000000..589721c --- /dev/null +++ b/m4/introspection.m4 @@ -0,0 +1,94 @@ +dnl -*- mode: autoconf -*- +dnl Copyright 2009 Johan Dahlin +dnl +dnl This file is free software; the author(s) gives unlimited +dnl permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl + +# serial 1 + +m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], +[ + AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([LT_INIT],[$0])dnl setup libtool first + + dnl enable/disable introspection + m4_if([$2], [require], + [dnl + enable_introspection=yes + ],[dnl + AC_ARG_ENABLE(introspection, + AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], + [Enable introspection for this build]),, + [enable_introspection=auto]) + ])dnl + + AC_MSG_CHECKING([for gobject-introspection]) + + dnl presence/version checking + AS_CASE([$enable_introspection], + [no], [dnl + found_introspection="no (disabled, use --enable-introspection to enable)" + ],dnl + [yes],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0],, + AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], + found_introspection=yes, + AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) + ],dnl + [auto],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) + ],dnl + [dnl + AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) + ])dnl + + AC_MSG_RESULT([$found_introspection]) + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + AC_SUBST(INTROSPECTION_SCANNER) + AC_SUBST(INTROSPECTION_COMPILER) + AC_SUBST(INTROSPECTION_GENERATE) + AC_SUBST(INTROSPECTION_GIRDIR) + AC_SUBST(INTROSPECTION_TYPELIBDIR) + AC_SUBST(INTROSPECTION_CFLAGS) + AC_SUBST(INTROSPECTION_LIBS) + AC_SUBST(INTROSPECTION_MAKEFILE) + + AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") +]) + + +dnl Usage: +dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) + +AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) +]) + +dnl Usage: +dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) + + +AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) +]) diff --git a/telepathy-logger/Makefile.am b/telepathy-logger/Makefile.am index dd6722c..bb2f2e4 100644 --- a/telepathy-logger/Makefile.am +++ b/telepathy-logger/Makefile.am @@ -1,5 +1,10 @@ include $(top_srcdir)/tools/flymake.mk +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --add-include-path=$(top_srcdir) -I$(top_srcdir) +INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --includedir=$(top_srcdir) + AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_builddir)/extensions \ @@ -46,6 +51,7 @@ libtelepathy_logger_la_SOURCES = \ conf.c \ conf-internal.h \ entity.c \ + entity.h \ entity-internal.h \ datetime.c \ datetime-internal.h \ @@ -54,8 +60,10 @@ libtelepathy_logger_la_SOURCES = \ debug-internal.h \ debug.c \ event.c \ + event.h \ event-internal.h \ log-manager.c \ + log-manager.h \ log-manager-internal.h \ log-store.c \ log-store-internal.h \ @@ -72,9 +80,11 @@ libtelepathy_logger_la_SOURCES = \ text-channel.c \ text-channel-internal.h \ text-event.c \ + text-event.h \ text-event-internal.h \ util-internal.h \ util.c \ + telepathy-logger.h \ $(NULL) nodist_libtelepathy_logger_la_SOURCES = \ @@ -95,4 +105,28 @@ check-local: check-coding-style CLEANFILES = $(BUILT_SOURCES) +if HAVE_INTROSPECTION +introspection_sources = $(libtelepathy_logger_la_SOURCES) + +TelepathyLogger-1.0.gir: libtelepathy-logger.la +TelepathyLogger_1_0_gir_SCANNERFLAGS = --identifier-prefix=Tpl --warn-all +TelepathyLogger_1_0_gir_INCLUDES = GObject-2.0 TelepathyGLib-0.12 +TelepathyLogger_1_0_gir_CFLAGS = $(INCLUDES) +TelepathyLogger_1_0_gir_LIBS = libtelepathy-logger.la +TelepathyLogger_1_0_gir_FILES = $(filter-out %-internal.h, $(introspection_sources)) + +INTROSPECTION_GIRS += TelepathyLogger-1.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0/ +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += \ + $(gir_DATA) \ + $(typelib_DATA) + +endif + include abi.am diff --git a/telepathy-logger/event.c b/telepathy-logger/event.c index 6861202..ea6c4cb 100644 --- a/telepathy-logger/event.c +++ b/telepathy-logger/event.c @@ -302,7 +302,7 @@ _tpl_event_get_log_id (TplEvent *self) * tpl_event_get_sender * @self: a #TplEvent * - * Returns: the same #TplEntity as the #TplEvent:sender property + * Returns: (transfer none): the same #TplEntity as the #TplEvent:sender property */ TplEntity * tpl_event_get_sender (TplEvent *self) @@ -316,7 +316,7 @@ tpl_event_get_sender (TplEvent *self) * tpl_event_get_receiver * @self: a #TplEvent * - * Returns: the same #TplEntity as the #TplEvent:receiver property + * Returns: (transfer none): the same #TplEntity as the #TplEvent:receiver property */ TplEntity * tpl_event_get_receiver (TplEvent *self) @@ -360,7 +360,7 @@ _tpl_event_target_is_room (TplEvent *self) /** - * tpl_event_get_account + * tpl_event_et_account * @self: a #TplEvent * * @@ -412,7 +412,7 @@ tpl_event_equal (TplEvent *self, * * * - * Returns: the same account as the #TplEvent:account property + * Returns: (transfer none): the same account as the #TplEvent:account property */ TpAccount * tpl_event_get_account (TplEvent *self) diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c index e076561..d57f1f0 100644 --- a/telepathy-logger/log-manager.c +++ b/telepathy-logger/log-manager.c @@ -304,7 +304,7 @@ tpl_log_manager_init (TplLogManager *self) /** * tpl_log_manager_dup_singleton * - * Returns: a new reference on the log manager + * Returns: (transfer full): a new reference on the log manager */ TplLogManager * tpl_log_manager_dup_singleton (void) @@ -1162,9 +1162,9 @@ _get_filtered_events_async_thread (GSimpleAsyncResult *simple, * @target: a non-NULL #TplEntity * @type_mask: event type filter see #TplEventTypeMask * @num_events: number of maximum events to fetch - * @filter: an optional filter function + * @filter: (scope async): an optional filter function * @filter_user_data: user data to pass to @filter - * @callback: a callback to call when the request is satisfied + * @callback: (scope async): a callback to call when the request is satisfied * @user_data: data to pass to @callback * * Retrieve the most recent @num_event events exchanged with @target. -- 1.7.1