]> git.0d.be Git - empathy.git/commitdiff
Don't require telepathy-logger with --enable-call
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 9 Jun 2011 15:50:34 +0000 (16:50 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Fri, 10 Jun 2011 08:30:05 +0000 (09:30 +0100)
Having it is required for displaying call events in the
history window though.

configure.ac
libempathy-gtk/empathy-log-window.c
libempathy/empathy-message.c

index 434cadb7e3927d1944676cb7aa541a3937e7fe2f..b192e5f6b48fb9967db117c61edfa9992bf350d9 100644 (file)
@@ -214,16 +214,33 @@ AM_CONDITIONAL(HAVE_CALL, test "x$have_farstream" = "xyes")
 # -----------------------------------------------------------
 # Call support in tp-logger
 # -----------------------------------------------------------
-SAVE_CFLAGS=$CFLAGS
-SAVE_CPPFLAGS=$CPPFLAGS
-CFLAGS="$CFLAGS $EMPATHY_CFLAGS"
-CPPFLAGS="$CPPFLAGS $EMPATHY_CFLAGS"
-
-AC_CHECK_HEADER(telepathy-logger/call-event.h,,
-  AC_MSG_ERROR([tp-logger must be compiled with --enable-call]))
+AC_ARG_WITH(call-logs,
+            AC_HELP_STRING([--enable-call-logs=@<:@no/yes/auto@:>@],
+            [build with call logs support]),,
+            [with_call_logs=auto])
+if test "x$with_call_logs" != "xno" ; then
+   SAVE_CFLAGS=$CFLAGS
+   SAVE_CPPFLAGS=$CPPFLAGS
+   CFLAGS="$CFLAGS $EMPATHY_CFLAGS"
+   CPPFLAGS="$CPPFLAGS $EMPATHY_CFLAGS"
+
+   AC_CHECK_HEADER(telepathy-logger/call-event.h,
+      have_call_logs="yes", have_call_logs="no")
+
+   CFLAGS=$SAVE_CFLAGS
+   CPPFLAGS=$SAVE_CPPFLAGS
+
+   if test "x$have_call_logs" = "xyes"; then
+      AC_DEFINE(HAVE_CALL_LOGS, 1, [Define if you have call log support])
+   fi
+else
+  have_call_logs=no
+fi
 
-CFLAGS=$SAVE_CFLAGS
-CPPFLAGS=$SAVE_CPPFLAGS
+if test "x$with_call_logs" = "xyes" -a "x$have_call_logs" != "xyes"; then
+   AC_MSG_ERROR([Call logs support requested but telepathy-logger wasn't
+                 built with --enable-call])
+fi
 
 # -----------------------------------------------------------
 # evolution-data-server (about-me)
@@ -607,7 +624,7 @@ Configure summary:
        Spell checking (enchant)....:  ${have_enchant}
        Display maps (libchamplain).:  ${have_libchamplain}
        Location awareness (Geoclue):  ${have_geoclue}
-       Geocode support (Geoclue):     ${have_geocode}
+       Geocode support (Geoclue)...:  ${have_geocode}
        Adium themes (Webkit).......:  ${have_webkit}
        Meego widgets...............:  ${have_meego}
        Control center embedding....:  ${have_control_center_embedding}
@@ -621,4 +638,5 @@ Configure summary:
        Nautilus-sendto plugin......:  ${have_nst}
        Salut E-D-S support.........:  ${with_eds}
        Exp. Call channel handler...:  ${have_farstream}
+       Exp. Call log support.......:  ${have_call_logs}
 "
index 11cb4ab97f8d3bcf7f00e2ae1245401935fce39c..435c997609ba17c4f4d29fef9603ea3253d0baa7 100644 (file)
@@ -34,7 +34,9 @@
 #include <telepathy-glib/proxy-subclass.h>
 
 #include <telepathy-logger/telepathy-logger.h>
-#include <telepathy-logger/call-event.h>
+#ifdef HAVE_CALL_LOGS
+# include <telepathy-logger/call-event.h>
+#endif
 
 #include <extensions/extensions.h>
 
@@ -766,6 +768,7 @@ get_icon_for_event (TplEvent *event)
 {
   const gchar *icon = NULL;
 
+#ifdef HAVE_CALL_LOGS
   if (TPL_IS_CALL_EVENT (event))
     {
       TplCallEvent *call = TPL_CALL_EVENT (event);
@@ -780,6 +783,7 @@ get_icon_for_event (TplEvent *event)
       else if (tpl_entity_get_entity_type (receiver) == TPL_ENTITY_SELF)
         icon = EMPATHY_IMAGE_CALL_INCOMING;
     }
+#endif
 
   return icon;
 }
@@ -833,6 +837,7 @@ log_window_append_chat_message (TplEvent *event,
   g_date_time_unref (date);
 }
 
+#ifdef HAVE_CALL_LOGS
 static void
 log_window_append_call (TplEvent *event,
     EmpathyMessage *message)
@@ -897,6 +902,7 @@ log_window_append_call (TplEvent *event,
   g_free (pretty_date);
   g_date_time_unref (started_date);
 }
+#endif
 
 static void
 log_window_append_message (TplEvent *event,
@@ -904,8 +910,10 @@ log_window_append_message (TplEvent *event,
 {
   if (TPL_IS_TEXT_EVENT (event))
     log_window_append_chat_message (event, message);
+#ifdef HAVE_CALL_LOGS
   else if (TPL_IS_CALL_EVENT (event))
     log_window_append_call (event, message);
+#endif
   else
     DEBUG ("Message type not handled");
 }
@@ -2253,7 +2261,7 @@ log_window_what_setup (EmpathyLogWindow *window)
   GtkTreeModel      *model;
   GtkTreeSelection  *selection;
   GtkTreeViewColumn *column;
-  GtkTreeIter        iter, parent;
+  GtkTreeIter        iter;
   GtkTreeStore      *store;
   GtkCellRenderer   *cell;
   guint i;
@@ -2261,13 +2269,18 @@ log_window_what_setup (EmpathyLogWindow *window)
     { TPL_EVENT_MASK_ANY, 0, NULL, _("Anything") },
     { WHAT_TYPE_SEPARATOR, 0, NULL, "separator" },
     { TPL_EVENT_MASK_TEXT, 0, "stock_text_justify", _("Text chats") },
-    { TPL_EVENT_MASK_CALL, EVENT_CALL_ALL, "call-start", _("Calls") }
+#ifdef HAVE_CALL_LOGS
+    { TPL_EVENT_MASK_CALL, EVENT_CALL_ALL, "call-start", _("Calls") },
+#endif
   };
+#ifdef HAVE_CALL_LOGS
   struct event call_events [] = {
     { TPL_EVENT_MASK_CALL, EVENT_CALL_INCOMING, "call-start", _("Incoming calls") },
     { TPL_EVENT_MASK_CALL, EVENT_CALL_OUTGOING, "call-start", _("Outgoing calls") },
     { TPL_EVENT_MASK_CALL, EVENT_CALL_MISSED, "call-stop", _("Missed calls") }
   };
+  GtkTreeIter parent;
+#endif
 
   view = GTK_TREE_VIEW (window->treeview_what);
   selection = gtk_tree_view_get_selection (view);
@@ -2321,6 +2334,7 @@ log_window_what_setup (EmpathyLogWindow *window)
           -1);
     }
 
+#ifdef HAVE_CALL_LOGS
   gtk_tree_model_iter_nth_child (model, &parent, NULL, 3);
   for (i = 0; i < G_N_ELEMENTS (call_events); i++)
     {
@@ -2332,6 +2346,7 @@ log_window_what_setup (EmpathyLogWindow *window)
           COL_WHAT_ICON, call_events[i].icon,
           -1);
     }
+#endif
 
   gtk_tree_view_expand_all (view);
 
@@ -2423,6 +2438,7 @@ log_window_got_messages_for_date_cb (GObject *manager,
       TplEvent *event = l->data;
       gboolean append = TRUE;
 
+#ifdef HAVE_CALL_LOGS
       if (TPL_IS_CALL_EVENT (l->data)
           && ctx->event_mask & TPL_EVENT_MASK_CALL
           && ctx->event_mask != TPL_EVENT_MASK_ANY)
@@ -2458,6 +2474,7 @@ log_window_got_messages_for_date_cb (GObject *manager,
                 }
             }
         }
+#endif
 
       if (append)
         {
index d97539ffde861c57098a1e4d4b8d7999e78c3b10..d30ce3645e3c298c0767228c522c5cee5d3778f0 100644 (file)
@@ -35,7 +35,9 @@
 #include <telepathy-logger/entity.h>
 #include <telepathy-logger/event.h>
 #include <telepathy-logger/text-event.h>
-#include <telepathy-logger/call-event.h>
+#ifdef HAVE_CALL_LOGS
+# include <telepathy-logger/call-event.h>
+#endif
 
 #include "empathy-message.h"
 #include "empathy-utils.h"
@@ -332,7 +334,9 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
                        TPL_TEXT_EVENT (logevent)));
 
                type = tpl_text_event_get_message_type (TPL_TEXT_EVENT (logevent));
-       } else if (TPL_IS_CALL_EVENT (logevent)) {
+       }
+#ifdef HAVE_CALL_LOGS
+       else if (TPL_IS_CALL_EVENT (logevent)) {
                TplCallEvent *call = TPL_CALL_EVENT (logevent);
                if (tpl_call_event_get_end_reason (call) == TPL_CALL_END_REASON_NO_ANSWER)
                        body = g_strdup_printf (_("Missed call from %s"),
@@ -343,7 +347,9 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
                else
                        body = g_strdup_printf (_("Call from %s"),
                                tpl_entity_get_alias (tpl_event_get_sender (logevent)));
-       } else {
+       }
+#endif
+       else {
                /* Unknown event type */
                return NULL;
        }