diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-01-07 17:16:58 +0000 |
---|---|---|
committer | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-01-07 17:16:58 +0000 |
commit | 4ed7270537dce069ee0f73d24a575043828f1622 (patch) | |
tree | 0ae78a01f432365596a5accb3356b9fbf4f239be | |
parent | bc271b0002d24871451354296007b3fe62249117 (diff) | |
download | telepathy-logger-4ed7270537dce069ee0f73d24a575043828f1622.tar.gz |
Telepathy code style compliant changes (part1)
* remove tpl- prefix from file names
* moved all the libtelepathy-logger lib related files into libtelepathy-logger/ directory
* clean up of configure and makefiles autotool's scripts
* added TplConf object for GConf configuration
-rw-r--r-- | .gitignore | 45 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | configure.ac | 259 | ||||
-rw-r--r-- | libtelepathy-logger/Makefile.am | 57 | ||||
-rw-r--r-- | libtelepathy-logger/channel-text.c (renamed from src/tpl-text-channel-context.c) | 15 | ||||
-rw-r--r-- | libtelepathy-logger/channel-text.h (renamed from src/tpl-text-channel-context.h) | 8 | ||||
-rw-r--r-- | libtelepathy-logger/channel.c (renamed from src/tpl-channel.c) | 62 | ||||
-rw-r--r-- | libtelepathy-logger/channel.h (renamed from src/tpl-channel.h) | 6 | ||||
-rw-r--r-- | libtelepathy-logger/conf.c | 90 | ||||
-rw-r--r-- | libtelepathy-logger/contact.c (renamed from src/tpl-contact.c) | 110 | ||||
-rw-r--r-- | libtelepathy-logger/contact.h (renamed from src/tpl-contact.h) | 26 | ||||
-rw-r--r-- | libtelepathy-logger/datetime.c (renamed from src/tpl-time.c) | 7 | ||||
-rw-r--r-- | libtelepathy-logger/datetime.h (renamed from src/tpl-time.h) | 0 | ||||
-rw-r--r-- | libtelepathy-logger/debug.h | 2 | ||||
-rw-r--r-- | libtelepathy-logger/libtelepathy-logger.pc.in (renamed from src/libtelepathy-logger.pc.in) | 0 | ||||
-rw-r--r-- | libtelepathy-logger/log-entry-text.c (renamed from src/tpl-log-entry-text.c) | 9 | ||||
-rw-r--r-- | libtelepathy-logger/log-entry-text.h (renamed from src/tpl-log-entry-text.h) | 4 | ||||
-rw-r--r-- | libtelepathy-logger/log-entry.c (renamed from src/tpl-log-entry.c) | 12 | ||||
-rw-r--r-- | libtelepathy-logger/log-entry.h (renamed from src/tpl-log-entry.h) | 2 | ||||
-rw-r--r-- | libtelepathy-logger/log-manager-priv.h (renamed from src/tpl-log-manager-priv.h) | 2 | ||||
-rw-r--r-- | libtelepathy-logger/log-manager.c (renamed from src/tpl-log-manager.c) | 19 | ||||
-rw-r--r-- | libtelepathy-logger/log-manager.h (renamed from src/tpl-log-manager.h) | 3 | ||||
-rw-r--r-- | libtelepathy-logger/log-store-empathy.c (renamed from src/tpl-log-store-empathy.c) | 22 | ||||
-rw-r--r-- | libtelepathy-logger/log-store-empathy.h (renamed from src/tpl-log-store-empathy.h) | 1 | ||||
-rw-r--r-- | libtelepathy-logger/log-store.c (renamed from src/tpl-log-store.c) | 2 | ||||
-rw-r--r-- | libtelepathy-logger/log-store.h (renamed from src/tpl-log-store.h) | 4 | ||||
-rw-r--r-- | libtelepathy-logger/observer.c (renamed from src/tpl-observer.c) | 31 | ||||
-rw-r--r-- | libtelepathy-logger/observer.h (renamed from src/tpl-observer.h) | 0 | ||||
-rw-r--r-- | libtelepathy-logger/telepathy-logger.schemas | 32 | ||||
-rw-r--r-- | libtelepathy-logger/utils.c (renamed from src/tpl-utils.c) | 2 | ||||
-rw-r--r-- | libtelepathy-logger/utils.h (renamed from src/tpl-utils.h) | 0 | ||||
-rw-r--r-- | src/Makefile.am | 91 | ||||
-rwxr-xr-x | src/compile.sh | 18 | ||||
-rw-r--r-- | src/dbus-service.c (renamed from src/tpl-dbus-service.c) | 17 | ||||
-rw-r--r-- | src/dbus-service.h (renamed from src/tpl-dbus-service.h) | 7 | ||||
-rw-r--r-- | src/dbus-service.xml (renamed from src/tpl-dbus-service.xml) | 0 | ||||
-rw-r--r-- | src/log-manager.xsl (renamed from src/tpl-log-manager.xsl) | 0 | ||||
-rw-r--r-- | src/telepathy-logger-dbus.c | 4 | ||||
-rw-r--r-- | src/telepathy-logger.c | 4 | ||||
-rw-r--r-- | src/test_api.c | 52 | ||||
-rw-r--r-- | src/tpl-headless-logger-init.c | 63 |
43 files changed, 503 insertions, 595 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ede30c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +Makefile +Makefile.in +configure +configure.in +observer.py +tags +TAGS +config.* +aclocal.m4 +autom4te.cache/ +depcomp +gnome-doc-utils.make +install-sh +intltool-extract.in +intltool-merge.in +intltool-update.in +ltmain.sh +missing +mkinstalldirs +omf.make +xmldocs.make +shave +shave-libtool +libtool +stamp-h1 + +src/*.o +src/*.lo +src/*.la +src/.libs +src/.deps/ +src/telepathy-logger +src/test-api +src/telepathy-logger-dbus +src/dbus-service-client.h +src/dbus-service-server.h +src/*.service +src/*.client + +libtelepathy-logger/*.o +libtelepathy-logger/*.lo +libtelepathy-logger/*.la +libtelepathy-logger/.libs +libtelepathy-logger/.deps/ +libtelepathy-logger/libtelepathy-logger.pc diff --git a/Makefile.am b/Makefile.am index cfcae73..c5909b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,9 +8,7 @@ DISTCHECK_CONFIGURE_FLAGS = \ EXTRA_DIST = \ ChangeLog \ - ChangeLog.old \ README \ - CONTRIBUTORS \ autogen.sh DISTCLEANFILES = \ @@ -28,7 +26,7 @@ distclean-local: ChangeLog: @echo Creating $@ @if test -d "$(srcdir)/.git"; then \ - (GIT_DIR=$(top_srcdir)/.git ./missing --run git log EMPATHY_2_27_1.. --stat) | fmt --split-only > $@.tmp \ + (GIT_DIR=$(top_srcdir)/.git ./missing --run git log TPL_1.0.. --stat) | fmt --split-only > $@.tmp \ && mv -f $@.tmp $@ \ || ($(RM) $@.tmp; \ echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ @@ -0,0 +1,3 @@ +This is The Headless Telepathy Logger - TPL. +TPL is currently under development, please refer to Please refer to +http://telepathy.freedesktop.org/Logger for more information. @@ -1,8 +1,7 @@ Those are mini tasks still to do. They should be filed against a bug trucker as soon as TPL will have one: -- add a logstore-ro interface or split the current one in rw and ro - depending on what/who is using it +- fix dbus_g_method_return_error - global configuration object (ie disable logging partially or totally, choose the logstore, etc) - understand if direction from tpl_log_entry_text is to be removed diff --git a/configure.ac b/configure.ac index d17ba64..5c9b799 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir AC_PREREQ(2.59) AC_COPYRIGHT([ Copyright (C) 2003-2007 Imendio AB - Copyright (C) 2007-2009 Collabora Ltd. + Copyright (C) 2007-20010 Collabora Ltd. ]) # Minimal version required @@ -41,7 +41,6 @@ GNOME_MAINTAINER_MODE_DEFINES # Warning if GLib/GDK/GTK headers are included AC_DEFINE(G_DISABLE_SINGLE_INCLUDES, [], [Disable single includes for GLib]) AC_DEFINE(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES, [], [Disable single includes for GDK pixbuf]) -#AC_DEFINE(GTK_DISABLE_SINGLE_INCLUDES, [], [Disable single includes for GTK]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -71,7 +70,6 @@ AC_CHECK_PROGS([XSLTPROC], [xsltproc]) if test -z "$XSLTPROC"; then AC_MSG_ERROR([xsltproc (from libxslt) is required]) fi -#AM_PATH_PYTHON([2.3]) TPL_ARG_VALGRIND @@ -112,8 +110,7 @@ AS_COMPILER_FLAG(-std=c99, ERROR_CFLAGS="$ERROR_CFLAGS -std=c99") AS_COMPILER_FLAG(-Wshadow, ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow") AS_COMPILER_FLAG(-Wmissing-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-prototypes") AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-declarations") -# Disabled because some GTK+ headers (like gtkitemfactory.h) are bugged :( -#AS_COMPILER_FLAG(-Wstrict-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wstrict-prototypes") +AS_COMPILER_FLAG(-Wstrict-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wstrict-prototypes") AC_SUBST(ERROR_CFLAGS) @@ -123,6 +120,7 @@ AC_SUBST(ERROR_CFLAGS) PKG_CHECK_MODULES(LIBTPL, [ + gconf-2.0 glib-2.0 >= $GLIB_REQUIRED gobject-2.0 libxml-2.0 @@ -131,15 +129,13 @@ PKG_CHECK_MODULES(LIBTPL, PKG_CHECK_MODULES(TPL, [ + dbus-glib-1 glib-2.0 >= $GLIB_REQUIRED - libxml-2.0 gobject-2.0 - dbus-glib-1 + libxml-2.0 telepathy-glib >= $TELEPATHY_GLIB_REQUIRED ]) -#PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED) - # ----------------------------------------------------------- # Enable debug # ----------------------------------------------------------- @@ -152,248 +148,6 @@ if test x$enable_debug = xyes; then AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code]) fi -#DISABLED## ----------------------------------------------------------- -#DISABLED## Language Support -#DISABLED## ----------------------------------------------------------- -#DISABLED# -#DISABLED#GETTEXT_PACKAGE=telepathy_logger -#DISABLED#AC_SUBST(GETTEXT_PACKAGE) -#DISABLED#AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name]) -#DISABLED# -#DISABLED#AM_GLIB_GNU_GETTEXT -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## Connectivity integration -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_WITH(connectivity, -#DISABLED# AS_HELP_STRING([--with-connectivity=@<:@nm/connman/auto/no@:>@], -#DISABLED# [build with connectivity support]), , -#DISABLED# with_connectivity=auto) -#DISABLED# -#DISABLED#if test "x$with_connectivity" = "xno"; then -#DISABLED# have_nm=no -#DISABLED# have_connman=no -#DISABLED# -#DISABLED#elif test "x$with_connectivity" = "xconnman"; then -#DISABLED# -#DISABLED# PKG_CHECK_MODULES(CONNMAN, -#DISABLED# [ -#DISABLED# dbus-glib-1 -#DISABLED# ], have_connman="yes", have_connman="no") -#DISABLED# -#DISABLED# if test "x$have_connman" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_CONNMAN, 1, [Define if you have connman dependencies]) -#DISABLED# have_nm=no -#DISABLED# fi -#DISABLED# -#DISABLED#else -#DISABLED# -#DISABLED# PKG_CHECK_MODULES(NETWORK_MANAGER, -#DISABLED# [ -#DISABLED# libnm_glib >= $NETWORK_MANAGER_REQUIRED -#DISABLED# ], have_nm="yes", have_nm="no") -#DISABLED# -#DISABLED# if test "x$have_nm" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_NM, 1, [Define if you have libnm-glib]) -#DISABLED# have_connman=no -#DISABLED# else -#DISABLED# PKG_CHECK_MODULES(NETWORK_MANAGER, -#DISABLED# [ -#DISABLED# libnm-glib >= $NETWORK_MANAGER_REQUIRED -#DISABLED# ], have_nm="yes", have_nm="no") -#DISABLED# -#DISABLED# if test "x$have_nm" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_NM, 1, [Define if you have libnm-glib]) -#DISABLED# have_connman=no -#DISABLED# fi -#DISABLED# fi -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$with_connectivity" = "xconnman" -a "x$have_connman" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find connman dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$with_connectivity" = "xnm" -a "x$have_nm" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find libnm-glib dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#AM_CONDITIONAL(HAVE_NM, test "x$have_nm" = "xyes") -#DISABLED#AM_CONDITIONAL(HAVE_CONNMAN, test "x$have_connman" = "xyes") -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## Webkit -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_ENABLE(webkit, -#DISABLED# AS_HELP_STRING([--enable-webkit=@<:@no/yes/auto@:>@], -#DISABLED# [build with webkit support]), , -#DISABLED# enable_webkit=auto) -#DISABLED# -#DISABLED#if test "x$enable_webkit" != "xno"; then -#DISABLED# PKG_CHECK_MODULES(WEBKIT, -#DISABLED# [ -#DISABLED# webkit-1.0 >= $WEBKIT_REQUIRED -#DISABLED# ], have_webkit="yes", have_webkit="no") -#DISABLED# -#DISABLED# if test "x$have_webkit" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_WEBKIT, 1, [Define if you have libwebkitgtk]) -#DISABLED# fi -#DISABLED#else -#DISABLED# have_webkit=no -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$enable_webkit" = "xyes" -a "x$have_webkit" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find webkit dependencies.]) -#DISABLED#fi -#DISABLED#AM_CONDITIONAL(HAVE_WEBKIT, test "x$have_webkit" = "xyes") -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## spellchecking checks: enchant and iso-codes -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_ENABLE(spell, -#DISABLED# AS_HELP_STRING([--enable-spell=@<:@no/yes/auto@:>@], -#DISABLED# [Enable spell checking]), , -#DISABLED# enable_spell=auto) -#DISABLED# -#DISABLED#if test "x$enable_spell" != "xno"; then -#DISABLED# PKG_CHECK_MODULES(ENCHANT, -#DISABLED# [ -#DISABLED# enchant >= $ENCHANT_REQUIRED, -#DISABLED# iso-codes >= $ISO_CODES_REQUIRED -#DISABLED# ], have_enchant="yes", have_enchant="no") -#DISABLED# -#DISABLED# if test "x$have_enchant" = "xyes"; then -#DISABLED# AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains]) -#DISABLED# if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \ -#DISABLED# $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then -#DISABLED# AC_DEFINE_UNQUOTED(ISO_CODES_PREFIX, ["`$PKG_CONFIG --variable=prefix iso-codes`"], [ISO codes prefix]) -#DISABLED# AC_DEFINE(HAVE_ENCHANT, [], [Define if you have libenchant]) -#DISABLED# result=yes -#DISABLED# else -#DISABLED# result=no -#DISABLED# have_enchant="no" -#DISABLED# fi -#DISABLED# AC_MSG_RESULT([$result]) -#DISABLED# fi -#DISABLED#else -#DISABLED# have_enchant=no -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$enable_spell" = "xyes" -a "x$have_enchant" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find spell dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#AM_CONDITIONAL(HAVE_ENCHANT, test "x$have_enchant" = "xyes") -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## Map view checks: libchamplain -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_ENABLE(map, -#DISABLED# AS_HELP_STRING([--enable-map=@<:@no/yes/auto@:>@], -#DISABLED# [Enable map view]), , -#DISABLED# enable_map=auto) -#DISABLED# -#DISABLED#if test "x$enable_map" != "xno"; then -#DISABLED# PKG_CHECK_MODULES(LIBCHAMPLAIN, -#DISABLED# [ -#DISABLED# champlain-0.4 >= $LIBCHAMPLAIN_REQUIRED, -#DISABLED# champlain-gtk-0.4 >= $LIBCHAMPLAIN_GTK_REQUIRED -#DISABLED# clutter-gtk-0.10 >= $CLUTTER_GTK_REQUIRED -#DISABLED# ], have_libchamplain="yes", have_libchamplain="no") -#DISABLED# -#DISABLED# if test "x$have_libchamplain" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_LIBCHAMPLAIN, 1, [Define if you have libchamplain]) -#DISABLED# fi -#DISABLED#else -#DISABLED# have_libchamplain=no -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$enable_map" = "xyes" -a "x$have_libchamplain" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find map view dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#AM_CONDITIONAL(HAVE_LIBCHAMPLAIN, test "x$have_libchamplain" = "xyes") -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## location checks: geoclue -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_ENABLE(location, -#DISABLED# AS_HELP_STRING([--enable-location=@<:@no/yes/auto@:>@], -#DISABLED# [Enable location awareness]), , -#DISABLED# enable_location=auto) -#DISABLED# -#DISABLED#if test "x$enable_location" != "xno"; then -#DISABLED# PKG_CHECK_MODULES(GEOCLUE, -#DISABLED# [ -#DISABLED# geoclue >= $GEOCLUE_REQUIRED -#DISABLED# ], have_geoclue="yes", have_geoclue="no") -#DISABLED# -#DISABLED# if test "x$have_geoclue" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_GEOCLUE, 1, [Define if you have geoclue]) -#DISABLED# fi -#DISABLED#else -#DISABLED# have_geoclue="no" -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$enable_location" = "xyes" -a "x$have_geoclue" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find location dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#AM_CONDITIONAL(HAVE_GEOCLUE, test "x$have_geoclue" = "xyes") -#DISABLED#AC_SUBST(GEOCLUE_CFLAGS) -#DISABLED#AC_SUBST(GEOCLUE_LIBS) -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## moblin widgets support -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_ENABLE(moblin, -#DISABLED# AS_HELP_STRING([--enable-moblin=@<:no/yes@:>@], -#DISABLED# [Enable moblin widgets]), , -#DISABLED# enable_moblin=no) -#DISABLED# -#DISABLED#if test "x$enable_moblin" != "xno"; then -#DISABLED# PKG_CHECK_MODULES(MOBLIN, -#DISABLED# [ -#DISABLED# nbtk-gtk-1.2 -#DISABLED# ], have_moblin="yes", have_moblin="no") -#DISABLED# -#DISABLED# if test "x$have_moblin" = "xyes"; then -#DISABLED# AC_DEFINE(HAVE_MOBLIN, 1, [Define if you have moblin]) -#DISABLED# fi -#DISABLED#else -#DISABLED# have_moblin="no" -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$enable_moblin" = "xyes" -a "x$have_moblin" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find moblin dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#AM_CONDITIONAL(HAVE_MOBLIN, test "x$have_moblin" = "xyes") -#DISABLED#AC_SUBST(MOBLIN_CFLAGS) -#DISABLED#AC_SUBST(MOBLIN_LIBS) -#DISABLED# -#DISABLED## ----------------------------------------------------------- -#DISABLED## nautilus-sendto -#DISABLED## ----------------------------------------------------------- -#DISABLED#AC_ARG_ENABLE(nautilus-sendto, -#DISABLED# AS_HELP_STRING([--enable-nautilus-sendto=@<:@no/yes/auto@:>@], -#DISABLED# [build nautilus-sendto plugin]), , -#DISABLED# enable_nautilus_sendto=auto) -#DISABLED# -#DISABLED#if test "x$enable_nautilus_sendto" != "xno"; then -#DISABLED# PKG_CHECK_MODULES(NST, -#DISABLED# [ -#DISABLED# nautilus-sendto >= $NAUTILUS_SENDTO_REQUIRED -#DISABLED# ], have_nst="yes", have_nst="no") -#DISABLED#else -#DISABLED# have_nst=no -#DISABLED#fi -#DISABLED# -#DISABLED#if test "x$enable_nautilus_sendto" = "xyes" -a "x$have_nst" != "xyes"; then -#DISABLED# AC_MSG_ERROR([Couldn't find nautilus-sendto dependencies.]) -#DISABLED#fi -#DISABLED# -#DISABLED#AM_CONDITIONAL(HAVE_NST, test "x$have_nst" = "xyes") - # ----------------------------------------------------------- # Coding style checks # ----------------------------------------------------------- @@ -410,7 +164,8 @@ SHAVE_INIT(.) AC_OUTPUT([ Makefile src/Makefile - src/libtelepathy-logger.pc + libtelepathy-logger/Makefile + libtelepathy-logger/libtelepathy-logger.pc tools/Makefile shave shave-libtool diff --git a/libtelepathy-logger/Makefile.am b/libtelepathy-logger/Makefile.am new file mode 100644 index 0000000..34ce6dd --- /dev/null +++ b/libtelepathy-logger/Makefile.am @@ -0,0 +1,57 @@ +include $(top_srcdir)/tools/shave.mk +include $(top_srcdir)/tools/flymake.mk + +AM_CPPFLAGS = \ + $(ERROR_CFLAGS) \ + -DG_LOG_DOMAIN=\"telepathy-logger\" \ + $(LIBTPL_CFLAGS) \ + $(DISABLE_DEPRECATED) \ + $(WARN_CFLAGS) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libtelepathy-logger.pc + +lib_LTLIBRARIES = libtelepathy-logger.la + +LIBTPLdir = $(includedir)/telepathy-logger +LIBTPL_HEADERS = \ + observer.h \ + channel.h \ + contact.h \ + log-entry.h \ + log-entry-text.h \ + log-manager.h \ + log-manager-priv.h \ + log-store-empathy.h \ + log-store.h \ + channel-text.h \ + datetime.h \ + utils.h + + +libtelepathy_logger_la_SOURCES = \ + observer.c \ + channel.c \ + channel-text.c \ + log-entry.c \ + log-entry-text.c \ + contact.c \ + log-manager.c \ + log-store.c \ + log-store-empathy.c \ + utils.c \ + datetime.c + +schemadir = @GCONF_SCHEMA_FILE_DIR@ +schema_DATA = telepathy-logger.schemas + +install-data-local: + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) \ + --makefile-install-rule $(srcdir)/$(schema_DATA) + +check_c_sources = \ + $(libtelepathy_logger_la_SOURCES) \ +include $(top_srcdir)/tools/check-coding-style.mk +check-local: check-coding-style + +CLEANFILES = $(BUILT_SOURCES) diff --git a/src/tpl-text-channel-context.c b/libtelepathy-logger/channel-text.c index 6b96196..8330142 100644 --- a/src/tpl-text-channel-context.c +++ b/libtelepathy-logger/channel-text.c @@ -25,16 +25,17 @@ * signals. */ +#include "channel-text.h" + #include <telepathy-glib/contact.h> #include <telepathy-glib/enums.h> -#include <tpl-observer.h> -#include <tpl-text-channel-context.h> -#include <tpl-channel.h> -#include <tpl-log-entry.h> -#include <tpl-log-entry-text.h> -#include <tpl-log-manager-priv.h> -#include <tpl-contact.h> +#include <contact.h> +#include <channel.h> +#include <observer.h> +#include <log-entry.h> +#include <log-entry-text.h> +#include <log-manager-priv.h> #define TP_CONTACT_FEATURES_LEN 2 #define TP_CONTACT_MYSELF 0 diff --git a/src/tpl-text-channel-context.h b/libtelepathy-logger/channel-text.h index 94a1e1f..fc27983 100644 --- a/src/tpl-text-channel-context.h +++ b/libtelepathy-logger/channel-text.h @@ -27,15 +27,15 @@ */ #include <glib-object.h> -#include <telepathy-glib/channel.h> #include <telepathy-glib/account.h> +#include <telepathy-glib/channel.h> #include <telepathy-glib/connection.h> #include <telepathy-glib/contact.h> #include <telepathy-glib/svc-client.h> -#include <tpl-channel.h> -#include <tpl-observer.h> -#include <tpl-utils.h> +#include <channel.h> +#include <observer.h> +#include <utils.h> G_BEGIN_DECLS diff --git a/src/tpl-channel.c b/libtelepathy-logger/channel.c index 9373ea9..d14b62f 100644 --- a/src/tpl-channel.c +++ b/libtelepathy-logger/channel.c @@ -19,40 +19,14 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ -#include <glib.h> -#include <tpl-observer.h> -#include <tpl-channel.h> -#include <tpl-text-channel-context.h> - -G_DEFINE_TYPE (TplChannel, tpl_channel, G_TYPE_OBJECT) - -static void tpl_channel_dispose (GObject *obj); -static void tpl_channel_finalize (GObject *obj); +#include "channel.h" -static void tpl_channel_class_init (TplChannelClass* klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = tpl_channel_dispose; - object_class->finalize = tpl_channel_finalize; -} +#include <glib.h> +#include <channel-text.h> +#include <observer.h> -static void tpl_channel_init (TplChannel* self) -{ - /* Init TplChannel's members to zero/NULL */ -#define TPL_SET_NULL(x) tpl_channel_set_##x(self, NULL) - TPL_SET_NULL(channel); - TPL_SET_NULL(channel_path); - TPL_SET_NULL(channel_type); - TPL_SET_NULL(channel_properties); - TPL_SET_NULL(account); - TPL_SET_NULL(account_path); - TPL_SET_NULL(connection); - TPL_SET_NULL(connection_path); - TPL_SET_NULL(observer); -#undef TPL_SET_NULL -} +G_DEFINE_TYPE (TplChannel, tpl_channel, G_TYPE_OBJECT) static void tpl_channel_dispose (GObject* obj) { @@ -93,6 +67,32 @@ static void tpl_channel_finalize (GObject* obj) g_debug("TplChannel instance finalized\n"); } +static void tpl_channel_class_init (TplChannelClass* klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = tpl_channel_dispose; + object_class->finalize = tpl_channel_finalize; +} + + +static void tpl_channel_init (TplChannel* self) +{ + /* Init TplChannel's members to zero/NULL */ +/* TODO remove the comment +#define TPL_SET_NULL(x) tpl_channel_set_##x(self, NULL) + TPL_SET_NULL(channel); + TPL_SET_NULL(channel_path); + TPL_SET_NULL(channel_type); + TPL_SET_NULL(channel_properties); + TPL_SET_NULL(account); + TPL_SET_NULL(account_path); + TPL_SET_NULL(connection); + TPL_SET_NULL(connection_path); + TPL_SET_NULL(observer); +#undef TPL_SET_NULL +*/ +} TplChannel* tpl_channel_new(TpSvcClientObserver* observer) diff --git a/src/tpl-channel.h b/libtelepathy-logger/channel.h index 0fc9e30..307f01e 100644 --- a/src/tpl-channel.h +++ b/libtelepathy-logger/channel.h @@ -24,13 +24,13 @@ #include <glib.h> #include <glib-object.h> -#include <telepathy-glib/channel.h> #include <telepathy-glib/account.h> #include <telepathy-glib/connection.h> +#include <telepathy-glib/channel.h> #include <telepathy-glib/svc-client.h> -#include <tpl-observer.h> -#include <tpl-utils.h> +#include <observer.h> +#include <utils.h> G_BEGIN_DECLS diff --git a/libtelepathy-logger/conf.c b/libtelepathy-logger/conf.c new file mode 100644 index 0000000..00d07df --- /dev/null +++ b/libtelepathy-logger/conf.c @@ -0,0 +1,90 @@ + /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + /* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> + */ + +#include "conf.h" + +#include <glib.h> + +#define DEBUG(...) + +G_DEFINE_TYPE (TplConf, tpl_conf, G_TYPE_OBJECT) + + +static void +tpl_conf_finalize (GObject *obj) +{ + + G_OBJECT_CLASS (tpl_conf_parent_class)->finalize (obj); +} + +static void +tpl_conf_dispose (GObject *obj) +{ + TplConf *self = TPL_CONF(obj); + + tpl_object_unref_if_not_null (tpl_conf_get_entry(self)); + self->entry.generic = NULL; + + G_OBJECT_CLASS (tpl_conf_parent_class)->dispose (obj); +} + + +static void +tpl_conf_class_init(TplConfClass* klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + object_class->finalize = tpl_conf_finalize; + object_class->dispose = tpl_conf_dispose; +} + +static void +tpl_conf_init(TplConf* self) +{ + self->client = gconf_client_get_default(); +} + + +TplConf *tpl_conf_new (void) +{ + return g_object_new(TPL_TYPE_CONF, NULL); +} +#define GCONF_KEY_DISABLING_GLOBAL "/apps/telepathy-logger/disabling/global"; +#define GCONF_KEY_DISABLING_ACCOUNT_LIST "/apps/telepathy-logger/disabling/accounts/blocklist" +gboolean *tpl_conf_is_enabled_globally (TplConf* self) +{ + GConfValue *val = gconf_client_get (self->client, GCONF_KEY_DISABLING_GLOBAL, &error); + return !gconf_value_get_bool(val); +} + +void tpl_conf_enable_globally (TplConf* self) +{ + GConfValue *val = gconf_value_new (GCONF_VALUE_BOOL); + gconf_value_set_bool (val, FALSE); // not disabling + gconf_client_set(self->client, GCONF_KEY_DISABLING_GLOBAL, val); +} + + +void tpl_conf_enable_globally (TplConf* self) +{ + GConfValue *val = gconf_value_new (GCONF_VALUE_BOOL); + gconf_value_set_bool (val, TRUE); // disabling + gconf_client_set(self->client, GCONF_KEY_DISABLING_GLOBAL, val); +} diff --git a/src/tpl-contact.c b/libtelepathy-logger/contact.c index 4870526..4e6a67a 100644 --- a/src/tpl-contact.c +++ b/libtelepathy-logger/contact.c @@ -19,10 +19,11 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ +#include "contact.h" + #include <telepathy-glib/account.h> -#include <tpl-contact.h> -#include <tpl-utils.h> +#include <utils.h> G_DEFINE_TYPE (TplContact, tpl_contact, G_TYPE_OBJECT) @@ -38,40 +39,31 @@ static void tpl_contact_class_init(TplContactClass *klass) static void tpl_contact_init(TplContact *self) { -#define SET_NULL(member) self->member = NULL - SET_NULL(contact); - SET_NULL(alias); - SET_NULL(identifier); - SET_NULL(presence_status); - SET_NULL(presence_message); -#undef SET_NULL } static void tpl_contact_finalize(GObject *obj) { TplContact *self = TPL_CONTACT(obj); - g_free ((gchar*) self->alias); + g_free (self->alias); self->alias = NULL; - g_free ((gchar*) self->identifier); + g_free (self->identifier); self->identifier = NULL; - g_free ((gchar*) self->presence_status); + g_free (self->presence_status); self->presence_status = NULL; - g_free ((gchar*) self->presence_message); + g_free (self->presence_message); self->presence_message = NULL; G_OBJECT_CLASS (tpl_contact_parent_class)->finalize (obj); - g_debug("TplContact finalized\n"); } static void tpl_contact_dispose(GObject *obj) { TplContact *self = TPL_CONTACT(obj); - + tpl_object_unref_if_not_null(self->contact); self->contact = NULL; - + G_OBJECT_CLASS (tpl_contact_parent_class)->dispose (obj); - g_debug("TplContact disposed\n"); } @@ -79,22 +71,13 @@ static void tpl_contact_dispose(GObject *obj) TplContact *tpl_contact_from_tp_contact (TpContact *contact) { TplContact *ret; - const gchar *identifier, *alias; - const gchar *presence_message, *presence_status; ret = tpl_contact_new (); - identifier = tp_contact_get_identifier (contact); - alias = tp_contact_get_alias (contact); - presence_status = tp_contact_get_presence_status (contact); - presence_message = tp_contact_get_presence_message (contact); - -#define CONTACT_ENTRY_SET(x) tpl_contact_set_##x(ret, x) - CONTACT_ENTRY_SET(contact); - CONTACT_ENTRY_SET(alias); - CONTACT_ENTRY_SET(identifier); - CONTACT_ENTRY_SET(presence_status); - CONTACT_ENTRY_SET(presence_message); -#undef CONTACT_ENTRY_SET + tpl_contact_set_contact (ret, contact); + tpl_contact_set_identifier (ret, (gchar*) tp_contact_get_identifier (contact)); + tpl_contact_set_alias (ret, (gchar*) tp_contact_get_alias (contact)); + tpl_contact_set_presence_status (ret, (gchar*) tp_contact_get_presence_status (contact)); + tpl_contact_set_presence_message (ret, (gchar*) tp_contact_get_presence_message (contact)); return ret; } @@ -106,44 +89,49 @@ TplContact *tpl_contact_new(void) TpContact *tpl_contact_get_contact(TplContact *self) { + g_return_val_if_fail(TPL_IS_CONTACT(self), NULL); return self->contact; } -const gchar *tpl_contact_get_alias(TplContact *self) +gchar *tpl_contact_get_alias(TplContact *self) { + g_return_val_if_fail(TPL_IS_CONTACT(self), NULL); return self->alias; } -const gchar *tpl_contact_get_identifier(TplContact *self) +gchar *tpl_contact_get_identifier(TplContact *self) { + g_return_val_if_fail(TPL_IS_CONTACT(self), NULL); return self->identifier; } -const gchar *tpl_contact_get_presence_status(TplContact *self) +gchar *tpl_contact_get_presence_status(TplContact *self) { + g_return_val_if_fail(TPL_IS_CONTACT(self), NULL); return self->presence_status; } -const gchar *tpl_contact_get_presence_message(TplContact *self) +gchar *tpl_contact_get_presence_message(TplContact *self) { + g_return_val_if_fail(TPL_IS_CONTACT(self), NULL); return self->presence_message; } TplContactType tpl_contact_get_contact_type(TplContact *self) { + g_return_val_if_fail (TPL_IS_CONTACT (self), TPL_CONTACT_UNKNOWN); return self->contact_type; } TpAccount *tpl_contact_get_account(TplContact *self) { + g_return_val_if_fail(TPL_IS_CONTACT(self), NULL); return self->account; } void tpl_contact_set_contact(TplContact *self, TpContact *data) { - g_assert(TPL_IS_CONTACT(self)); - g_assert(TP_IS_CONTACT(data)||data==NULL); g_return_if_fail(TPL_IS_CONTACT(self)); g_return_if_fail(TP_IS_CONTACT(data)||data==NULL); @@ -154,8 +142,6 @@ void tpl_contact_set_contact(TplContact *self, TpContact *data) void tpl_contact_set_account(TplContact *self, TpAccount *data) { - g_assert(TPL_IS_CONTACT(self)); - g_assert(TP_IS_ACCOUNT(data)||data==NULL); g_return_if_fail(TPL_IS_CONTACT(self)); g_return_if_fail(TP_IS_ACCOUNT(data)||data==NULL); @@ -164,52 +150,42 @@ void tpl_contact_set_account(TplContact *self, TpAccount *data) tpl_object_ref_if_not_null(data); } -void tpl_contact_set_alias(TplContact *self, const gchar *data) -{ - g_assert(TPL_IS_CONTACT(self)); +void tpl_contact_set_alias(TplContact *self, gchar *data) +{ g_return_if_fail(TPL_IS_CONTACT(self)); - // TODO check data validity - g_free( (gchar*) self->alias); - self->alias = g_strdup (data); + g_free (self->alias); + self->alias = g_strdup (data); } -void tpl_contact_set_identifier(TplContact *self, const gchar *data) -{ - g_assert(TPL_IS_CONTACT(self)); +void tpl_contact_set_identifier(TplContact *self, gchar *data) +{ g_return_if_fail(TPL_IS_CONTACT(self)); - // TODO check data validity - g_free( (gchar*) self->identifier); - self->identifier = g_strdup (data); + g_free (self->identifier); + self->identifier = g_strdup (data); } -void tpl_contact_set_presence_status(TplContact *self, const gchar *data) -{ - g_assert(TPL_IS_CONTACT(self)); - g_return_if_fail(TPL_IS_CONTACT(self)); - // TODO check data validity +void tpl_contact_set_presence_status(TplContact *self, gchar *data) +{ + g_return_if_fail (TPL_IS_CONTACT(self)); - g_free( (gchar*) self->presence_status); - self->presence_status = g_strdup (data); + g_free (self->presence_status); + self->presence_status = g_strdup (data); } -void tpl_contact_set_presence_message(TplContact *self, const gchar *data) -{ - g_assert(TPL_IS_CONTACT(self)); - g_return_if_fail(TPL_IS_CONTACT(self)); - // TODO check data validity +void tpl_contact_set_presence_message(TplContact *self, gchar *data) +{ + g_return_if_fail (TPL_IS_CONTACT(self)); - g_free( (gchar*) self->presence_message); - self->presence_message = g_strdup (data); + g_free(self->presence_message); + self->presence_message = g_strdup (data); } void tpl_contact_set_contact_type(TplContact *self, TplContactType data) { - g_assert(TPL_IS_CONTACT(self)); g_return_if_fail(TPL_IS_CONTACT(self)); - // TODO check data validity self->contact_type = data; } diff --git a/src/tpl-contact.h b/libtelepathy-logger/contact.h index 1d28bbc..006f16b 100644 --- a/src/tpl-contact.h +++ b/libtelepathy-logger/contact.h @@ -24,6 +24,7 @@ #include <glib-object.h> #include <telepathy-glib/contact.h> +#include <telepathy-glib/account.h> G_BEGIN_DECLS @@ -36,6 +37,7 @@ G_BEGIN_DECLS typedef enum { + TPL_CONTACT_UNKNOWN, TPL_CONTACT_USER, TPL_CONTACT_GROUP } TplContactType; @@ -46,10 +48,10 @@ typedef struct { /* Private */ TpContact *contact; TplContactType contact_type; - const gchar *alias; - const gchar *identifier; - const gchar *presence_status; - const gchar *presence_message; + gchar *alias; + gchar *identifier; + gchar *presence_status; + gchar *presence_message; TpAccount *account; } TplContact; @@ -68,13 +70,13 @@ TplContact *tpl_contact_new(void); TpContact *tpl_contact_get_contact(TplContact *self); -const gchar *tpl_contact_get_alias(TplContact *self); +gchar *tpl_contact_get_alias(TplContact *self); -const gchar *tpl_contact_get_identifier(TplContact *self); +gchar *tpl_contact_get_identifier(TplContact *self); -const gchar *tpl_contact_get_presence_status(TplContact *self); +gchar *tpl_contact_get_presence_status(TplContact *self); -const gchar *tpl_contact_get_presence_message(TplContact *self); +gchar *tpl_contact_get_presence_message(TplContact *self); TplContactType tpl_contact_get_contact_type(TplContact *self); @@ -84,13 +86,13 @@ void tpl_contact_set_contact(TplContact *self, TpContact *data); void tpl_contact_set_account(TplContact *self, TpAccount *data); -void tpl_contact_set_alias(TplContact *self, const gchar *data); +void tpl_contact_set_alias(TplContact *self, gchar *data); -void tpl_contact_set_identifier(TplContact *self, const gchar *data); +void tpl_contact_set_identifier(TplContact *self, gchar *data); -void tpl_contact_set_presence_status(TplContact *self, const gchar *data); +void tpl_contact_set_presence_status(TplContact *self, gchar *data); -void tpl_contact_set_presence_message(TplContact *self, const gchar *data); +void tpl_contact_set_presence_message(TplContact *self, gchar *data); void tpl_contact_set_contact_type(TplContact *self, TplContactType data); diff --git a/src/tpl-time.c b/libtelepathy-logger/datetime.c index a9ab267..1ee3c1a 100644 --- a/src/tpl-time.c +++ b/libtelepathy-logger/datetime.c @@ -20,13 +20,14 @@ * Authors: Richard Hult <richard@imendio.com> */ -#include <time.h> +#include "datetime.h" + +#include <glib/gi18n.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <glib/gi18n.h> +#include <time.h> -#include <tpl-time.h> /* Note: TplTime is always in UTC. */ diff --git a/src/tpl-time.h b/libtelepathy-logger/datetime.h index 5fc5cf3..5fc5cf3 100644 --- a/src/tpl-time.h +++ b/libtelepathy-logger/datetime.h diff --git a/libtelepathy-logger/debug.h b/libtelepathy-logger/debug.h new file mode 100644 index 0000000..430b050 --- /dev/null +++ b/libtelepathy-logger/debug.h @@ -0,0 +1,2 @@ + +#define DEBUG(...) diff --git a/src/libtelepathy-logger.pc.in b/libtelepathy-logger/libtelepathy-logger.pc.in index c11a59f..c11a59f 100644 --- a/src/libtelepathy-logger.pc.in +++ b/libtelepathy-logger/libtelepathy-logger.pc.in diff --git a/src/tpl-log-entry-text.c b/libtelepathy-logger/log-entry-text.c index cb036d5..8ffac39 100644 --- a/src/tpl-log-entry-text.c +++ b/libtelepathy-logger/log-entry-text.c @@ -19,10 +19,11 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ -#include <tpl-log-entry-text.h> -#include <tpl-channel.h> -#include <tpl-contact.h> -#include <tpl-utils.h> +#include "log-entry-text.h" + +#include <channel.h> +#include <contact.h> +#include <utils.h> G_DEFINE_TYPE (TplLogEntryText, tpl_log_entry_text, G_TYPE_OBJECT) diff --git a/src/tpl-log-entry-text.h b/libtelepathy-logger/log-entry-text.h index 61c4be1..35b073f 100644 --- a/src/tpl-log-entry-text.h +++ b/libtelepathy-logger/log-entry-text.h @@ -25,8 +25,8 @@ #include <glib-object.h> #include <telepathy-glib/enums.h> -#include <tpl-text-channel-context.h> -#include <tpl-contact.h> +#include <channel-text.h> +#include <contact.h> G_BEGIN_DECLS diff --git a/src/tpl-log-entry.c b/libtelepathy-logger/log-entry.c index c311d0a..3aefe27 100644 --- a/src/tpl-log-entry.c +++ b/libtelepathy-logger/log-entry.c @@ -19,18 +19,20 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ -#include <glib.h> +#include "log-entry.h" -#include <tpl-log-entry.h> +#include <glib.h> -#define DEBUG(...) +#include <debug.h> G_DEFINE_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT) static void tpl_log_entry_finalize (GObject *obj) -{} +{ + G_OBJECT_CLASS (tpl_log_entry_parent_class)->finalize (obj); +} static void tpl_log_entry_dispose (GObject *obj) @@ -42,7 +44,7 @@ tpl_log_entry_dispose (GObject *obj) tpl_object_unref_if_not_null (tpl_log_entry_get_entry(self)); self->entry.generic = NULL; - G_OBJECT_CLASS (tpl_log_entry_parent_class)->finalize (obj); + G_OBJECT_CLASS (tpl_log_entry_parent_class)->dispose (obj); DEBUG("TplLogEntry: disposed\n"); } diff --git a/src/tpl-log-entry.h b/libtelepathy-logger/log-entry.h index 7a5a531..13a8621 100644 --- a/src/tpl-log-entry.h +++ b/libtelepathy-logger/log-entry.h @@ -24,7 +24,7 @@ #include <glib-object.h> -#include <tpl-log-entry-text.h> +#include <log-entry-text.h> G_BEGIN_DECLS diff --git a/src/tpl-log-manager-priv.h b/libtelepathy-logger/log-manager-priv.h index 9c0d78a..a514e58 100644 --- a/src/tpl-log-manager-priv.h +++ b/libtelepathy-logger/log-manager-priv.h @@ -24,7 +24,7 @@ #ifndef __TPL_LOG_MANAGER_PRIV_H__ #define __TPL_LOG_MANAGER_PRIV_H__ -#include <tpl-log-manager.h> +#include <log-manager.h> gboolean tpl_log_manager_add_message (TplLogManager *manager, const gchar *chat_id, gboolean chatroom, diff --git a/src/tpl-log-manager.c b/libtelepathy-logger/log-manager.c index 905f5e3..c723ecf 100644 --- a/src/tpl-log-manager.c +++ b/libtelepathy-logger/log-manager.c @@ -22,21 +22,22 @@ * Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ +#include "log-manager.h" // RO + #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <glib/gstdio.h> -#include <telepathy-glib/util.h> +#include <glib/gstdio.h> #include <telepathy-glib/interfaces.h> +#include <telepathy-glib/util.h> -#include <tpl-log-entry.h> -#include <tpl-log-manager.h> // RO -#include <tpl-log-manager-priv.h> // W -#include <tpl-log-store-empathy.h> -#include <tpl-log-store.h> -#include <tpl-utils.h> -#include <tpl-time.h> +#include <log-entry.h> +#include <log-manager-priv.h> // W +#include <log-store.h> +#include <log-store-empathy.h> +#include <datetime.h> +#include <utils.h> //#define DEBUG_FLAG EMPATHY_DEBUG_OTHER //#include <empathy-debug.h> diff --git a/src/tpl-log-manager.h b/libtelepathy-logger/log-manager.h index f3c3a40..0aabb74 100644 --- a/src/tpl-log-manager.h +++ b/libtelepathy-logger/log-manager.h @@ -26,10 +26,9 @@ #include <glib-object.h> - #include <telepathy-glib/account.h> -#include <tpl-log-entry.h> +#include <log-entry.h> G_BEGIN_DECLS diff --git a/src/tpl-log-store-empathy.c b/libtelepathy-logger/log-store-empathy.c index 307e97e..7117a06 100644 --- a/src/tpl-log-store-empathy.c +++ b/libtelepathy-logger/log-store-empathy.c @@ -22,30 +22,26 @@ * Jonny Lamb <jonny.lamb@collabora.co.uk> */ -//#include <config.h> +#include "log-store-empathy.h" #include <string.h> #include <stdio.h> #include <stdlib.h> #include <glib/gstdio.h> +#include <glib-object.h> #include <libxml/parser.h> #include <libxml/tree.h> - -#include <glib-object.h> - -#include <telepathy-glib/account-manager.h> #include <telepathy-glib/account.h> -#include <telepathy-glib/util.h> +#include <telepathy-glib/account-manager.h> #include <telepathy-glib/defs.h> +#include <telepathy-glib/util.h> -#include <tpl-log-store.h> -#include <tpl-log-store-empathy.h> -#include <tpl-log-manager.h> - -#include <tpl-time.h> -#include <tpl-log-entry-text.h> -#include <tpl-contact.h> +#include <contact.h> +#include <log-manager.h> +#include <log-store.h> +#include <log-entry-text.h> +#include <datetime.h> #define DEBUG g_debug diff --git a/src/tpl-log-store-empathy.h b/libtelepathy-logger/log-store-empathy.h index a0cb5ac..a76f0b6 100644 --- a/src/tpl-log-store-empathy.h +++ b/libtelepathy-logger/log-store-empathy.h @@ -26,6 +26,7 @@ #define __TPL_LOG_STORE_EMPATHY_H__ #include <glib.h> +#include <glib-object.h> G_BEGIN_DECLS diff --git a/src/tpl-log-store.c b/libtelepathy-logger/log-store.c index a32581e..d3ec967 100644 --- a/src/tpl-log-store.c +++ b/libtelepathy-logger/log-store.c @@ -20,7 +20,7 @@ * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk> */ -#include <tpl-log-store.h> +#include "log-store.h" GType tpl_log_store_get_type (void) diff --git a/src/tpl-log-store.h b/libtelepathy-logger/log-store.h index 9b3e589..cfce5a3 100644 --- a/src/tpl-log-store.h +++ b/libtelepathy-logger/log-store.h @@ -26,8 +26,8 @@ #include <glib-object.h> #include <telepathy-glib/account.h> -#include <tpl-log-manager.h> -#include <tpl-log-entry-text.h> +#include <log-manager.h> +#include <log-entry-text.h> G_BEGIN_DECLS diff --git a/src/tpl-observer.c b/libtelepathy-logger/observer.c index 3e94704..e02fbd1 100644 --- a/src/tpl-observer.c +++ b/libtelepathy-logger/observer.c @@ -19,8 +19,9 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ -#include <glib.h> +#include "observer.h" +#include <glib.h> #include <telepathy-glib/interfaces.h> #include <telepathy-glib/channel.h> #include <telepathy-glib/gtypes.h> @@ -28,10 +29,9 @@ #include <telepathy-glib/svc-generic.h> #include <telepathy-glib/svc-client.h> -#include <tpl-observer.h> -#include <tpl-channel.h> -#include <tpl-text-channel-context.h> -#include <tpl-log-manager.h> +#include <channel.h> +#include <channel-text.h> +#include <log-manager.h> // TODO move to a member of TplObserver static TplLogManager *logmanager = NULL; @@ -308,9 +308,30 @@ static gboolean tpl_str_are_eq(gconstpointer data, gconstpointer data2) static void tpl_observer_init (TplObserver *self) { + DBusGConnection *bus; + TpDBusDaemon *tp_bus; + GError *error = NULL; + self->channel_map = g_hash_table_new_full (g_str_hash, tpl_str_are_eq, g_free, g_object_unref); logmanager = tpl_log_manager_dup_singleton (); + + bus = tp_get_bus(); + tp_bus = tp_dbus_daemon_new(bus); + + if ( tp_dbus_daemon_request_name (tp_bus, TPL_OBSERVER_WELL_KNOWN_BUS_NAME, + TRUE, &error) ) { + g_debug("%s DBus well known name registered\n", + TPL_OBSERVER_WELL_KNOWN_BUS_NAME); + } else { + g_error("Well Known name request error: %s\n", error->message); + g_clear_error(&error); + g_error_free(error); + } + + dbus_g_connection_register_g_object (bus, + TPL_OBSERVER_OBJECT_PATH, + G_OBJECT(self)); } static void diff --git a/src/tpl-observer.h b/libtelepathy-logger/observer.h index 7daf4c9..7daf4c9 100644 --- a/src/tpl-observer.h +++ b/libtelepathy-logger/observer.h diff --git a/libtelepathy-logger/telepathy-logger.schemas b/libtelepathy-logger/telepathy-logger.schemas new file mode 100644 index 0000000..511dc94 --- /dev/null +++ b/libtelepathy-logger/telepathy-logger.schemas @@ -0,0 +1,32 @@ +<gconfschemafile> + <schemalist> + + <schema> + <key>/schemas/apps/telepathy-logger/disabling/global</key> + <applyto>/apps/telepathy-logger/disabling/global</applyto> + <owner>telepathy-logger</owner> + <type>bool</type> + <default>TRUE</default> + <locale name="C"> + <short>Globally enable or to disable logging</short> + <long>Globally enable or disable the telepathy logging system. +Setting it to "false" will completely disable any logging</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/telepathy-logger/disabling/accounts/blocklist</key> + <applyto>/apps/telepathy-logger/disabling/accounts/blocklist</applyto> + <owner>telepathy-logger</owner> + <type>list</type> + <list_type>string</list_type> + <default>true</default> + <locale name="C"> + <short>A list of accounts for which logging is disabled</short> + <long>Disables logging for the named accounts, when logging is +globally enabled. Globally disabling logging will ignore this key.</long> + </locale> + </schema> + +</schemalist> +</gconfschemafile> diff --git a/src/tpl-utils.c b/libtelepathy-logger/utils.c index 9572991..09207d2 100644 --- a/src/tpl-utils.c +++ b/libtelepathy-logger/utils.c @@ -19,7 +19,7 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ -#include <tpl-utils.h> +#include "utils.h" void tpl_object_unref_if_not_null(void* data) { if (data && G_IS_OBJECT(data)) { diff --git a/src/tpl-utils.h b/libtelepathy-logger/utils.h index 6eccf97..6eccf97 100644 --- a/src/tpl-utils.h +++ b/libtelepathy-logger/utils.h diff --git a/src/Makefile.am b/src/Makefile.am index 122164e..d0b8b4a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,54 +3,25 @@ include $(top_srcdir)/tools/flymake.mk AM_CPPFLAGS = \ $(ERROR_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/libtelepathy-logger \ -DG_LOG_DOMAIN=\"TPLogger\" \ - $(TPL_CFLAGS) \ $(LIBTPL_CFLAGS) \ + $(TPL_CFLAGS) \ $(DISABLE_DEPRECATED) \ $(WARN_CFLAGS) -#LDADD = $(TPL_LIBS) \ -# $(LIBTPL_LIBS) + +LDADD = \ + $(top_builddir)/libtelepathy-logger/libtelepathy-logger.la \ + $(LIBTPL_LIBS) + +# TODO removeme: kludge to let the compilation work, or it doesn't know how to buld the lib +$(top_builddir)/libtelepathy-logger/libtelepathy-logger.la: + $(MAKE) -C $(top_builddir)/libtelepathy-logger libtelepathy-logger.la BUILT_SOURCES = \ - tpl-dbus-service-server.h \ - tpl-dbus-service-client.h - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libtelepathy-logger.pc - -lib_LTLIBRARIES = libtelepathy-logger.la - -LIBTPLdir = $(includedir)/telepathy-logger -LIBTPL_HEADERS = \ - tpl-channel.h \ - tpl-contact.h \ - tpl-log-entry.h \ - tpl-log-entry-text.h \ - tpl-log-manager.h \ - tpl-log-manager-priv.h \ - tpl-log-store-empathy.h \ - tpl-log-store.h \ - tpl-observer.h \ - tpl-text-channel-context.h \ - tpl-time.h \ - tpl-utils.h - - -libtelepathy_logger_la_SOURCES = \ - tpl-observer.c \ - tpl-channel.c \ - tpl-text-channel-context.c \ - tpl-log-entry.c \ - tpl-log-entry-text.c \ - tpl-contact.c \ - tpl-log-manager.c \ - tpl-log-store.c \ - tpl-log-store-empathy.c \ - tpl-utils.c \ - tpl-time.c + dbus-service-server.h \ + dbus-service-client.h bin_PROGRAMS = \ telepathy-logger-dbus \ @@ -58,57 +29,35 @@ bin_PROGRAMS = \ test-api telepathy_logger_dbus_SOURCES = \ - tpl-dbus-service.c \ + dbus-service.c \ telepathy-logger-dbus.c -telepathy_logger_dbus_LDADD = libtelepathy-logger.la $(TPL_LIBS) +#telepathy_logger_dbus_LDADD = $(LDADD) $(TPL_LIBS) test_api_SOURCES = test_api.c -test_api_LDADD = libtelepathy-logger.la $(LIBTPL_LIBS) +#test_api_LDADD = $(LDADD) $(LIBTPL_LIBS) -telepathy_logger_SOURCES = \ - tpl-headless-logger-init.c \ - telepathy-logger.c -telepathy_logger_LDADD = libtelepathy-logger.la $(TPL_LIBS) +telepathy_logger_SOURCES = telepathy-logger.c +#telepathy_logger_LDADD = $(LDADD) $(TPL_LIBS) nodist_telepathy_logger_SOURCES = $(BUILT_SOURCES) check_c_sources = \ - $(libtelepathy_logger_la_SOURCES) \ $(test_api_SOURCES) \ $(telepathy_logger_SOURCES) \ $(telepathy_logger_dbus_SOURCES) include $(top_srcdir)/tools/check-coding-style.mk check-local: check-coding-style -EXTRA_DIST = \ - tpl-dbus-service.xml +EXTRA_DIST = dbus-service.xml #Rule to generate the binding headers -tpl-dbus-service-server.h: tpl-dbus-service.xml +dbus-service-server.h: dbus-service.xml dbus-binding-tool --prefix=tpl_dbus_service --mode=glib-server $< > $@ -tpl-dbus-service-client.h: tpl-dbus-service.xml +dbus-service-client.h: dbus-service.xml dbus-binding-tool --prefix=tpl_dbus_service --mode=glib-client $< > $@ -# rules for making the glib enum objects -%-enumtypes.h: %.h Makefile.in - $(QUIET_GEN)glib-mkenums \ - --fhead "#ifndef __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__\n#define __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \ - --fprod "/* enumerations from \"@filename@\" */\n" \ - --vhead "GType @enum_name@_get_type (void);\n#define $(shell echo $* | tr [:lower:]- [:upper:]_ | sed 's/_.*//')_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ - --ftail "G_END_DECLS\n\n#endif /* __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__ */" \ - $< > $@ - -%-enumtypes.c: %.h Makefile.in - $(QUIET_GEN)glib-mkenums \ - --fhead "#include <$*.h>\n#include <$*-enumtypes.h>" \ - --fprod "\n/* enumerations from \"@filename@\" */" \ - --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ - --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@VALUENAME@\" }," \ - --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ - $< > $@ - CLEANFILES = $(BUILT_SOURCES) # Dbus service file diff --git a/src/compile.sh b/src/compile.sh index 67efd01..34eb9a6 100755 --- a/src/compile.sh +++ b/src/compile.sh @@ -4,15 +4,15 @@ PACKAGE_NAME="TpLogger" CC=${CC:-gcc} CCOPTS="-D_POSIX_SOURCE -DPACKAGE_NAME=\"${PACKAGE_NAME}\" --std=c99 -g -I../include -Wall -Werror" # -pedantic" PKGS="telepathy-glib libxml-2.0" -MODULES="tpl-observer.c tpl-headless-logger-init.c - tpl-channel.c tpl-text-channel-context.c - tpl-contact.c - tpl-utils.c - tpl-time.c - tpl-log-manager.c - tpl-log-store.c - tpl-log-store-empathy.c - tpl-log-entry-text.c +MODULES="observer.c headless-logger-init.c + channel.c channel-text.c + contact.c + utils.c + time.c + log-manager.c + log-store.c + log-store-empathy.c + log-entry-text.c test.c" EXECUTABLE="telepathy-logger" diff --git a/src/tpl-dbus-service.c b/src/dbus-service.c index 33201aa..be7cf9b 100644 --- a/src/tpl-dbus-service.c +++ b/src/dbus-service.c @@ -19,14 +19,15 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ +#include "dbus-service.h" + #include <glib.h> #include <glib/gprintf.h> #include <telepathy-glib/dbus.h> #include <telepathy-glib/account.h> -#include <tpl-dbus-service.h> -#include <tpl-log-manager.h> +#include <log-manager.h> #define DBUS_STRUCT_STRING_STRING_UINT \ (dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID)) @@ -38,7 +39,7 @@ tpl_dbus_service_last_chats (TplDBusService *self, gboolean is_chatroom, guint lines, DBusGMethodInvocation *context); -#include <tpl-dbus-service-server.h> +#include <dbus-service-server.h> G_DEFINE_TYPE (TplDBusService, tpl_dbus_service, G_TYPE_OBJECT) @@ -176,15 +177,15 @@ tpl_dbus_service_last_chats (TplDBusService *self, return FALSE; } - GList *dates = tpl_log_manager_get_dates(self->manager, account, identifier, is_chatroom); + GList *dates = tpl_log_manager_get_dates(self->manager, account, + identifier, is_chatroom); if(!dates) { - g_set_error(&error, + g_set_error_literal(&error, TPL_DBUS_SERVICE_ERROR, - TPL_DBUS_SERVICE_ERROR_GENERIC, + TPL_DBUS_SERVICE_ERROR_FAILED, "Error during date list retrieving"); - g_error(error->message); dbus_g_method_return_error(context, error); - g_error_free(error); + //g_error_free(error); g_object_unref(tp_dbus); g_object_unref(dbus); return FALSE; diff --git a/src/tpl-dbus-service.h b/src/dbus-service.h index fe69d93..ed47a40 100644 --- a/src/tpl-dbus-service.h +++ b/src/dbus-service.h @@ -28,7 +28,8 @@ "/org/freedesktop/Telepathy/TelepathyLoggerService" #include <glib-object.h> -#include <tpl-log-manager.h> + +#include <log-manager.h> G_BEGIN_DECLS @@ -41,8 +42,8 @@ G_BEGIN_DECLS #define TPL_DBUS_SERVICE_ERROR g_quark_from_static_string ("tpl-dbus-service-error-quark") typedef enum { - TPL_DBUS_SERVICE_ERROR_GENERIC -} TplDBusServiceErrorCode; + TPL_DBUS_SERVICE_ERROR_FAILED +} TplDBusServiceError; typedef struct { GObject parent; diff --git a/src/tpl-dbus-service.xml b/src/dbus-service.xml index be4fe2c..be4fe2c 100644 --- a/src/tpl-dbus-service.xml +++ b/src/dbus-service.xml diff --git a/src/tpl-log-manager.xsl b/src/log-manager.xsl index a934f3a..a934f3a 100644 --- a/src/tpl-log-manager.xsl +++ b/src/log-manager.xsl diff --git a/src/telepathy-logger-dbus.c b/src/telepathy-logger-dbus.c index 6691b0b..89f8a4d 100644 --- a/src/telepathy-logger-dbus.c +++ b/src/telepathy-logger-dbus.c @@ -22,9 +22,9 @@ #include <glib.h> #include <telepathy-glib/dbus.h> - #include <telepathy-logger-dbus.h> -#include <tpl-dbus-service.h> + +#include <dbus-service.h> static GMainLoop *loop = NULL; diff --git a/src/telepathy-logger.c b/src/telepathy-logger.c index 0042001..502c8f1 100644 --- a/src/telepathy-logger.c +++ b/src/telepathy-logger.c @@ -21,7 +21,7 @@ #include <glib.h> -#include <tpl-observer.h> +#include <observer.h> static GMainLoop *loop = NULL; @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { g_type_init (); - tpl_headless_logger_init (); + tpl_observer_new (); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); diff --git a/src/test_api.c b/src/test_api.c index 2d3b542..6821d94 100644 --- a/src/test_api.c +++ b/src/test_api.c @@ -20,22 +20,26 @@ */ #include <glib.h> +#include <gconf/gconf-client.h> //#include <stdio.h> //#include <dbus/dbus-glib-bindings.h> -//#include <tpl-log-manager.h> //#include <telepathy-glib/account.h> #include <telepathy-glib/dbus.h> -#include <tpl-dbus-service-client.h> -#include <tpl-dbus-service.h> -#include <tpl-time.h> +//#include <log-manager.h> +#include <dbus-service-client.h> +#include <dbus-service.h> +#include <datetime.h> #define ACCOUNT_PATH "/org/freedesktop/Telepathy/Account/gabble/jabber/cosimo_2ealfarano_40collabora_2eco_2euk0" #define CHAT_ID "echo@test.collabora.co.uk" -static GMainLoop *loop = NULL; +#define GCONF_LIST "/apps/telepathy-logger/disabling/accounts/blocklist" + +static GMainLoop *loop = NULL; +/* static void cb (DBusGProxy *proxy, GPtrArray *retval, GError *error, gpointer userdata) @@ -55,7 +59,7 @@ cb (DBusGProxy *proxy, GPtrArray *retval, GError *error, g_value_get_string(message)); } } - +*/ int main(int argc, char *argv[]) { DBusGProxy *proxy; @@ -69,14 +73,48 @@ int main(int argc, char *argv[]) TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME, TPL_DBUS_SRV_OBJECT_PATH, TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME); - +/* if (!org_freedesktop_Telepathy_TelepathyLoggerService_last_chats_async (proxy, ACCOUNT_PATH, CHAT_ID, FALSE, 11, cb, NULL)) { g_warning ("Async Woops remote method failed: %s", error->message); + g_clear_error (&error); g_error_free (error); return 1; } +*/ + GConfClient *client = gconf_client_get_default(); + GConfValue *val; + GSList *lst=NULL; + + val = gconf_client_get (client, GCONF_LIST, &error); + if (val==NULL) { + g_message("NULL LIST\n"); + } + else { + lst = gconf_value_get_list(val); + for(guint i=0; i<g_slist_length(lst);++i) { + g_message("pre GLIST %d: %s\n",i, (gchar*)g_slist_nth_data(lst, i)); + } + } + + lst = g_slist_prepend(lst, gconf_value_new_from_string( + GCONF_VALUE_STRING, "FOO", NULL)); + + val = gconf_value_new(GCONF_VALUE_LIST); + gconf_value_set_list_type(val, GCONF_VALUE_STRING); + gconf_value_set_list(val, lst); + gconf_client_set(client, GCONF_LIST, + val, NULL); + + val = gconf_client_get (client, GCONF_LIST, &error); + lst = gconf_value_get_list(val); + if (lst==NULL) g_message("NULL LIST\n"); + else { + for(guint i=0; i<g_slist_length(lst);++i) { + g_message("post GLIST %d: %s\n", i, (char*)g_slist_nth_data(lst, i)); + } + } loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); diff --git a/src/tpl-headless-logger-init.c b/src/tpl-headless-logger-init.c deleted file mode 100644 index 7ac5a79..0000000 --- a/src/tpl-headless-logger-init.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2009 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> - */ - - -#include <telepathy-glib/account-manager.h> -#include <telepathy-glib/channel-dispatch-operation.h> -#include <telepathy-glib/connection-manager.h> -#include <telepathy-glib/debug.h> - -#include <tpl-observer.h> -#include <tpl-log-store-empathy.h> - -/* - * Initialization of TPL (TelePathy Logger), it futurely set all the - * inernal structs. tpl_headless_logger_deinit will free/unref them - * - * TplObserver *observer - */ -void tpl_headless_logger_init(void) -{ - TplObserver *observer; - DBusGConnection *bus; - TpDBusDaemon *tp_bus; - GError *error = NULL; - - bus = tp_get_bus(); - tp_bus = tp_dbus_daemon_new(bus); - - if ( tp_dbus_daemon_request_name (tp_bus, TPL_OBSERVER_WELL_KNOWN_BUS_NAME, - TRUE, &error) ) { - g_print("%s DBus well known name registered\n", - TPL_OBSERVER_WELL_KNOWN_BUS_NAME); - } else { - g_print("Well Known name request error: %s\n", error->message); - g_clear_error(&error); - g_error_free(error); - } - - - - observer = tpl_observer_new (); - dbus_g_connection_register_g_object (bus, - TPL_OBSERVER_OBJECT_PATH, - G_OBJECT(observer)); -} |