]> git.0d.be Git - empathy.git/commitdiff
Merge branch 'debugger'
authorJonny Lamb <jonny.lamb@collabora.co.uk>
Thu, 25 Jun 2009 17:52:48 +0000 (18:52 +0100)
committerJonny Lamb <jonny.lamb@collabora.co.uk>
Thu, 25 Jun 2009 17:52:48 +0000 (18:52 +0100)
1  2 
src/Makefile.am
src/empathy.c

diff --combined src/Makefile.am
index e2076d3fcf660b632e78d680634801c963a8daab,cd13bffb1ef5438cd3314f219a650f39c32a7e83..42485b7d1fed7105ee9f131effd608787523db09
@@@ -3,6 -3,7 +3,7 @@@ include $(top_srcdir)/tools/flymake.m
  
  AM_CPPFLAGS =                                         \
        -I$(top_srcdir)                                 \
+       -DG_LOG_DOMAIN=\"empathy\"                      \
        $(EMPATHY_CFLAGS)                               \
        $(LIBNOTIFY_CFLAGS)                             \
        $(LIBCHAMPLAIN_CFLAGS)                          \
@@@ -82,7 -83,7 +83,7 @@@ EXTRA_DIST =                  
        $(ui_DATA)
  
  if HAVE_LIBCHAMPLAIN
 -empathy_SOURCES +=                            \
 +empathy_handwritten_source +=                                 \
        empathy-map-view.c                      \
        empathy-map-view.h
  
diff --combined src/empathy.c
index 70d9b0a68388f583a57ec5478cb3154a63d72d4a,fc6b5118c6ca064df0c126621a7cb2440bfe334f..85124d1e9156056ed813130780a670dd6bd61552
@@@ -48,6 -48,7 +48,7 @@@
  #include <libempathy/empathy-call-factory.h>
  #include <libempathy/empathy-chatroom-manager.h>
  #include <libempathy/empathy-account-manager.h>
+ #include <libempathy/empathy-debugger.h>
  #include <libempathy/empathy-dispatcher.h>
  #include <libempathy/empathy-dispatch-operation.h>
  #include <libempathy/empathy-log-manager.h>
@@@ -285,13 -286,13 +286,13 @@@ create_salut_account (void
  
        account = mc_account_create (profile);
        mc_account_set_display_name (account, _("People nearby"));
 -      
 +
        nickname = e_contact_get (contact, E_CONTACT_NICKNAME);
        first_name = e_contact_get (contact, E_CONTACT_GIVEN_NAME);
        last_name = e_contact_get (contact, E_CONTACT_FAMILY_NAME);
        email = e_contact_get (contact, E_CONTACT_EMAIL_1);
        jid = e_contact_get (contact, E_CONTACT_IM_JABBER_HOME_1);
 -      
 +
        if (!tp_strdiff (nickname, "nickname")) {
                g_free (nickname);
                nickname = NULL;
@@@ -450,6 -451,31 +451,31 @@@ new_call_handler_cb (EmpathyCallFactor
        gtk_widget_show (GTK_WIDGET (window));
  }
  
+ #ifdef ENABLE_DEBUG
+ static void
+ default_log_handler (const gchar *log_domain,
+     GLogLevelFlags log_level,
+     const gchar *message,
+     gpointer user_data)
+ {
+       g_log_default_handler (log_domain, log_level, message, NULL);
+       /* G_LOG_DOMAIN = "empathy". No need to send empathy messages to the
+        * debugger as they already have in empathy_debug. */
+       if (log_level != G_LOG_LEVEL_DEBUG
+           || tp_strdiff (log_domain, G_LOG_DOMAIN)) {
+               EmpathyDebugger *dbg;
+               GTimeVal now;
+               dbg = empathy_debugger_get_singleton ();
+               g_get_current_time (&now);
+               empathy_debugger_add_message (dbg, &now, log_domain,
+                                             log_level, message);
+       }
+ }
+ #endif /* ENABLE_DEBUG */
  int
  main (int argc, char *argv[])
  {
        gtk_window_set_default_icon_name ("empathy");
        textdomain (GETTEXT_PACKAGE);
  
+ #ifdef ENABLE_DEBUG
+       /* Set up debugger */
+       g_log_set_default_handler (default_log_handler, NULL);
+ #endif
          /* Setting up the bacon connection */
        startup_timestamp = get_startup_timestamp ();
        connection = bacon_message_connection_new ("empathy");
                        (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0) {
                empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE);
        }
 -      
 +
        create_salut_account ();
  
        /* Setting up UI */