[bijiben] configure: make zeitgeist optional
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] configure: make zeitgeist optional
- Date: Sun, 6 Oct 2013 22:21:41 +0000 (UTC)
commit 10aa57c2cbd81255f036d94fca269b0b7c9090b5
Author: Pierre-Yves Luyten <py luyten fr>
Date: Fri Oct 4 21:31:32 2013 +0200
configure: make zeitgeist optional
Check zeitgeist is available. Otherwise,
deactivate any zeitgeist call.
configure.ac | 15 +++++++++++--
src/Makefile.am | 6 ++++-
src/libbiji/.Makefile.am.swp | Bin 0 -> 12288 bytes
src/libbiji/Makefile.am | 46 ++++++++++++++++++++++++++++++-----------
src/libbiji/biji-note-book.c | 10 +++++++++
src/libbiji/biji-note-book.h | 5 ++++
src/libbiji/biji-note-obj.c | 13 +++++++++++
src/libbiji/biji-zeitgeist.c | 6 ++++-
src/libbiji/biji-zeitgeist.h | 11 +++++++++-
src/libbiji/libbiji.h | 4 +++
10 files changed, 97 insertions(+), 19 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3d5ca6c..757cdf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,12 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.35.0])
+
+
+
+
+
+
#
# Check if we should update the mime database
#
@@ -61,9 +67,11 @@ PKG_CHECK_MODULES(BIJIBEN,
libxml-2.0
tracker-sparql-0.16
uuid
- webkitgtk-3.0
- zeitgeist-2.0])
+ webkitgtk-3.0])
+
+PKG_CHECK_MODULES(ZEITGEIST, zeitgeist-2.0, [have_zeitgeist=yes], [have_zeitgeist=no])
+AM_CONDITIONAL(BUILD_ZEITGEIST, test x$have_zeitgeist = xyes)
GLIB_GSETTINGS
@@ -90,7 +98,8 @@ src/Makefile
AC_OUTPUT
-echo " Version: $VERSION
+echo " Version: $VERSION
+ Enable Zeitgeist $have_zeitgeist
Run make to compile."
diff --git a/src/Makefile.am b/src/Makefile.am
index 70187a6..6a472a8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ libexec_PROGRAMS= \
$(NULL)
AM_CPPFLAGS = \
+ -DDATADIR=\""$(datadir)"\" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
@@ -18,7 +19,10 @@ AM_CFLAGS =\
-Wall\
-g
-INCLUDES = -DDATADIR=\""$(datadir)"\"
+
+
+
+
LDADD = libbiji/libbiji.la \
-lm \
diff --git a/src/libbiji/.Makefile.am.swp b/src/libbiji/.Makefile.am.swp
new file mode 100644
index 0000000..ad53279
Binary files /dev/null and b/src/libbiji/.Makefile.am.swp differ
diff --git a/src/libbiji/Makefile.am b/src/libbiji/Makefile.am
index a43d22d..78ca950 100644
--- a/src/libbiji/Makefile.am
+++ b/src/libbiji/Makefile.am
@@ -1,6 +1,28 @@
noinst_LTLIBRARIES = \
libbiji.la
+libbiji_la_LIBADD = $(NULL)
+
+
+AM_CPPFLAGS = \
+ -DDATADIR=\""$(datadir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+ -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -I$(top_srcdir)/libgd \
+ -I$(top_srcdir)/src/ \
+ -I$(top_srcdir)/src/libiji \
+ $(BIJIBEN_CFLAGS)
+
+AM_CFLAGS =\
+ -Wall\
+ -g
+
+
+if BUILD_ZEITGEIST
+AM_CPPFLAGS += -DBUILD_ZEITGEIST
+endif
+
libbiji_la_built_sources = \
biji-marshalers.c \
biji-marshalers.h \
@@ -58,33 +80,31 @@ libbiji_la_SOURCES = \
serializer/biji-lazy-serializer.c \
serializer/biji-lazy-serializer.h
+
+
+
BUILT_SOURCES = \
$(libbiji_la_built_sources) \
$(NULL)
EXTRA_DIST = \
biji-marshalers.list \
- $(null)
+ $(NULL)
CLEANFILES = \
$(libbiji_la_built_sources) \
stamp-biji-marshalers.h \
$(NULL)
-AM_CPPFLAGS = \
- -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -I$(top_srcdir)/libgd \
- -I$(top_srcdir)/src/ \
- -I$(top_srcdir)/src/libiji \
- $(BIJIBEN_CFLAGS)
-AM_CFLAGS =\
- -Wall\
- -g
-INCLUDES = -DDATADIR=\""$(datadir)"\"
+if BUILD_ZEITGEIST
+ libbiji_la_LIBADD += \
+ $(ZEITGEIST_LIBS) \
+ $(NULL)
+endif
+
+
biji-marshalers.h: stamp-biji-marshalers.h
@true
diff --git a/src/libbiji/biji-note-book.c b/src/libbiji/biji-note-book.c
index a96f0e0..52dc2d2 100644
--- a/src/libbiji/biji-note-book.c
+++ b/src/libbiji/biji-note-book.c
@@ -43,7 +43,12 @@ struct _BijiNoteBookPrivate
GFile *location;
GError *error;
TrackerSparqlConnection *connection;
+
+
+#ifdef BUILD_ZEITGEIST
ZeitgeistLog *log;
+#endif /* BUILD_ZEITGEIST */
+
GdkRGBA color;
};
@@ -104,11 +109,13 @@ biji_note_book_init (BijiNoteBook *self)
}
+#ifdef BUILD_ZEITGEIST
ZeitgeistLog *
biji_note_book_get_zg_log (BijiNoteBook *book)
{
return book->priv->log;
}
+#endif /* BUILD_ZEITGEIST */
TrackerSparqlConnection *
@@ -426,7 +433,10 @@ biji_note_book_constructed (GObject *object)
return;
}
+
+#ifdef BUILD_ZEITGEIST
priv->log = biji_zeitgeist_init ();
+#endif /* BUILD_ZEITGEIST */
/* Ensure cache directory for icons */
filename = g_build_filename (g_get_user_cache_dir (),
diff --git a/src/libbiji/biji-note-book.h b/src/libbiji/biji-note-book.h
index f92a746..10a6b06 100644
--- a/src/libbiji/biji-note-book.h
+++ b/src/libbiji/biji-note-book.h
@@ -3,7 +3,10 @@
#include <glib-object.h>
#include <tracker-sparql.h>
+
+#if BUILD_ZEIGEIST
#include <zeitgeist.h>
+#endif /* BUILD_ZEIGEIST */
#include "biji-info-set.h"
#include "biji-note-obj.h"
@@ -70,7 +73,9 @@ void biji_note_book_add_goa_object (BijiNoteBook *book,
GList *biji_note_book_get_providers (BijiNoteBook *book);
+#if have_zeitgeist
ZeitgeistLog *biji_note_book_get_zg_log (BijiNoteBook *book);
+#endif /* have_zeitgeist */
TrackerSparqlConnection
*biji_note_book_get_tracker_connection (BijiNoteBook *book);
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index 8c53b17..e255c9d 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -21,7 +21,11 @@
#include "biji-note-obj.h"
#include "biji-timeout.h"
#include "biji-tracker.h"
+
+#ifdef BUILD_ZEITGEIST
#include "biji-zeitgeist.h"
+#endif /* BUILD_ZEITGEIST */
+
#include "editor/biji-webkit-editor.h"
@@ -89,7 +93,10 @@ on_save_timeout (BijiNoteObj *self)
BIJI_NOTE_OBJ_GET_CLASS (self)->save_note (self);
+
+#ifdef BUILD_ZEITGEIST
insert_zeitgeist (self, ZEITGEIST_ZG_MODIFY_EVENT);
+#endif /* BUILD_ZEITGEIST */
priv->needs_save = FALSE;
g_object_unref (self);
@@ -237,7 +244,9 @@ biji_note_obj_trash (BijiItem *item)
priv = note_to_kill->priv;
/* The event has to be logged before the note is actually deleted */
+#ifdef BUILD_ZEITGEIST
insert_zeitgeist (note_to_kill, ZEITGEIST_ZG_DELETE_EVENT);
+#endif /* BUILD_ZEITGEIST */
priv->needs_save = FALSE;
biji_timeout_cancel (priv->timeout);
@@ -841,7 +850,9 @@ _biji_note_obj_close (BijiNoteObj *note)
book = biji_item_get_book (BIJI_ITEM (note));
priv->editor = NULL;
+#ifdef BUILD_ZEITGEIST
insert_zeitgeist (note, ZEITGEIST_ZG_LEAVE_EVENT);
+#endif /* BUILD_ZEITGEIST */
/* Delete if note is totaly blank
* Actually we just need to remove it from book
@@ -858,7 +869,9 @@ biji_note_obj_open (BijiNoteObj *note)
g_signal_connect_swapped (note->priv->editor, "destroy",
G_CALLBACK (_biji_note_obj_close), note);
+#ifdef BUILD_ZEITGEIST
insert_zeitgeist (note, ZEITGEIST_ZG_ACCESS_EVENT);
+#endif /* BUILD_ZEITGEIST */
return GTK_WIDGET (note->priv->editor);
}
diff --git a/src/libbiji/biji-zeitgeist.c b/src/libbiji/biji-zeitgeist.c
index 542f851..9fd9e32 100644
--- a/src/libbiji/biji-zeitgeist.c
+++ b/src/libbiji/biji-zeitgeist.c
@@ -14,7 +14,8 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.*/
-#include "biji-zeitgeist.h"
+
+#ifdef BUILD_ZEITGEIST
#include <libbiji.h>
#include "biji-zeitgeist.h"
@@ -29,6 +30,7 @@ biji_zeitgeist_init (void)
ZeitgeistDataSourceRegistry *zg_dsr = NULL;
ZeitgeistLog *log;
+
log = zeitgeist_log_new ();
event = zeitgeist_event_new_full (
NULL, NULL, "application://bijiben.desktop", NULL, NULL);
@@ -168,3 +170,5 @@ insert_zeitgeist (BijiNoteObj *note,
if (g_strcmp0 (zg_interpretation, ZEITGEIST_ZG_MODIFY_EVENT) ==0)
check_insert_create_zeitgeist (note);
}
+
+#endif /* BUILD_ZEITGEIST */
diff --git a/src/libbiji/biji-zeitgeist.h b/src/libbiji/biji-zeitgeist.h
index c4bae88..e41525d 100644
--- a/src/libbiji/biji-zeitgeist.h
+++ b/src/libbiji/biji-zeitgeist.h
@@ -14,10 +14,15 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.*/
+
+
+
#ifndef _BIJI_ZEITGEIST_H
#define _BIJI_ZEITGEIST_H
-#include <zeitgeist.h>
+#ifdef BUILD_ZEITGEIST
+
+#include <zeitgeist-2.0/zeitgeist.h>
#include "biji-note-obj.h"
@@ -28,4 +33,8 @@ ZeitgeistLog *biji_zeitgeist_init (void);
void insert_zeitgeist (BijiNoteObj *note,
gchar *zg_interpretation);
+#endif /* BUILD_ZEITGEIST */
+
#endif /* _BIJI_ZEITGEIST_H */
+
+
diff --git a/src/libbiji/libbiji.h b/src/libbiji/libbiji.h
index 17590f8..78955bb 100644
--- a/src/libbiji/libbiji.h
+++ b/src/libbiji/libbiji.h
@@ -29,7 +29,11 @@
#include "biji-note-obj.h"
#include "biji-string.h"
#include "biji-tracker.h"
+
+#ifdef BUILD_ZEITGEIST
#include "biji-zeitgeist.h"
+#endif /* BUILD_ZEITGEIST */
+
#include "deserializer/biji-lazy-deserializer.h"
#include "editor/biji-webkit-editor.h"
#include "provider/biji-provider.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]