]> git.0d.be Git - empathy.git/commitdiff
Make use of tp-glib debug system.
authorXavier Claessens <xclaesse@src.gnome.org>
Wed, 30 Apr 2008 21:44:38 +0000 (21:44 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Wed, 30 Apr 2008 21:44:38 +0000 (21:44 +0000)
svn path=/trunk/; revision=1066

58 files changed:
configure.ac
libempathy-gtk/empathy-account-widget-irc.c
libempathy-gtk/empathy-account-widget-sip.c
libempathy-gtk/empathy-account-widget.c
libempathy-gtk/empathy-accounts-dialog.c
libempathy-gtk/empathy-avatar-chooser.c
libempathy-gtk/empathy-avatar-image.c
libempathy-gtk/empathy-cell-renderer-activatable.c
libempathy-gtk/empathy-chat-view.c
libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-conf.c
libempathy-gtk/empathy-contact-list-store.c
libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-geometry.c
libempathy-gtk/empathy-irc-network-dialog.c
libempathy-gtk/empathy-log-window.c
libempathy-gtk/empathy-new-message-dialog.c
libempathy-gtk/empathy-presence-chooser.c
libempathy-gtk/empathy-smiley-manager.c
libempathy-gtk/empathy-spell.c
libempathy-gtk/empathy-spell.h
libempathy-gtk/empathy-theme-boxes.c
libempathy-gtk/empathy-theme-irc.c
libempathy-gtk/empathy-theme.c
libempathy-gtk/empathy-ui-utils.c
libempathy/empathy-avatar.c
libempathy/empathy-chatroom-manager.c
libempathy/empathy-contact-groups.c
libempathy/empathy-contact-manager.c
libempathy/empathy-contact.c
libempathy/empathy-debug.c
libempathy/empathy-debug.h
libempathy/empathy-idle.c
libempathy/empathy-irc-network-manager.c
libempathy/empathy-log-manager.c
libempathy/empathy-status-presets.c
libempathy/empathy-tp-call.c
libempathy/empathy-tp-chat.c
libempathy/empathy-tp-contact-factory.c
libempathy/empathy-tp-contact-list.c
libempathy/empathy-tp-group.c
libempathy/empathy-tp-roomlist.c
libempathy/empathy-tp-tube.c
libempathy/empathy-tube-handler.c
libempathy/empathy-utils.c
megaphone/src/megaphone-applet.c
python/pyempathy/pyempathy.defs
python/pyempathygtk/pyempathygtk.defs
src/empathy-accounts.c
src/empathy-call-window.c
src/empathy-chat-window.c
src/empathy-filter.c
src/empathy-logs.c
src/empathy-main-window.c
src/empathy-new-chatroom-dialog.c
src/empathy-status-icon.c
src/empathy.c

index 1569deaad512f1f11a86bffe283ad7f7e17dc344..d460a4771cb9717aa970beea0b545d31b7919c81 100644 (file)
@@ -103,6 +103,18 @@ PKG_CHECK_MODULES(EMPATHY,
    libebook-1.2
 ])
 
+# -----------------------------------------------------------
+# Enable debug
+# -----------------------------------------------------------
+
+AC_ARG_ENABLE(debug,
+  AC_HELP_STRING([--disable-debug],[compile without debug code]),
+    enable_debug=$enableval, enable_debug=yes )
+
+if test x$enable_debug = xyes; then
+  AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code])
+fi
+
 # -----------------------------------------------------------
 # Language Support
 # -----------------------------------------------------------
index 64325f97091bcb38afd537337c899ba1ca5c05c7..242085ccc6b0615f7b66d22217acf467d9614b02 100644 (file)
@@ -32,7 +32,6 @@
 #include <libmissioncontrol/mc-protocol.h>
 
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-irc-network-manager.h>
 
 #include "empathy-irc-network-dialog.h"
@@ -40,7 +39,8 @@
 #include "empathy-account-widget-irc.h"
 #include "empathy-ui-utils.h"
 
-#define DEBUG_DOMAIN "AccountWidgetIRC"
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
+#include <libempathy/empathy-debug.h>
 
 #define IRC_NETWORKS_FILENAME "irc-networks.xml"
 
@@ -73,7 +73,7 @@ account_widget_irc_destroy_cb (GtkWidget *widget,
 static void
 unset_server_params (EmpathyAccountWidgetIrc *settings)
 {
-  empathy_debug (DEBUG_DOMAIN, "Unset server, port and use-ssl");
+  DEBUG ("Unset server, port and use-ssl");
   mc_account_unset_param (settings->account, "server");
   mc_account_unset_param (settings->account, "port");
   mc_account_unset_param (settings->account, "use-ssl");
@@ -101,7 +101,7 @@ update_server_params (EmpathyAccountWidgetIrc *settings)
   g_assert (network != NULL);
 
   g_object_get (network, "charset", &charset, NULL);
-  empathy_debug (DEBUG_DOMAIN, "Setting charset to %s", charset);
+  DEBUG ("Setting charset to %s", charset);
   mc_account_set_param_string (settings->account, "charset", charset);
   g_free (charset);
 
@@ -120,12 +120,11 @@ update_server_params (EmpathyAccountWidgetIrc *settings)
           "ssl", &ssl,
           NULL);
 
-      empathy_debug (DEBUG_DOMAIN, "Setting server to %s", address);
+      DEBUG ("Setting server to %s", address);
       mc_account_set_param_string (settings->account, "server", address);
-      empathy_debug (DEBUG_DOMAIN, "Setting port to %u", port);
+      DEBUG ("Setting port to %u", port);
       mc_account_set_param_int (settings->account, "port", port);
-      empathy_debug (DEBUG_DOMAIN, "Setting use-ssl to %s",
-          ssl ? "TRUE": "FALSE" );
+      DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" );
       mc_account_set_param_boolean (settings->account, "use-ssl", ssl);
 
       g_free (address);
@@ -217,7 +216,7 @@ account_widget_irc_button_remove_clicked_cb (GtkWidget *button,
   g_assert (network != NULL);
 
   g_object_get (network, "name", &name, NULL);
-  empathy_debug (DEBUG_DOMAIN, "Remove network %s", name);
+  DEBUG ("Remove network %s", name);
 
   gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
   empathy_irc_network_manager_remove (settings->network_manager, network);
@@ -378,7 +377,7 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings)
           g_object_set (network, "charset", charset, NULL);
 
           g_object_get (network, "name", &name, NULL);
-          empathy_debug (DEBUG_DOMAIN, "Account use network %s", name);
+          DEBUG ("Account use network %s", name);
 
           g_free (name);
         }
@@ -388,7 +387,7 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings)
           EmpathyIrcServer *srv;
           GtkTreeIter iter;
 
-          empathy_debug (DEBUG_DOMAIN, "Create a network %s", server);
+          DEBUG ("Create a network %s", server);
           network = empathy_irc_network_new (server);
           srv = empathy_irc_server_new (server, port, ssl);
 
index d07abc0c0aea68d09c36ba7d27645705b7834671..28832e0d7ef6dd294235ef1f2bceca1cb8507059 100644 (file)
 #include <libmissioncontrol/mc-protocol.h>
 
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 
 #include "empathy-account-widget.h"
 #include "empathy-account-widget-sip.h"
 #include "empathy-ui-utils.h"
 
-#define DEBUG_DOMAIN "AccountWidgetSIP"
-
 typedef struct {
   McAccount *account;
 
index f0668ee970f5d2ceadc04b245d80392a18871a6b..5116841c1e9bc2581b7b792e3d39dbfbc78ede18 100644 (file)
 #include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mc-protocol.h>
 
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-account-widget.h"
 #include "empathy-ui-utils.h"
 
-#define DEBUG_DOMAIN "AccountWidget"
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
 
 static gboolean 
 account_widget_entry_focus_cb (GtkWidget     *widget,
@@ -56,12 +56,12 @@ account_widget_entry_focus_cb (GtkWidget     *widget,
 
                mc_account_unset_param (account, param_name);
                mc_account_get_param_string (account, param_name, &value);
-               empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %s", param_name, value);
+               DEBUG ("Unset %s and restore to %s", param_name, value);
                gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
                g_free (value);
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Setting %s to %s", param_name,
-                              strstr (param_name, "password") ? "***" : str);
+               DEBUG ("Setting %s to %s", param_name,
+                       strstr (param_name, "password") ? "***" : str);
                mc_account_set_param_string (account, param_name, str);
        }
 
@@ -81,10 +81,10 @@ account_widget_int_changed_cb (GtkWidget *widget,
        if (value == 0) {
                mc_account_unset_param (account, param_name);
                mc_account_get_param_int (account, param_name, &value);
-               empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %d", param_name, value);
+               DEBUG ("Unset %s and restore to %d", param_name, value);
                gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param_name, value);
+               DEBUG ("Setting %s to %d", param_name, value);
                mc_account_set_param_int (account, param_name, value);
        }
 }
@@ -107,9 +107,9 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget,
        mc_account_get_param_boolean (account, param_name, &default_value);
 
        if (default_value == value) {
-               empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %d", param_name, default_value);
+               DEBUG ("Unset %s and restore to %d", param_name, default_value);
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param_name, value);
+               DEBUG ("Setting %s to %d", param_name, value);
                mc_account_set_param_boolean (account, param_name, value);
        }
 }
@@ -124,7 +124,7 @@ account_widget_forget_clicked_cb (GtkWidget *button,
        param_name = g_object_get_data (G_OBJECT (entry), "param_name");
        account = g_object_get_data (G_OBJECT (entry), "account");
 
-       empathy_debug (DEBUG_DOMAIN, "Unset %s", param_name);
+       DEBUG ("Unset %s", param_name);
        mc_account_unset_param (account, param_name);
        gtk_entry_set_text (GTK_ENTRY (entry), "");
 }
@@ -209,9 +209,7 @@ account_widget_setup_widget (GtkWidget   *widget,
                                  G_CALLBACK (account_widget_checkbutton_toggled_cb),
                                  account);
        } else {
-               empathy_debug (DEBUG_DOMAIN,
-                              "Unknown type of widget for param %s",
-                              param_name);
+               DEBUG ("Unknown type of widget for param %s", param_name);
        }
 }
 
@@ -357,9 +355,8 @@ accounts_widget_generic_setup (McAccount *account,
                                          GTK_FILL | GTK_EXPAND, 0,
                                          0, 0);
                } else {
-                       empathy_debug (DEBUG_DOMAIN,
-                                      "Unknown signature for param %s: %s",
-                                      param_name_formatted, param->signature);
+                       DEBUG ("Unknown signature for param %s: %s",
+                               param_name_formatted, param->signature);
                }
 
                if (widget) {
index b57766521ca7dfc88d0dbf9fe94ba91ee1681d1e..e48aaab31a32a98de60923a15e0df47a0d4a5bd2 100644 (file)
@@ -38,7 +38,6 @@
 #include <libmissioncontrol/mc-account-monitor.h>
 #include <telepathy-glib/util.h>
 
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 
@@ -48,7 +47,8 @@
 #include "empathy-account-widget-irc.h"
 #include "empathy-account-widget-sip.h"
 
-#define DEBUG_DOMAIN "AccountDialog"
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
 
 /* Flashing delay for icons (milliseconds). */
 #define FLASH_TIMEOUT 500
@@ -402,9 +402,8 @@ accounts_dialog_enable_toggled_cb (GtkCellRendererToggle *cell_renderer,
        enabled = mc_account_is_enabled (account);
        mc_account_set_enabled (account, !enabled);
 
-       empathy_debug (DEBUG_DOMAIN, "%s account %s",
-                      enabled ? "Disabled" : "Enable",
-                      mc_account_get_display_name(account));
+       DEBUG ("%s account %s", enabled ? "Disabled" : "Enable",
+               mc_account_get_display_name(account));
 
        g_object_unref (account);
 }
@@ -663,7 +662,7 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
 
        g_return_if_fail (name != NULL);
 
-       empathy_debug (DEBUG_DOMAIN, "Adding new account: %s", name);
+       DEBUG ("Adding new account: %s", name);
 
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
        gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter,
@@ -747,9 +746,8 @@ accounts_dialog_status_changed_cb (MissionControl           *mc,
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
        account = mc_account_lookup (unique_name);
 
-       empathy_debug (DEBUG_DOMAIN, "Status changed for account %s: "
-                     "status=%d presence=%d",
-                     unique_name, status, presence);
+       DEBUG ("Status changed for account %s: status=%d presence=%d",
+               unique_name, status, presence);
 
        if (accounts_dialog_get_account_iter (dialog, account, &iter)) {
                GtkTreePath *path;
@@ -808,9 +806,9 @@ accounts_dialog_account_enabled_cb (McAccountMonitor      *monitor,
        account = mc_account_lookup (unique_name);
        enabled = mc_account_is_enabled (account);
 
-       empathy_debug (DEBUG_DOMAIN, "Account %s is now %s",
-                      mc_account_get_display_name (account),
-                      enabled ? "enabled" : "disabled");
+       DEBUG ("Account %s is now %s",
+               mc_account_get_display_name (account),
+               enabled ? "enabled" : "disabled");
 
        if (accounts_dialog_get_account_iter (dialog, account, &iter)) {
                gtk_list_store_set (GTK_LIST_STORE (model), &iter,
index 99132b8a1739abae0ad5427fc68f53ad14cda950..c6021b73f9fa38d5dc93c88c51ad747f69140546 100644 (file)
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-avatar-chooser.h"
 #include "empathy-conf.h"
 #include "empathy-ui-utils.h"
 
-#define DEBUG_DOMAIN "AvatarChooser"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_AVATAR_CHOOSER, EmpathyAvatarChooserPriv))
 
@@ -187,8 +186,8 @@ avatar_chooser_set_pixbuf (EmpathyAvatarChooser *chooser,
                                                &priv->image_data_size,
                                                "png",
                                                &error, NULL)) {
-                       empathy_debug (DEBUG_DOMAIN, "Failed to save pixbuf: %s",
-                                      error ? error->message : "No error given");
+                       DEBUG ("Failed to save pixbuf: %s",
+                               error ? error->message : "No error given");
                        g_clear_error (&error);
                }
                image = gtk_image_new_from_pixbuf (pixbuf_view);
@@ -212,8 +211,8 @@ avatar_chooser_set_image_from_file (EmpathyAvatarChooser *chooser,
        GError    *error = NULL;
 
        if (!(pixbuf = gdk_pixbuf_new_from_file (filename, &error))) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to load pixbuf from file: %s",
-                              error ? error->message : "No error given");
+               DEBUG ("Failed to load pixbuf from file: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
        }
 
index 2aeeba458ea9fab9264ca263a4455420b1d0b736..17ab190914cd4e99f473b70c1aa845463831f49a 100644 (file)
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-avatar-image.h"
 #include "empathy-ui-utils.h"
 
-#define DEBUG_DOMAIN "AvatarImage"
-
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_AVATAR_IMAGE, EmpathyAvatarImagePriv))
 
 #define MAX_SMALL 64
index 6cdce0d2831d13ccb70483657776b40f9c5a7d37..fc218e88bac5a5978434cd61bdb2d2379e75a7e9 100644 (file)
 
 #include <gtk/gtktreeview.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-cell-renderer-activatable.h"
 
-#define DEBUG_DOMAIN "CellRendererActivatable"
-
 static void     empathy_cell_renderer_activatable_init       (EmpathyCellRendererActivatable      *cell);
 static void     empathy_cell_renderer_activatable_class_init (EmpathyCellRendererActivatableClass *klass);
 static gboolean cell_renderer_activatable_activate           (GtkCellRenderer                     *cell,
index f84ae9e16cf304b9bc6eec152ca9bce619ac4456..491de226949c2052c18a3b95dbb14422844a888d 100644 (file)
@@ -43,7 +43,6 @@
 #include <libmissioncontrol/mc-account.h>
 
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 
 #include "empathy-chat-view.h"
 #include "empathy-chat.h"
@@ -52,7 +51,8 @@
 #include "empathy-ui-utils.h"
 #include "empathy-smiley-manager.h"
 
-#define DEBUG_DOMAIN "ChatView"
+#define DEBUG_FLAG EMPATHY_DEBUG_CHAT
+#include <libempathy/empathy-debug.h>
 
 /* Number of seconds between timestamps when using normal mode, 5 minutes. */
 #define TIMESTAMP_INTERVAL 300
@@ -208,7 +208,7 @@ chat_view_finalize (GObject *object)
        view = EMPATHY_CHAT_VIEW (object);
        priv = GET_PRIV (view);
 
-       empathy_debug (DEBUG_DOMAIN, "finalize: %p", object);
+       DEBUG ("finalize: %p", object);
 
        empathy_conf_notify_remove (empathy_conf_get (), priv->notify_system_fonts_id);
        empathy_conf_notify_remove (empathy_conf_get (), priv->notify_show_avatars_id);
@@ -780,7 +780,7 @@ empathy_chat_view_scroll_down (EmpathyChatView *view)
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Scrolling down");
+       DEBUG ("Scrolling down");
 
        if (priv->scroll_time) {
                g_timer_reset (priv->scroll_time);
@@ -933,8 +933,7 @@ empathy_chat_view_scroll (EmpathyChatView *view,
 
        g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
 
-       empathy_debug (DEBUG_DOMAIN, "Scrolling %s",
-                     allow_scrolling ? "enabled" : "disabled");
+       DEBUG ("Scrolling %s", allow_scrolling ? "enabled" : "disabled");
 
        priv->allow_scrolling = allow_scrolling;
        if (allow_scrolling) {
index 4a7de774c0f59f95ab1684340e2d5b21c3d4d4ec..1b2ed9d436b0809f31a2769e6ffdd74ac5229d19 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <libempathy/empathy-log-manager.h>
 #include <libempathy/empathy-contact-list.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-chat.h"
 #include "empathy-contact-menu.h"
 #include "empathy-ui-utils.h"
 
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT, EmpathyChatPriv))
+#define DEBUG_FLAG EMPATHY_DEBUG_CHAT
+#include <libempathy/empathy-debug.h>
 
-#define DEBUG_DOMAIN "Chat"
+#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT, EmpathyChatPriv))
 
 #define CHAT_DIR_CREATE_MODE  (S_IRUSR | S_IWUSR | S_IXUSR)
 #define CHAT_FILE_CREATE_MODE (S_IRUSR | S_IWUSR)
@@ -184,8 +184,7 @@ chat_status_changed_cb (MissionControl           *mc,
        if (status == TP_CONNECTION_STATUS_CONNECTED && !priv->tp_chat &&
            empathy_account_equal (account, priv->account) &&
            priv->handle_type != TP_HANDLE_TYPE_NONE) {
-               empathy_debug (DEBUG_DOMAIN,
-                              "Account reconnected, request a new Text channel");
+               DEBUG ("Account reconnected, request a new Text channel");
                mission_control_request_channel_with_string_handle (mc,
                                                                    priv->account,
                                                                    TP_IFACE_CHANNEL_TYPE_TEXT,
@@ -304,8 +303,7 @@ chat_sent_message_get_next (EmpathyChat *chat)
        priv = GET_PRIV (chat);
 
        if (!priv->sent_messages) {
-               empathy_debug (DEBUG_DOMAIN, 
-                             "No sent messages, next message is NULL");
+               DEBUG ("No sent messages, next message is NULL");
                return NULL;
        }
 
@@ -315,9 +313,7 @@ chat_sent_message_get_next (EmpathyChat *chat)
                priv->sent_messages_index++;
        }
        
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Returning next message index:%d",
-                     priv->sent_messages_index);
+       DEBUG ("Returning next message index:%d", priv->sent_messages_index);
 
        return g_slist_nth_data (priv->sent_messages, priv->sent_messages_index);
 }
@@ -332,8 +328,7 @@ chat_sent_message_get_last (EmpathyChat *chat)
        priv = GET_PRIV (chat);
        
        if (!priv->sent_messages) {
-               empathy_debug (DEBUG_DOMAIN, 
-                             "No sent messages, last message is NULL");
+               DEBUG ("No sent messages, last message is NULL");
                return NULL;
        }
 
@@ -341,9 +336,7 @@ chat_sent_message_get_last (EmpathyChat *chat)
                priv->sent_messages_index--;
        }
 
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Returning last message index:%d",
-                     priv->sent_messages_index);
+       DEBUG ("Returning last message index:%d", priv->sent_messages_index);
 
        return g_slist_nth_data (priv->sent_messages, priv->sent_messages_index);
 }
@@ -446,9 +439,9 @@ chat_state_changed_cb (EmpathyTpChat      *tp_chat,
                g_assert_not_reached ();
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Was composing: %s now composing: %s",
-                     was_composing ? "yes" : "no",
-                     priv->compositors ? "yes" : "no");
+       DEBUG ("Was composing: %s now composing: %s",
+               was_composing ? "yes" : "no",
+               priv->compositors ? "yes" : "no");
 
        if ((was_composing && !priv->compositors) ||
            (!was_composing && priv->compositors)) {
@@ -488,18 +481,17 @@ chat_message_received_cb (EmpathyTpChat  *tp_chat,
                        /* The message we received is already displayed because
                         * some jabber chatrooms sends us back logs and we
                         * already displayed it from localy logged messages. */
-                       empathy_debug (DEBUG_DOMAIN, "Skipping message because "
-                                      "it is already displayed from logged "
-                                      "messages");
+                       DEBUG ("Skipping message because it is already "
+                               "displayed from logged messages");
                        g_object_unref (log_message);
                        return;
                }
                g_object_unref (log_message);
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Appending new message from %s (%d)",
-                      empathy_contact_get_name (sender),
-                      empathy_contact_get_handle (sender));
+       DEBUG ("Appending new message from %s (%d)",
+               empathy_contact_get_name (sender),
+               empathy_contact_get_handle (sender));
 
        if (priv->id) {
                gboolean is_chatroom;
@@ -898,7 +890,7 @@ static void
 chat_input_realize_cb (GtkWidget   *widget,
                       EmpathyChat *chat)
 {
-       empathy_debug (DEBUG_DOMAIN, "Setting focus to the input text view");
+       DEBUG ("Setting focus to the input text view");
        gtk_widget_grab_focus (widget);
 }
 
@@ -1399,7 +1391,7 @@ chat_finalize (GObject *object)
        chat = EMPATHY_CHAT (object);
        priv = GET_PRIV (chat);
 
-       empathy_debug (DEBUG_DOMAIN, "Finalized: %p", object);
+       DEBUG ("Finalized: %p", object);
 
        g_slist_foreach (priv->sent_messages, (GFunc) g_free, NULL);
        g_slist_free (priv->sent_messages);
index 1ec3feeb4354e67255b7330b96e226acac8fd2b2..0ecb8e166e9e1a8a424f3914b04f2c43a4afdced 100644 (file)
 
 #include <gconf/gconf-client.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-conf.h"
 
-#define DEBUG_DOMAIN "Config"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 #define EMPATHY_CONF_ROOT       "/apps/empathy"
 #define DESKTOP_INTERFACE_ROOT  "/desktop/gnome/interface"
@@ -131,7 +130,7 @@ empathy_conf_set_int (EmpathyConf  *conf,
 
        g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
 
-       empathy_debug (DEBUG_DOMAIN, "Setting int:'%s' to %d", key, value);
+       DEBUG ("Setting int:'%s' to %d", key, value);
 
        priv = GET_PRIV (conf);
 
@@ -177,8 +176,8 @@ empathy_conf_set_bool (EmpathyConf  *conf,
 
        g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
 
-       empathy_debug (DEBUG_DOMAIN, "Setting bool:'%s' to %d ---> %s",
-                     key, value, value ? "true" : "false");
+       DEBUG ("Setting bool:'%s' to %d ---> %s", key, value,
+               value ? "true" : "false");
 
        priv = GET_PRIV (conf);
 
@@ -224,8 +223,7 @@ empathy_conf_set_string (EmpathyConf  *conf,
 
        g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
 
-       empathy_debug (DEBUG_DOMAIN, "Setting string:'%s' to '%s'",
-                     key, value);
+       DEBUG ("Setting string:'%s' to '%s'", key, value);
 
        priv = GET_PRIV (conf);
 
index fa96eb492ecc0dced8f65db84963af103e9ccf43..e18675295b3ec2db8287bd32b93578bd876853ae 100644 (file)
 #include <gtk/gtk.h>
 
 #include <telepathy-glib/util.h>
-#include <libempathy/empathy-debug.h>
 
 #include "empathy-contact-list-store.h"
 #include "empathy-ui-utils.h"
 #include "empathy-gtk-enum-types.h"
 
-#define DEBUG_DOMAIN "ContactListStore"
+#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
+#include <libempathy/empathy-debug.h>
 
 /* Active users are those which have recently changed state
  * (e.g. online, offline or from normal to a busy state).
@@ -786,11 +786,10 @@ contact_list_store_members_changed_cb (EmpathyContactList      *list_iface,
 
        priv = GET_PRIV (store);
 
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Contact %s (%d) %s",
-                     empathy_contact_get_id (contact),
-                     empathy_contact_get_handle (contact),
-                     is_member ? "added" : "removed");
+       DEBUG ("Contact %s (%d) %s",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               is_member ? "added" : "removed");
 
        if (is_member) {
                g_signal_connect (contact, "notify::presence",
@@ -831,9 +830,9 @@ contact_list_store_groups_changed_cb (EmpathyContactList      *list_iface,
 
        priv = GET_PRIV (store);
 
-       empathy_debug (DEBUG_DOMAIN, "Updating groups for contact %s (%d)",
-                     empathy_contact_get_id (contact),
-                     empathy_contact_get_handle (contact));
+       DEBUG ("Updating groups for contact %s (%d)",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact));
 
        /* We do this to make sure the groups are correct, if not, we
         * would have to check the groups already set up for each
@@ -978,18 +977,16 @@ contact_list_store_contact_update (EmpathyContactListStore *store,
 
        if (!in_list && !should_be_in_list) {
                /* Nothing to do. */
-               empathy_debug (DEBUG_DOMAIN,
-                             "Contact:'%s' in list:NO, should be:NO",
-                             empathy_contact_get_name (contact));
+               DEBUG ("Contact:'%s' in list:NO, should be:NO",
+                       empathy_contact_get_name (contact));
 
                g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
                g_list_free (iters);
                return;
        }
        else if (in_list && !should_be_in_list) {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Contact:'%s' in list:YES, should be:NO",
-                             empathy_contact_get_name (contact));
+               DEBUG ("Contact:'%s' in list:YES, should be:NO",
+                       empathy_contact_get_name (contact));
 
                if (priv->show_active) {
                        do_remove = TRUE;
@@ -997,28 +994,26 @@ contact_list_store_contact_update (EmpathyContactListStore *store,
                        do_set_refresh = TRUE;
 
                        set_model = TRUE;
-                       empathy_debug (DEBUG_DOMAIN, "Remove item (after timeout)");
+                       DEBUG ("Remove item (after timeout)");
                } else {
-                       empathy_debug (DEBUG_DOMAIN, "Remove item (now)!");
+                       DEBUG ("Remove item (now)!");
                        contact_list_store_remove_contact (store, contact);
                }
        }
        else if (!in_list && should_be_in_list) {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Contact:'%s' in list:NO, should be:YES",
-                             empathy_contact_get_name (contact));
+               DEBUG ("Contact:'%s' in list:NO, should be:YES",
+                       empathy_contact_get_name (contact));
 
                contact_list_store_add_contact (store, contact);
 
                if (priv->show_active) {
                        do_set_active = TRUE;
 
-                       empathy_debug (DEBUG_DOMAIN, "Set active (contact added)");
+                       DEBUG ("Set active (contact added)");
                }
        } else {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Contact:'%s' in list:YES, should be:YES",
-                             empathy_contact_get_name (contact));
+               DEBUG ("Contact:'%s' in list:YES, should be:YES",
+                       empathy_contact_get_name (contact));
 
                /* Get online state before. */
                if (iters && g_list_length (iters) > 0) {
@@ -1033,15 +1028,15 @@ contact_list_store_contact_update (EmpathyContactListStore *store,
                                do_set_active = TRUE;
                                do_set_refresh = TRUE;
 
-                               empathy_debug (DEBUG_DOMAIN, "Set active (contact updated %s)",
-                                             was_online ? "online  -> offline" :
-                                                          "offline -> online");
+                               DEBUG ("Set active (contact updated %s)",
+                                       was_online ? "online  -> offline" :
+                                       "offline -> online");
                        } else {
                                /* Was TRUE for presence updates. */
                                /* do_set_active = FALSE;  */
                                do_set_refresh = TRUE;
 
-                               empathy_debug (DEBUG_DOMAIN, "Set active (contact updated)");
+                               DEBUG ("Set active (contact updated)");
                        }
                }
 
@@ -1096,9 +1091,8 @@ contact_list_store_contact_updated_cb (EmpathyContact          *contact,
                                       GParamSpec              *param,
                                       EmpathyContactListStore *store)
 {
-       empathy_debug (DEBUG_DOMAIN,
-                     "Contact:'%s' updated, checking roster is in sync...",
-                     empathy_contact_get_name (contact));
+       DEBUG ("Contact:'%s' updated, checking roster is in sync...",
+               empathy_contact_get_name (contact));
 
        contact_list_store_contact_update (store, contact);
 }
@@ -1124,7 +1118,7 @@ contact_list_store_contact_set_active (EmpathyContactListStore *store,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE, active,
                                    -1);
 
-               empathy_debug (DEBUG_DOMAIN, "Set item %s", active ? "active" : "inactive");
+               DEBUG ("Set item %s", active ? "active" : "inactive");
 
                if (set_changed) {
                        path = gtk_tree_model_get_path (model, l->data);
@@ -1145,10 +1139,9 @@ contact_list_store_contact_active_new (EmpathyContactListStore *store,
 {
        ShowActiveData *data;
 
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Contact:'%s' now active, and %s be removed",
-                     empathy_contact_get_name (contact), 
-                     remove ? "WILL" : "WILL NOT");
+       DEBUG ("Contact:'%s' now active, and %s be removed",
+               empathy_contact_get_name (contact), 
+               remove ? "WILL" : "WILL NOT");
        
        data = g_slice_new0 (ShowActiveData);
 
@@ -1178,15 +1171,13 @@ contact_list_store_contact_active_cb (ShowActiveData *data)
        if (data->remove &&
            !priv->show_offline &&
            !empathy_contact_is_online (data->contact)) {
-               empathy_debug (DEBUG_DOMAIN, 
-                             "Contact:'%s' active timeout, removing item",
-                             empathy_contact_get_name (data->contact));
+               DEBUG ("Contact:'%s' active timeout, removing item",
+                       empathy_contact_get_name (data->contact));
                contact_list_store_remove_contact (data->store, data->contact);
        }
 
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Contact:'%s' no longer active",
-                     empathy_contact_get_name (data->contact));
+       DEBUG ("Contact:'%s' no longer active",
+               empathy_contact_get_name (data->contact));
 
        contact_list_store_contact_set_active (data->store,
                                               data->contact,
index c4dbbf6af5babf1d4407d132ec43eb6eca68a5e5..1a9890b79b14258899503a435e3d5788d4a9ae2c 100644 (file)
@@ -36,7 +36,6 @@
 #include <libempathy/empathy-contact-factory.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-contact-groups.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-contact-list-view.h"
@@ -49,7 +48,8 @@
 #include "empathy-gtk-enum-types.h"
 #include "empathy-gtk-marshal.h"
 
-#define DEBUG_DOMAIN "ContactListView"
+#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
+#include <libempathy/empathy-debug.h>
 
 /* Flashing delay for icons (milliseconds). */
 #define FLASH_TIMEOUT 500
@@ -141,10 +141,10 @@ contact_list_view_drag_data_received (GtkWidget         *widget,
        priv = GET_PRIV (widget);
 
        id = (const gchar*) selection->data;
-       empathy_debug (DEBUG_DOMAIN, "Received %s%s drag & drop contact from roster with id:'%s'",
-                     context->action == GDK_ACTION_MOVE ? "move" : "",
-                     context->action == GDK_ACTION_COPY ? "copy" : "",
-                     id);
+       DEBUG ("Received %s%s drag & drop contact from roster with id:'%s'",
+               context->action == GDK_ACTION_MOVE ? "move" : "",
+               context->action == GDK_ACTION_COPY ? "copy" : "",
+               id);
 
        strv = g_strsplit (id, "/", 2);
        factory = empathy_contact_factory_new ();
@@ -159,7 +159,7 @@ contact_list_view_drag_data_received (GtkWidget         *widget,
        g_strfreev (strv);
 
        if (!contact) {
-               empathy_debug (DEBUG_DOMAIN, "No contact found associated with drag & drop");
+               DEBUG ("No contact found associated with drag & drop");
                return;
        }
 
@@ -190,11 +190,10 @@ contact_list_view_drag_data_received (GtkWidget         *widget,
                gtk_tree_path_free (path);
        }
 
-       empathy_debug (DEBUG_DOMAIN,
-                     "contact %s (%d) dragged from '%s' to '%s'",
-                     empathy_contact_get_id (contact),
-                     empathy_contact_get_handle (contact),
-                     old_group, new_group);
+       DEBUG ("contact %s (%d) dragged from '%s' to '%s'",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               old_group, new_group);
 
        list = empathy_contact_list_store_get_list_iface (priv->store);
        if (new_group) {
index b06bcd3e4c9a2faf8460a33c57b24aa3de4d0842..275729f985c5f8ba11fee51bccaf548854c44626 100644 (file)
@@ -34,8 +34,6 @@
 #include "empathy-log-window.h"
 #include "empathy-contact-dialogs.h"
 
-#define DEBUG_DOMAIN "ContactMenu"
-
 GtkWidget *
 empathy_contact_menu_new (EmpathyContact             *contact,
                          EmpathyContactFeatureFlags  features)
index c8bbd2b21b1fd6d0c28d7edb2112104fc0830213..b3bd09ca149e0c4add646fcd8e0e5047fc577608 100644 (file)
 #include <glib.h>
 #include <gdk/gdk.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-geometry.h"
 
-#define DEBUG_DOMAIN "Geometry"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 #define GEOMETRY_DIR_CREATE_MODE  (S_IRUSR | S_IWUSR | S_IXUSR)
 #define GEOMETRY_FILE_CREATE_MODE (S_IRUSR | S_IWUSR)
@@ -52,7 +51,7 @@ geometry_get_filename (void)
 
        dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
        if (!g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
-               empathy_debug (DEBUG_DOMAIN, "Creating directory:'%s'", dir);
+               DEBUG ("Creating directory:'%s'", dir);
                g_mkdir_with_parents (dir, GEOMETRY_DIR_CREATE_MODE);
        }
 
@@ -79,8 +78,8 @@ empathy_geometry_save (const gchar *name,
        gsize        length;
        gchar       *str;
 
-       empathy_debug (DEBUG_DOMAIN, "Saving window geometry: x:%d, y:%d, w:%d, h:%d\n",
-                     x, y, w, h);
+       DEBUG ("Saving window geometry: x:%d, y:%d, w:%d, h:%d\n",
+               x, y, w, h);
 
        screen = gdk_screen_get_default ();
        max_width = gdk_screen_get_width (screen);
@@ -174,11 +173,8 @@ empathy_geometry_load (const gchar *name,
                g_free (str);
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Loading window geometry: x:%d, y:%d, w:%d, h:%d\n",
-                     x ? *x : -1,
-                     y ? *y : -1,
-                     w ? *w : -1,
-                     h ? *h : -1);
+       DEBUG ("Loading window geometry: x:%d, y:%d, w:%d, h:%d\n",
+               x ? *x : -1, y ? *y : -1, w ? *w : -1, h ? *h : -1);
 
        g_free (filename);
        g_key_file_free (key_file);
index 7f352f86df2cce11b78cd6969dd7c793a0b6b260..7c6e27d30964b2d1f4e79931cb685f1c4f12efca 100644 (file)
@@ -32,7 +32,6 @@
 #include <libmissioncontrol/mc-protocol.h>
 
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 
 #include <libempathy/empathy-irc-network-manager.h>
 #include "empathy-ui-utils.h"
@@ -40,8 +39,6 @@
 
 #include "empathy-irc-network-dialog.h"
 
-#define DEBUG_DOMAIN "AccountWidgetIRC"
-
 typedef struct {
   EmpathyIrcNetwork *network;
 
index 7441911cb9a8f18576f735179efdb54c7ef74c53..f1d958a307e7dd042dcf51e70453c5e9b351b896 100644 (file)
@@ -35,7 +35,6 @@
 #include <libempathy/empathy-chatroom-manager.h>
 #include <libempathy/empathy-chatroom.h>
 #include <libempathy/empathy-message.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-time.h>
 
@@ -44,7 +43,8 @@
 #include "empathy-chat-view.h"
 #include "empathy-ui-utils.h"
 
-#define DEBUG_DOMAIN "LogWindow"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 typedef struct {
        GtkWidget         *window;
@@ -895,7 +895,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
                        }
 
 
-                       empathy_debug (DEBUG_DOMAIN, "Marking date:'%s'", str);
+                       DEBUG ("Marking date:'%s'", str);
                        gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
 
                        if (l->next) {
@@ -986,7 +986,7 @@ log_window_calendar_chats_day_selected_cb (GtkWidget       *calendar,
 
        date = g_strdup_printf ("%4.4d%2.2d%2.2d", year, month, day);
 
-       empathy_debug (DEBUG_DOMAIN, "Currently selected date is:'%s'", date);
+       DEBUG ("Currently selected date is:'%s'", date);
 
        log_window_chats_get_messages (window, date);
 
@@ -1010,7 +1010,7 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
 
        if (!log_window_chats_get_selected (window, &account,
                                            &chat_id, &is_chatroom)) {
-               empathy_debug (DEBUG_DOMAIN, "No chat selected to get dates for...");
+               DEBUG ("No chat selected to get dates for...");
                return;
        }
 
@@ -1042,7 +1042,7 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
                sscanf (str, "%4d%2d%2d", &year, &month, &day);
 
                if (year == year_selected && month == month_selected) {
-                       empathy_debug (DEBUG_DOMAIN, "Marking date:'%s'", str);
+                       DEBUG ("Marking date:'%s'", str);
                        gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
                }
        }
@@ -1050,9 +1050,8 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
        g_list_foreach (dates, (GFunc) g_free, NULL);
        g_list_free (dates);
 
-       empathy_debug (DEBUG_DOMAIN,
-                     "Currently showing month %d and year %d",
-                     month_selected, year_selected);
+       DEBUG ("Currently showing month %d and year %d", month_selected,
+               year_selected);
 }
 
 static void
index 8a8d937c44ea3d2740978fd910cbaa677afca1de..b07f13e21f3208d7a969d695d58c27f900bb4ab7 100644 (file)
@@ -32,7 +32,6 @@
 #include <libmissioncontrol/mission-control.h>
 
 #include <libempathy/empathy-contact-factory.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-ui-utils.h>
@@ -40,8 +39,6 @@
 #include "empathy-new-message-dialog.h"
 #include "empathy-account-chooser.h"
 
-#define DEBUG_DOMAIN "NewMessageDialog"
-
 typedef struct {
        GtkWidget *dialog;
        GtkWidget *table_contact;
index 5d442bd36dea82ffd4a6890c97718218ccdc7dd4..d22eee993267962ef4ee0e1d2b96a20713820a9f 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <libempathy/empathy-idle.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-status-presets.h>
 
 #include "empathy-ui-utils.h"
@@ -45,8 +44,6 @@
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_PRESENCE_CHOOSER, EmpathyPresenceChooserPriv))
 
-#define DEBUG_DOMAIN "PresenceChooser"
-
 /* Flashing delay for icons (milliseconds). */
 #define FLASH_TIMEOUT 500
 
index d32570bb383859d5e43addce2a7e7573d37bd0ba..7d2a744a18790b106f0ba8b56e2c475ee455e3de 100644 (file)
 
 #include <string.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-smiley-manager.h"
 #include "empathy-ui-utils.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_SMILEY_MANAGER, EmpathySmileyManagerPriv))
 
-#define DEBUG_DOMAIN "SmileyManager"
-
 typedef struct {
        gunichar   c;
        GdkPixbuf *pixbuf;
index 422dcfb10688706ab03b04f14d791c023989a186..c1c630354eba8290705168c7f4f0cf3a277b873e 100644 (file)
 #include <enchant.h>
 #endif
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-spell.h"
 #include "empathy-conf.h"
 
-#define DEBUG_DOMAIN "Spell"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 #ifdef HAVE_ENCHANT
 
@@ -166,7 +165,7 @@ spell_notify_languages_cb (EmpathyConf  *conf,
 {
        GList *l;
 
-       empathy_debug (DEBUG_DOMAIN, "Resetting languages due to config change");
+       DEBUG ("Resetting languages due to config change");
 
        /* We just reset the languages list. */
        for (l = languages; l; l = l->next) {
@@ -213,7 +212,7 @@ spell_setup_languages (void)
                while (strv && strv[i]) {
                        SpellLanguage *lang;
 
-                       empathy_debug (DEBUG_DOMAIN, "Setting up language:'%s'", strv[i]);
+                       DEBUG ("Setting up language:'%s'", strv[i]);
 
                        lang = g_slice_new0 (SpellLanguage);
 
@@ -310,7 +309,7 @@ empathy_spell_check (const gchar *word)
        spell_setup_languages ();
 
        if (!languages) {
-               empathy_debug (DEBUG_DOMAIN, "No languages to check against");
+               DEBUG ("No languages to check against");
                return TRUE;
        }
 
@@ -322,7 +321,7 @@ empathy_spell_check (const gchar *word)
 
        if (digit) {
                /* We don't spell check digits. */
-               empathy_debug (DEBUG_DOMAIN, "Not spell checking word:'%s', it is all digits", word);
+               DEBUG ("Not spell checking word:'%s', it is all digits", word);
                return TRUE;
        }
 
@@ -382,7 +381,7 @@ gboolean
 empathy_spell_supported (void)
 {
        if (g_getenv ("EMPATHY_SPELL_DISABLED")) {
-               empathy_debug (DEBUG_DOMAIN, "EMPATHY_SPELL_DISABLE env variable defined");
+               DEBUG ("EMPATHY_SPELL_DISABLE env variable defined");
                return FALSE;
        }
 
@@ -400,7 +399,7 @@ empathy_spell_supported (void)
 GList *
 empathy_spell_get_suggestions (const gchar *word)
 {
-       empathy_debug (DEBUG_DOMAIN, "Support disabled, could not get suggestions");
+       DEBUG ("Support disabled, could not get suggestions");
 
        return NULL;
 }
@@ -408,7 +407,7 @@ empathy_spell_get_suggestions (const gchar *word)
 gboolean
 empathy_spell_check (const gchar *word)
 {
-       empathy_debug (DEBUG_DOMAIN, "Support disabled, could not check spelling");
+       DEBUG ("Support disabled, could not check spelling");
 
        return TRUE;
 }
@@ -416,7 +415,7 @@ empathy_spell_check (const gchar *word)
 const gchar *
 empathy_spell_get_language_name (const gchar *lang)
 {
-       empathy_debug (DEBUG_DOMAIN, "Support disabled, could not get language name");
+       DEBUG ("Support disabled, could not get language name");
 
        return NULL;
 }
@@ -424,7 +423,7 @@ empathy_spell_get_language_name (const gchar *lang)
 GList *
 empathy_spell_get_language_codes (void)
 {
-       empathy_debug (DEBUG_DOMAIN, "Support disabled, could not get language codes");
+       DEBUG ("Support disabled, could not get language codes");
 
        return NULL;
 }
index 4f483cf350553cfbd3778ae7be0a62ab1b5744c7..797997c0aabdeda5ce33f18c3d90c92012e12fc8 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __EMPATHY_SPELL_H__
 #define __EMPATHY_SPELL_H__
 
+#include <glib.h>
+
 G_BEGIN_DECLS
 
 gboolean     empathy_spell_supported           (void);
index 94f7abaf9fca376d03859a0e01ac4a94b1630a08..a2466cdcf31aec4c4e2b28fc7e6a92ca919c9575 100644 (file)
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-ui-utils.h"
 #include "empathy-theme-boxes.h"
 
-#define DEBUG_DOMAIN "FancyTheme"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 #define MARGIN 4
 #define HEADER_PADDING 2
@@ -549,7 +548,7 @@ theme_boxes_maybe_append_header (EmpathyTheme        *theme,
        last_contact = empathy_chat_view_get_last_contact (view);
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
-       empathy_debug (DEBUG_DOMAIN, "Maybe add fancy header");
+       DEBUG ("Maybe add fancy header");
 
        /* Only insert a header if the previously inserted block is not the same
         * as this one. This catches all the different cases:
index 07ee6781babb07df597cef6a22c6579ba951e2e6..52ebb18fa392f94b61923b143313eb9d7c251db0 100644 (file)
 #include "config.h"
 
 #include <glib/gi18n.h>
-#include <libempathy/empathy-debug.h>
 
 #include "empathy-chat.h"
 #include "empathy-ui-utils.h"
 #include "empathy-theme-irc.h"
 
-#define DEBUG_DOMAIN "Theme"
-
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_THEME_IRC, EmpathyThemeIrcPriv))
 
 typedef struct _EmpathyThemeIrcPriv EmpathyThemeIrcPriv;
index f33126a95abbd7c18a7bcbd7750d173ac4fdd48e..b3638476c719e6d439469e38f97a59f46445ff61 100644 (file)
@@ -24,7 +24,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-chat.h"
@@ -32,8 +31,6 @@
 #include "empathy-theme.h"
 #include "empathy-smiley-manager.h"
 
-#define DEBUG_DOMAIN "Theme"
-
 /* Number of seconds between timestamps when using normal mode, 5 minutes. */
 #define TIMESTAMP_INTERVAL 300
 
index 6ac6ebd9fa49a4539a8d4fcaae9522aa77d18d8e..bc4d7597b58965c70693a345e1806dd9b52c75a0 100644 (file)
 
 #include <libmissioncontrol/mc-profile.h>
 
-#include <libempathy/empathy-debug.h>
-
 #include "empathy-ui-utils.h"
 #include "empathy-images.h"
 
-#define DEBUG_DOMAIN "UiUtils"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 struct SizeData {
        gint     width;
@@ -64,7 +63,7 @@ get_glade_file (const gchar *filename,
        const char *name;
        GtkWidget **widget_ptr;
 
-       empathy_debug (DEBUG_DOMAIN, "Loading glade file %s", filename);
+       DEBUG ("Loading glade file %s", filename);
 
        gui = glade_xml_new (filename, root, domain);
 
@@ -259,15 +258,15 @@ empathy_pixbuf_from_data (gchar *data,
 
        loader = gdk_pixbuf_loader_new ();
        if (!gdk_pixbuf_loader_write (loader, data, data_size, &error)) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to write to pixbuf loader: %s",
-                              error ? error->message : "No error given");
+               DEBUG ("Failed to write to pixbuf loader: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
                g_object_unref (loader);
                return NULL;
        }
        if (!gdk_pixbuf_loader_close (loader, &error)) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to close pixbuf loader: %s",
-                              error ? error->message : "No error given");
+               DEBUG ("Failed to close pixbuf loader: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
                g_object_unref (loader);
                return NULL;
@@ -527,7 +526,7 @@ empathy_pixbuf_from_icon_name (const gchar *icon_name,
                                           0,
                                           &error);
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error loading icon: %s", error->message);
+               DEBUG ("Error loading icon: %s", error->message);
                g_clear_error (&error);
        }
 
index f03178ba634719485891eee786bcd314ed65b30f..41395d6e9880647d5fcdaf73607cd352ba2d6242 100644 (file)
  * Authors: Xavier Claessens <xclaesse@gmail.com>
  */
 
+
 #include "config.h"
 
 #include <telepathy-glib/util.h>
 
 #include "empathy-avatar.h"
 #include "empathy-utils.h"
-#include "empathy-debug.h"
 
-#define DEBUG_DOMAIN "Avatar"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
 
 GType
 empathy_avatar_get_type (void)
@@ -109,12 +110,11 @@ empathy_avatar_new (const guchar *data,
        filename = avatar_get_filename (token);
        if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
                if (!g_file_set_contents (filename, data, len, &error)) {
-                       empathy_debug (DEBUG_DOMAIN,
-                                      "Failed to save avatar in cache: %s",
-                                      error ? error->message : "No error given");
+                       DEBUG ("Failed to save avatar in cache: %s",
+                               error ? error->message : "No error given");
                        g_clear_error (&error);
                } else {
-                       empathy_debug (DEBUG_DOMAIN, "Avatar saved to %s", filename);
+                       DEBUG ("Avatar saved to %s", filename);
                }
        }
        g_free (filename);
@@ -137,15 +137,14 @@ empathy_avatar_new_from_cache (const gchar *token)
        filename = avatar_get_filename (token);
        if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
                if (!g_file_get_contents (filename, &data, &len, &error)) {
-                       empathy_debug (DEBUG_DOMAIN,
-                                      "Failed to load avatar from cache: %s",
-                                      error ? error->message : "No error given");
+                       DEBUG ("Failed to load avatar from cache: %s",
+                               error ? error->message : "No error given");
                        g_clear_error (&error);
                }
        }
 
        if (data) {
-               empathy_debug (DEBUG_DOMAIN, "Avatar loaded from %s", filename);
+               DEBUG ("Avatar loaded from %s", filename);
                avatar = avatar_new (data, len, NULL, g_strdup (token));
        }
 
index 0e0c2be2bae9969e278f2bbdf0d28d623fc543bc..80c190bd94269ad734f50cf5210297eb07d14219 100644 (file)
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-#include "empathy-debug.h"
 #include "empathy-chatroom-manager.h"
 #include "empathy-utils.h"
 
-#define DEBUG_DOMAIN "ChatroomManager"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv))
 
@@ -338,7 +338,7 @@ chatroom_manager_file_parse (EmpathyChatroomManager *manager,
 
        priv = GET_PRIV (manager);
 
-       empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename);
+       DEBUG ("Attempting to parse file:'%s'...", filename);
 
        ctxt = xmlNewParserCtxt ();
 
@@ -366,9 +366,7 @@ chatroom_manager_file_parse (EmpathyChatroomManager *manager,
                }
        }
 
-       empathy_debug (DEBUG_DOMAIN,
-                     "Parsed %d chatrooms",
-                     g_list_length (priv->chatrooms));
+       DEBUG ("Parsed %d chatrooms", g_list_length (priv->chatrooms));
 
        xmlFreeDoc(doc);
        xmlFreeParserCtxt (ctxt);
@@ -488,7 +486,7 @@ chatroom_manager_file_save (EmpathyChatroomManager *manager)
        /* Make sure the XML is indented properly */
        xmlIndentTreeOutput = 1;
 
-       empathy_debug (DEBUG_DOMAIN, "Saving file:'%s'", file);
+       DEBUG ("Saving file:'%s'", file);
        xmlSaveFormatFileEnc (file, doc, "utf-8", 1);
        xmlFreeDoc (doc);
 
index b71cf6642a4fa98c63ecf4c8c5a430f1ec7734c8..83d920a948637a60f263708bf5200c55201442d3 100644 (file)
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-#include "empathy-debug.h"
 #include "empathy-utils.h"
 #include "empathy-contact-groups.h"
 
-#define DEBUG_DOMAIN "ContactGroups"
+#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
+#include "empathy-debug.h"
 
 #define CONTACT_GROUPS_XML_FILENAME "contact-groups.xml"
 #define CONTACT_GROUPS_DTD_FILENAME "empathy-contact-groups.dtd"
@@ -87,7 +87,7 @@ contact_groups_file_parse (const gchar *filename)
        xmlNodePtr       account;
        xmlNodePtr       node;
 
-       empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename);
+       DEBUG ("Attempting to parse file:'%s'...", filename);
 
        ctxt = xmlNewParserCtxt ();
 
@@ -150,7 +150,7 @@ contact_groups_file_parse (const gchar *filename)
                node = node->next;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Parsed %d contact groups", g_list_length (groups));
+       DEBUG ("Parsed %d contact groups", g_list_length (groups));
 
        xmlFreeDoc(doc);
        xmlFreeParserCtxt (ctxt);
@@ -216,7 +216,7 @@ contact_groups_file_save (void)
        /* Make sure the XML is indented properly */
        xmlIndentTreeOutput = 1;
 
-       empathy_debug (DEBUG_DOMAIN, "Saving file:'%s'", file);
+       DEBUG ("Saving file:'%s'", file);
        xmlSaveFormatFileEnc (file, doc, "utf-8", 1);
        xmlFreeDoc (doc);
 
index cad19293e1bab7e01c575c968412b3bc6f3d1e6a..cb7fcadc99df2c9662984f24d96bdd3eadb8069f 100644 (file)
 #include "empathy-contact-manager.h"
 #include "empathy-contact-list.h"
 #include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
 #include "empathy-debug.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv))
 
-#define DEBUG_DOMAIN "ContactManager"
-
 struct _EmpathyContactManagerPriv {
        GHashTable     *lists;
        MissionControl *mc;
@@ -121,8 +121,7 @@ contact_manager_destroy_cb (EmpathyTpContactList  *list,
 
        account = empathy_tp_contact_list_get_account (list);
 
-       empathy_debug (DEBUG_DOMAIN, "Removing account: %s",
-                      mc_account_get_display_name (account));
+       DEBUG ("Removing account: %s", mc_account_get_display_name (account));
 
        contact_manager_disconnect_foreach (account, list, manager);
        g_hash_table_remove (priv->lists, account);
@@ -139,8 +138,7 @@ contact_manager_add_account (EmpathyContactManager *manager,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Adding new account: %s",
-                      mc_account_get_display_name (account));
+       DEBUG ("Adding new account: %s", mc_account_get_display_name (account));
 
        list = empathy_tp_contact_list_new (account);
        if (!list) {
index 87e7c62be934659115581a83e9530b181e6efe01..639cd9388664183afb8006e45548dc61e26d369b 100644 (file)
 
 #include "empathy-contact.h"
 #include "empathy-utils.h"
-#include "empathy-debug.h"
 #include "empathy-enum-types.h"
 
-#define DEBUG_DOMAIN "Contact"
+#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
+#include "empathy-debug.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONTACT, EmpathyContactPriv))
 
@@ -195,7 +195,7 @@ contact_finalize (GObject *object)
 
        priv = GET_PRIV (object);
 
-       empathy_debug (DEBUG_DOMAIN, "finalize: %p", object);
+       DEBUG ("finalize: %p", object);
 
        g_free (priv->name);
        g_free (priv->id);
index d81e6dca731c5789181fc11c6fba98bde338017e..f34e0be3f291ba15ee2374ff4c43755ddf5077fa 100644 (file)
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2006-2007 Imendio AB
+ * Copyright (C) 2007 Collabora Ltd.
+ * Copyright (C) 2007 Nokia Corporation
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * 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 program is distributed in the hope that it will be useful,
+ * 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Richard Hult <richard@imendio.com>
+ * 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
  */
 
 #include "config.h"
 
+#include <errno.h>
+#include <fcntl.h>
 #include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
+#include <unistd.h>
 
 #include <glib.h>
-#include <glib/gprintf.h>
 #include <glib/gstdio.h>
 
 #include <telepathy-glib/debug.h>
 
-/* Set EMPATHY_DEBUG to a colon/comma/space separated list of domains, or "all"
- * to get all debug output.
- */
-
 #include "empathy-debug.h"
 
-static gchar    **debug_strv;
-static gboolean   all_domains = FALSE;
-
-static void
-debug_init (void)
-{
-       static gboolean inited = FALSE;
-
-       if (!inited) {
-               const gchar *env;
-               gint         i;
+#ifdef ENABLE_DEBUG
 
-               env = g_getenv ("TELEPATHY_GLIB_DEBUG");
-               tp_debug_set_flags (env);
+static EmpathyDebugFlags flags = 0;
 
-               env = g_getenv ("EMPATHY_DEBUG");
+static GDebugKey keys[] = {
+  { "Tp", EMPATHY_DEBUG_TP },
+  { "Chat", EMPATHY_DEBUG_CHAT },
+  { "Contact", EMPATHY_DEBUG_CONTACT },
+  { "Account", EMPATHY_DEBUG_ACCOUNT },
+  { "Irc", EMPATHY_DEBUG_IRC },
+  { "Filter", EMPATHY_DEBUG_FILTER },
+  { "Other", EMPATHY_DEBUG_OTHER },
+  { 0, }
+};
 
-               if (env) {
-                       debug_strv = g_strsplit_set (env, ":, ", 0);
-               } else {
-                       debug_strv = NULL;
-               }
-
-               for (i = 0; debug_strv && debug_strv[i]; i++) {
-                       if (strcmp ("all", debug_strv[i]) == 0) {
-                               all_domains = TRUE;
-                       }
-               }
-
-               inited = TRUE;
-       }
+static void
+debug_set_flags (EmpathyDebugFlags new_flags)
+{
+  flags |= new_flags;
+  g_print ("%d\n", flags);
 }
 
 void
-empathy_debug_impl (const gchar *domain, const gchar *msg, ...)
+empathy_debug_set_flags (const gchar *flags_string)
 {
-       gint i;
+  guint nkeys;
 
-       g_return_if_fail (domain != NULL);
-       g_return_if_fail (msg != NULL);
+  for (nkeys = 0; keys[nkeys].value; nkeys++);
+g_print ("%s %d\n", flags_string, nkeys);
+  //tp_debug_set_flags (flags_string);
 
-       debug_init ();
-
-       for (i = 0; debug_strv && debug_strv[i]; i++) {
-               if (all_domains || strcmp (domain, debug_strv[i]) == 0) {
-                       va_list args;
-
-                       g_print ("%s: ", domain);
+  if (flags_string)
+      debug_set_flags (g_parse_debug_string (flags_string, keys, nkeys));
+}
 
-                       va_start (args, msg);
-                       g_vprintf (msg, args);
-                       va_end (args);
+gboolean
+empathy_debug_flag_is_set (EmpathyDebugFlags flag)
+{
+  return (flag & flags) != 0;
+}
 
-                       g_print ("\n");
-                       break;
-               }
-       }
+void
+empathy_debug (EmpathyDebugFlags flag,
+               const gchar *format,
+               ...)
+{
+  if (flag & flags)
+    {
+      va_list args;
+      va_start (args, format);
+      g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
+      va_end (args);
+    }
 }
 
+#else
+
 void
-empathy_debug_set_log_file_from_env (void)
+empathy_debug_set_flags (const gchar *flags_string)
 {
-       const gchar *output_file;
-       gint         out;
-
-       output_file = g_getenv ("EMPATHY_LOGFILE");
-       if (output_file == NULL) {
-               return;
-       }
-
-       out = g_open (output_file, O_WRONLY | O_CREAT, 0644);
-       if (out == -1) {
-               g_warning ("Can't open logfile '%s': %s", output_file,
-                          g_strerror (errno));
-               return;
-       }
-
-       if (dup2 (out, STDOUT_FILENO) == -1) {
-               g_warning ("Error when duplicating stdout file descriptor: %s",
-                          g_strerror (errno));
-               return;
-       }
-
-       if (dup2 (out, STDERR_FILENO) == -1) {
-               g_warning ("Error when duplicating stderr file descriptor: %s",
-                          g_strerror (errno));
-               return;
-       }
 }
 
+#endif /* ENABLE_DEBUG */
+
index 55827d5c04e3941687866fab06a7b130b53c8f28..f0578640a63aaebb438fd7e72f92f6889eb61fd0 100644 (file)
@@ -1,58 +1,94 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2006-2007 Imendio AB
+ * Copyright (C) 2007 Collabora Ltd.
+ * Copyright (C) 2007 Nokia Corporation
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * 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 program is distributed in the hope that it will be useful,
+ * 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Richard Hult <richard@imendio.com>
+ * 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
  */
 
 #ifndef __EMPATHY_DEBUG_H__
 #define __EMPATHY_DEBUG_H__
 
+#include "config.h"
+
+
 #include <glib.h>
+#include <telepathy-glib/debug.h>
 
 G_BEGIN_DECLS
 
-#ifdef G_HAVE_ISO_VARARGS
-#  ifdef EMPATHY_DISABLE_DEBUG
-#    define empathy_debug(...)
-#  else
-#    define empathy_debug(...) empathy_debug_impl (__VA_ARGS__)
-#  endif
-#elif defined(G_HAVE_GNUC_VARARGS)
-#  if EMPATHY_DISABLE_DEBUG
-#    define empathy_debug(fmt...)
-#  else
-#    define empathy_debug(fmt...) empathy_debug_impl(fmt)
-#  endif
-#else
-#  if EMPATHY_DISABLE_DEBUG
-#    define empathy_debug(x)
-#  else
-#    define empathy_debug empathy_debug_impl
-#  endif
-#endif
-
-void empathy_debug_impl                  (const gchar *domain,
-                                         const gchar *msg,
-                                         ...);
-void empathy_debug_set_log_file_from_env (void);
+#ifdef ENABLE_DEBUG
+
+/* Please keep this enum in sync with #keys in empathy-debug.c */
+typedef enum
+{
+  EMPATHY_DEBUG_TP = 1 << 1,
+  EMPATHY_DEBUG_CHAT = 1 << 2,
+  EMPATHY_DEBUG_CONTACT = 1 << 3,
+  EMPATHY_DEBUG_ACCOUNT = 1 << 4,
+  EMPATHY_DEBUG_IRC = 1 << 5,
+  EMPATHY_DEBUG_FILTER = 1 << 6,
+  EMPATHY_DEBUG_OTHER = 1 << 7,
+} EmpathyDebugFlags;
 
+gboolean empathy_debug_flag_is_set (EmpathyDebugFlags flag);
+void empathy_debug (EmpathyDebugFlags flag, const gchar *format, ...)
+    G_GNUC_PRINTF (2, 3);
+
+#endif /* ENABLE_DEBUG */
+
+void empathy_debug_set_flags (const gchar *flags_string);
 G_END_DECLS
 
 #endif /* __EMPATHY_DEBUG_H__ */
 
+/* ------------------------------------ */
+
+/* Below this point is outside the __DEBUG_H__ guard - so it can take effect
+ * more than once. So you can do:
+ *
+ * #define DEBUG_FLAG EMPATHY_DEBUG_ONE_THING
+ * #include "internal-debug.h"
+ * ...
+ * DEBUG ("if we're debugging one thing");
+ * ...
+ * #undef DEBUG_FLAG
+ * #define DEBUG_FLAG EMPATHY_DEBUG_OTHER_THING
+ * #include "internal-debug.h"
+ * ...
+ * DEBUG ("if we're debugging the other thing");
+ * ...
+ */
+
+#ifdef DEBUG_FLAG
+#ifdef ENABLE_DEBUG
+
+#undef DEBUG
+#define DEBUG(format, ...) \
+  empathy_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
+
+#undef DEBUGGING
+#define DEBUGGING empathy_debug_flag_is_set (DEBUG_FLAG)
+
+#else /* !defined (ENABLE_DEBUG) */
+
+#undef DEBUG
+#define DEBUG(format, ...) do {} while (0)
+
+#undef DEBUGGING
+#define DEBUGGING 0
+
+#endif /* !defined (ENABLE_DEBUG) */
+#endif /* defined (DEBUG_FLAG) */
index d5ce3bd9b51d245b8d24304e74e32f6f762df7f8..b6566a6f64c9b0f935ce460ed0f55176346989ba 100644 (file)
 #include "empathy-utils.h" 
 #include "empathy-debug.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_IDLE, EmpathyIdlePriv))
 
-#define DEBUG_DOMAIN "Idle"
-
 /* Number of seconds before entering extended autoaway. */
 #define EXT_AWAY_TIME (30*60)
 
@@ -189,14 +190,14 @@ empathy_idle_init (EmpathyIdle *idle)
                                             G_CALLBACK (idle_session_idle_changed_cb),
                                             idle, NULL);
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get gs proxy");
+               DEBUG ("Failed to get gs proxy");
        }
 
 
        system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
        if (!system_bus) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get system bus: %s",
-                             error ? error->message : "No error given");
+               DEBUG ("Failed to get system bus: %s",
+                       error ? error->message : "No error given");
        } else {
                priv->nm_proxy = dbus_g_proxy_new_for_name (system_bus,
                                                            "org.freedesktop.NetworkManager",
@@ -210,7 +211,7 @@ empathy_idle_init (EmpathyIdle *idle)
                                             G_CALLBACK (idle_nm_state_change_cb),
                                             idle, NULL);
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get nm proxy");
+               DEBUG ("Failed to get nm proxy");
        }
 
        priv->nm_connected = TRUE;
@@ -398,11 +399,11 @@ empathy_idle_set_presence (EmpathyIdle *idle,
 
        priv = GET_PRIV (idle);
 
-       empathy_debug (DEBUG_DOMAIN, "Changing presence to %s (%d)",
+       DEBUG ("Changing presence to %s (%d)",
                       status, state);
 
        if (!priv->nm_connected) {
-               empathy_debug (DEBUG_DOMAIN, "NM not connected");
+               DEBUG ("NM not connected");
                return;
        }
 
@@ -468,9 +469,7 @@ empathy_idle_set_use_nm (EmpathyIdle *idle,
                                   G_TYPE_INVALID);
 
                if (error) {
-                       empathy_debug (DEBUG_DOMAIN, 
-                                      "Couldn't get NM state: %s",
-                                      error->message);
+                       DEBUG ("Couldn't get NM state: %s", error->message);
                        g_clear_error (&error);
                        nm_status = NM_STATE_ASLEEP;
                }
@@ -497,8 +496,7 @@ idle_presence_changed_cb (MissionControl *mc,
 
        priv = GET_PRIV (idle);
 
-       empathy_debug (DEBUG_DOMAIN, "Presence changed to '%s' (%d)",
-                      status, state);
+       DEBUG ("Presence changed to '%s' (%d)", status, state);
 
        g_free (priv->status);
        priv->state = state;
@@ -520,9 +518,9 @@ idle_session_idle_changed_cb (DBusGProxy  *gs_proxy,
 
        priv = GET_PRIV (idle);
 
-       empathy_debug (DEBUG_DOMAIN, "Session idle state changed, %s -> %s",
-                     priv->is_idle ? "yes" : "no",
-                     is_idle ? "yes" : "no");
+       DEBUG ("Session idle state changed, %s -> %s",
+               priv->is_idle ? "yes" : "no",
+               is_idle ? "yes" : "no");
 
        if (priv->state <= MC_PRESENCE_OFFLINE ||
            priv->state == MC_PRESENCE_HIDDEN ||
@@ -550,7 +548,7 @@ idle_session_idle_changed_cb (DBusGProxy  *gs_proxy,
                        priv->away_reset_status = FALSE;
                }
 
-               empathy_debug (DEBUG_DOMAIN, "Going to autoaway");
+               DEBUG ("Going to autoaway");
                empathy_idle_set_state (idle, new_state);
 
                idle_ext_away_start (idle);
@@ -558,9 +556,9 @@ idle_session_idle_changed_cb (DBusGProxy  *gs_proxy,
                /* We are no more idle, restore state */
                idle_ext_away_stop (idle);
 
-               empathy_debug (DEBUG_DOMAIN, "Restoring state to %d, reset status: %s",
-                             priv->away_saved_state,
-                             priv->away_reset_status ? "Yes" : "No");
+               DEBUG ("Restoring state to %d, reset status: %s",
+                       priv->away_saved_state,
+                       priv->away_reset_status ? "Yes" : "No");
 
                if (priv->nm_connected) {
                        empathy_idle_set_presence (idle,
@@ -591,8 +589,8 @@ idle_nm_state_change_cb (DBusGProxy  *proxy,
 
        priv = GET_PRIV (idle);
 
-       empathy_debug (DEBUG_DOMAIN, "New network state (%d), in use = %s",
-                      state, priv->use_nm ? "Yes" : "No");
+       DEBUG ("New network state (%d), in use = %s",
+               state, priv->use_nm ? "Yes" : "No");
 
        if (!priv->use_nm) {
                return;
@@ -655,7 +653,7 @@ idle_ext_away_cb (EmpathyIdle *idle)
 
        priv = GET_PRIV (idle);
 
-       empathy_debug (DEBUG_DOMAIN, "Going to extended autoaway");
+       DEBUG ("Going to extended autoaway");
        empathy_idle_set_state (idle, MC_PRESENCE_EXTENDED_AWAY);
        priv->ext_away_timeout = 0;
 
index f88b93bc778df3dd4ddd36c67ab2d4b4c41cb2d5..e919d9cbb32f11a8a68ea08cc755763f34ba5f6f 100644 (file)
@@ -30,7 +30,9 @@
 #include "empathy-utils.h"
 #include "empathy-irc-network-manager.h"
 
-#define DEBUG_DOMAIN "IrcNetworkManager"
+#define DEBUG_FLAG EMPATHY_DEBUG_IRC
+#include "empathy-debug.h"
+
 #define IRC_NETWORKS_DTD_FILENAME "empathy-irc-networks.dtd"
 #define SAVE_TIMER 4
 
@@ -336,12 +338,11 @@ empathy_irc_network_manager_add (EmpathyIrcNetworkManager *self,
 
   if (priv->last_id == G_MAXUINT)
     {
-      empathy_debug (DEBUG_DOMAIN,
-          "Can't add network: too many networks using a similiar ID");
+      DEBUG ("Can't add network: too many networks using a similiar ID");
       return;
     }
 
-  empathy_debug (DEBUG_DOMAIN, "add server with \"%s\" as ID", id);
+  DEBUG ("add server with \"%s\" as ID", id);
 
   network->user_defined = TRUE;
   add_network (self, network, id);
@@ -429,8 +430,7 @@ load_global_file (EmpathyIrcNetworkManager *self)
 
   if (!g_file_test (priv->global_file, G_FILE_TEST_EXISTS))
     {
-      empathy_debug (DEBUG_DOMAIN, "Global networks file %s doesn't exist",
-          priv->global_file);
+      DEBUG ("Global networks file %s doesn't exist", priv->global_file);
       return;
     }
 
@@ -448,8 +448,7 @@ load_user_file (EmpathyIrcNetworkManager *self)
 
   if (!g_file_test (priv->user_file, G_FILE_TEST_EXISTS))
     {
-      empathy_debug (DEBUG_DOMAIN, "User networks file %s doesn't exist",
-          priv->global_file);
+      DEBUG ("User networks file %s doesn't exist", priv->global_file);
       return;
     }
 
@@ -504,8 +503,7 @@ irc_network_manager_parse_irc_server (EmpathyIrcNetwork *network,
           if (ssl == NULL || strcmp (ssl, "TRUE") == 0)
             have_ssl = TRUE;
 
-          empathy_debug (DEBUG_DOMAIN, "parsed server %s port %d ssl %d",
-              address, port_nb, have_ssl);
+          DEBUG ("parsed server %s port %d ssl %d", address, port_nb, have_ssl);
 
           server = empathy_irc_server_new (address, port_nb, have_ssl);
           empathy_irc_network_append_server (network, server);
@@ -537,8 +535,7 @@ irc_network_manager_parse_irc_network (EmpathyIrcNetworkManager *self,
     {
       if (!user_defined)
         {
-          empathy_debug (DEBUG_DOMAIN, "the \"dropped\" attribute shouldn't be"
-             " used in the global file");
+          DEBUG ("the 'dropped' attribute shouldn't be used in the global file");
         }
 
       network = g_hash_table_lookup (priv->networks, id);
@@ -566,7 +563,7 @@ irc_network_manager_parse_irc_network (EmpathyIrcNetworkManager *self,
     }
 
   add_network (self, network, id);
-  empathy_debug (DEBUG_DOMAIN, "add network %s (id %s)", name, id);
+  DEBUG ("add network %s (id %s)", name, id);
 
   for (child = node->children; child; child = child->next)
     {
@@ -605,7 +602,7 @@ irc_network_manager_file_parse (EmpathyIrcNetworkManager *self,
 
   priv = EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
 
-  empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename);
+  DEBUG ("Attempting to parse file:'%s'...", filename);
 
   ctxt = xmlNewParserCtxt ();
 
@@ -717,11 +714,11 @@ irc_network_manager_file_save (EmpathyIrcNetworkManager *self)
 
   if (priv->user_file == NULL)
     {
-      empathy_debug (DEBUG_DOMAIN, "can't save: no user file defined");
+      DEBUG ("can't save: no user file defined");
       return FALSE;
     }
 
-  empathy_debug (DEBUG_DOMAIN, "Saving IRC networks");
+  DEBUG ("Saving IRC networks");
 
   doc = xmlNewDoc ("1.0");
   root = xmlNewNode (NULL, "networks");
index 2904407b51495aab8932fa8657084c3da636f5ca..081807fe7288da153e3650f001a4e256fb2eefd9 100644 (file)
 #include "empathy-log-manager.h"
 #include "empathy-contact.h"
 #include "empathy-time.h"
-#include "empathy-debug.h"
 #include "empathy-utils.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv))
 
-#define DEBUG_DOMAIN "LogManager"
-
 #define LOG_DIR_CREATE_MODE       (S_IRUSR | S_IWUSR | S_IXUSR)
 #define LOG_FILE_CREATE_MODE      (S_IRUSR | S_IWUSR)
 #define LOG_DIR_CHATROOMS         "chatrooms"
@@ -164,14 +164,13 @@ empathy_log_manager_add_message (EmpathyLogManager *manager,
        filename = log_manager_get_filename (manager, account, chat_id, chatroom);
        basedir = g_path_get_dirname (filename);
        if (!g_file_test (basedir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
-               empathy_debug (DEBUG_DOMAIN, "Creating directory:'%s'", basedir);
+               DEBUG ("Creating directory:'%s'", basedir);
 
                g_mkdir_with_parents (basedir, LOG_DIR_CREATE_MODE);
        }
        g_free (basedir);
 
-       empathy_debug (DEBUG_DOMAIN, "Adding message: '%s' to file: '%s'",
-                     body_str, filename);
+       DEBUG ("Adding message: '%s' to file: '%s'", body_str, filename);
 
        if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
                file = g_fopen (filename, "w+");
@@ -255,12 +254,12 @@ empathy_log_manager_get_dates (EmpathyLogManager *manager,
        directory = log_manager_get_dir (manager, account, chat_id, chatroom);
        dir = g_dir_open (directory, 0, NULL);
        if (!dir) {
-               empathy_debug (DEBUG_DOMAIN, "Could not open directory:'%s'", directory);
+               DEBUG ("Could not open directory:'%s'", directory);
                g_free (directory);
                return NULL;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Collating a list of dates in:'%s'", directory);
+       DEBUG ("Collating a list of dates in:'%s'", directory);
 
        while ((filename = g_dir_read_name (dir)) != NULL) {
                if (!g_str_has_suffix (filename, LOG_FILENAME_SUFFIX)) {
@@ -283,7 +282,7 @@ empathy_log_manager_get_dates (EmpathyLogManager *manager,
        g_free (directory);
        g_dir_close (dir);
 
-       empathy_debug (DEBUG_DOMAIN, "Parsed %d dates", g_list_length (dates));
+       DEBUG ("Parsed %d dates", g_list_length (dates));
 
        return dates;
 }
@@ -303,10 +302,10 @@ empathy_log_manager_get_messages_for_file (EmpathyLogManager *manager,
        g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
        g_return_val_if_fail (filename != NULL, NULL);
 
-       empathy_debug (DEBUG_DOMAIN, "Attempting to parse filename:'%s'...", filename);
+       DEBUG ("Attempting to parse filename:'%s'...", filename);
 
        if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
-               empathy_debug (DEBUG_DOMAIN, "Filename:'%s' does not exist", filename);
+               DEBUG ("Filename:'%s' does not exist", filename);
                return NULL;
        }
 
@@ -397,7 +396,7 @@ empathy_log_manager_get_messages_for_file (EmpathyLogManager *manager,
                xmlFree (msg_type_str);
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Parsed %d messages", g_list_length (messages));
+       DEBUG ("Parsed %d messages", g_list_length (messages));
 
        xmlFreeDoc (doc);
        xmlFreeParserCtxt (ctxt);
@@ -486,8 +485,7 @@ empathy_log_manager_search_new (EmpathyLogManager *manager,
        text_casefold = g_utf8_casefold (text, -1);
 
        files = log_manager_get_all_files (manager, NULL);
-       empathy_debug (DEBUG_DOMAIN, "Found %d log files in total",
-                     g_list_length (files));
+       DEBUG ("Found %d log files in total", g_list_length (files));
 
        for (l = files; l; l = l->next) {
                gchar       *filename;
@@ -516,9 +514,8 @@ empathy_log_manager_search_new (EmpathyLogManager *manager,
 
                        if (hit) {
                                hits = g_list_prepend (hits, hit);
-                               empathy_debug (DEBUG_DOMAIN, 
-                                             "Found text:'%s' in file:'%s' on date:'%s'...",
-                                             text, hit->filename, hit->date);
+                               DEBUG ("Found text:'%s' in file:'%s' on date:'%s'",
+                                       text, hit->filename, hit->date);
                        }
                }
 
index 89b1874f3260c08394a9f7f24820de34076dd8dd..b5e1f9bf89b4f854932064cd74d4b4c9bd09b6e2 100644 (file)
 
 #include <telepathy-glib/util.h>
 
-#include "empathy-debug.h"
 #include "empathy-utils.h"
 #include "empathy-status-presets.h"
 
-#define DEBUG_DOMAIN "StatusPresets"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
 
 #define STATUS_PRESETS_XML_FILENAME "status-presets.xml"
 #define STATUS_PRESETS_DTD_FILENAME "empathy-status-presets.dtd"
@@ -90,7 +90,7 @@ status_presets_file_parse (const gchar *filename)
        xmlNodePtr       presets_node;
        xmlNodePtr       node;
 
-       empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename);
+       DEBUG ("Attempting to parse file:'%s'...", filename);
 
        ctxt = xmlNewParserCtxt ();
 
@@ -133,9 +133,9 @@ status_presets_file_parse (const gchar *filename)
                                state = empathy_presence_from_str (state_str);
 
                                if (is_default) {
-                                       empathy_debug (DEBUG_DOMAIN,
-                                                     "Default status preset state is:'%s', status:'%s'",
-                                                     state_str, status);
+                                       DEBUG ("Default status preset state is:"
+                                               " '%s', status:'%s'", state_str,
+                                               status);
 
                                        status_presets_set_default (state, status);
                                } else {
@@ -156,7 +156,7 @@ status_presets_file_parse (const gchar *filename)
                status_presets_set_default (MC_PRESENCE_OFFLINE, NULL);
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Parsed %d status presets", g_list_length (presets));
+       DEBUG ("Parsed %d status presets", g_list_length (presets));
 
        xmlFreeDoc (doc);
        xmlFreeParserCtxt (ctxt);
@@ -243,7 +243,7 @@ status_presets_file_save (void)
        /* Make sure the XML is indented properly */
        xmlIndentTreeOutput = 1;
 
-       empathy_debug (DEBUG_DOMAIN, "Saving file:'%s'", file);
+       DEBUG ("Saving file:'%s'", file);
        xmlSaveFormatFileEnc (file, doc, "utf-8", 1);
        xmlFreeDoc (doc);
 
index 73ec8e992d7bcfa4634bf3c77a3ea5067b3c78aa..4c3779f285e8bf66267485aa304eba604c8e2e99 100644 (file)
 
 #include <extensions/extensions.h>
 #include <libempathy/empathy-contact-factory.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-tp-group.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-tp-call.h"
 
-#define DEBUG_DOMAIN "TpCall"
+#define DEBUG_FLAG EMPATHY_DEBUG_TP
+#include "empathy-debug.h"
 
 #define GET_PRIV(object) (G_TYPE_INSTANCE_GET_PRIVATE \
     ((object), EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv))
@@ -85,8 +85,7 @@ tp_call_add_stream (EmpathyTpCall *call,
   switch (stream_type)
     {
       case TP_MEDIA_STREAM_TYPE_AUDIO:
-        empathy_debug (DEBUG_DOMAIN,
-            "Audio stream - id: %d, state: %d, direction: %d",
+        DEBUG ("Audio stream - id: %d, state: %d, direction: %d",
             stream_id, stream_state, stream_direction);
         priv->audio->exists = TRUE;
         priv->audio->id = stream_id;
@@ -95,8 +94,7 @@ tp_call_add_stream (EmpathyTpCall *call,
         g_object_notify (G_OBJECT (call), "audio-stream");
         break;
       case TP_MEDIA_STREAM_TYPE_VIDEO:
-        empathy_debug (DEBUG_DOMAIN,
-            "Video stream - id: %d, state: %d, direction: %d",
+        DEBUG ("Video stream - id: %d, state: %d, direction: %d",
             stream_id, stream_state, stream_direction);
         priv->video->exists = TRUE;
         priv->video->id = stream_id;
@@ -105,8 +103,7 @@ tp_call_add_stream (EmpathyTpCall *call,
         g_object_notify (G_OBJECT (call), "video-stream");
         break;
       default:
-        empathy_debug (DEBUG_DOMAIN, "Unknown stream type: %d",
-            stream_type);
+        DEBUG ("Unknown stream type: %d", stream_type);
     }
 }
 
@@ -118,8 +115,7 @@ tp_call_stream_added_cb (TpChannel *channel,
                          gpointer user_data,
                          GObject *call)
 {
-  empathy_debug (DEBUG_DOMAIN,
-      "Stream added - stream id: %d, contact handle: %d, stream type: %d",
+  DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d",
       stream_id, contact_handle, stream_type);
 
   tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
@@ -135,7 +131,7 @@ tp_call_stream_removed_cb (TpChannel *channel,
 {
   EmpathyTpCallPriv *priv = GET_PRIV (call);
 
-  empathy_debug (DEBUG_DOMAIN, "Stream removed - stream id: %d", stream_id);
+  DEBUG ("Stream removed - stream id: %d", stream_id);
 
   if (stream_id == priv->audio->id)
     {
@@ -158,8 +154,7 @@ tp_call_stream_state_changed_cb (TpChannel *proxy,
 {
   EmpathyTpCallPriv *priv = GET_PRIV (call);
 
-  empathy_debug (DEBUG_DOMAIN,
-      "Stream state changed - stream id: %d, state state: %d",
+  DEBUG ("Stream state changed - stream id: %d, state state: %d",
       stream_id, stream_state);
 
   if (stream_id == priv->audio->id)
@@ -184,8 +179,7 @@ tp_call_stream_direction_changed_cb (TpChannel *channel,
 {
   EmpathyTpCallPriv *priv = GET_PRIV (call);
 
-  empathy_debug (DEBUG_DOMAIN,
-      "Stream direction changed - stream: %d, direction: %d",
+  DEBUG ("Stream direction changed - stream: %d, direction: %d",
       stream_id, stream_direction);
 
   if (stream_id == priv->audio->id)
@@ -211,7 +205,7 @@ tp_call_request_streams_cb (TpChannel *channel,
 
   if (error)
     {
-      empathy_debug (DEBUG_DOMAIN, "Error requesting streams: %s", error->message);
+      DEBUG ("Error requesting streams: %s", error->message);
       return;
     }
 
@@ -248,7 +242,7 @@ tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
   if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN)
       capabilities = EMPATHY_CAPABILITIES_AUDIO | EMPATHY_CAPABILITIES_VIDEO;
 
-  empathy_debug (DEBUG_DOMAIN, "Requesting new stream for capabilities %d",
+  DEBUG ("Requesting new stream for capabilities %d",
       capabilities);
 
   stream_types = g_array_new (FALSE, FALSE, sizeof (guint));
@@ -342,7 +336,7 @@ tp_call_channel_invalidated_cb (TpChannel     *channel,
 {
   EmpathyTpCallPriv *priv = GET_PRIV (call);
 
-  empathy_debug (DEBUG_DOMAIN, "Channel invalidated: %s", message);
+  DEBUG ("Channel invalidated: %s", message);
   priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
   g_object_notify (G_OBJECT (call), "status");
 }
@@ -355,8 +349,7 @@ tp_call_async_cb (TpProxy *proxy,
 {
   if (error)
     {
-      empathy_debug (DEBUG_DOMAIN, "Error %s: %s",
-          user_data, error->message);
+      DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
     }
 }
 
@@ -368,7 +361,7 @@ tp_call_close_channel (EmpathyTpCall *call)
   if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
       return;
 
-  empathy_debug (DEBUG_DOMAIN, "Closing channel");
+  DEBUG ("Closing channel");
 
   tp_cli_channel_call_close (priv->channel, -1,
       NULL, NULL, NULL, NULL);
@@ -384,8 +377,7 @@ tp_call_stream_engine_invalidated_cb (TpProxy       *stream_engine,
                                      gchar         *message,
                                      EmpathyTpCall *call)
 {
-  empathy_debug (DEBUG_DOMAIN, "Stream engine proxy invalidated: %s",
-      message);
+  DEBUG ("Stream engine proxy invalidated: %s", message);
   tp_call_close_channel (call);
 }
 
@@ -400,13 +392,12 @@ tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
   /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
    * has crashed. We want to close the channel if stream-engine has crashed.
    * */
-  empathy_debug (DEBUG_DOMAIN,
-                 "Watch SE: name='%s' SE running='%s' new_owner='%s'",
-                 name, priv->stream_engine_running ? "yes" : "no",
-                 new_owner ? new_owner : "none");
+  DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
+      name, priv->stream_engine_running ? "yes" : "no",
+      new_owner ? new_owner : "none");
   if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
     {
-      empathy_debug (DEBUG_DOMAIN, "Stream engine falled off the bus");
+      DEBUG ("Stream engine falled off the bus");
       tp_call_close_channel (call);
       return;
     }
@@ -424,7 +415,7 @@ tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
   guint handle;
   TpProxy *connection;
 
-  empathy_debug (DEBUG_DOMAIN, "Revving up the stream engine");
+  DEBUG ("Revving up the stream engine");
 
   priv->stream_engine = g_object_new (TP_TYPE_PROXY,
       "bus-name", STREAM_ENGINE_BUS_NAME,
@@ -514,7 +505,7 @@ tp_call_finalize (GObject *object)
 {
   EmpathyTpCallPriv *priv = GET_PRIV (object);
 
-  empathy_debug (DEBUG_DOMAIN, "Finalizing: %p", object);
+  DEBUG ("Finalizing: %p", object);
 
   g_slice_free (EmpathyTpCallStream, priv->audio);
   g_slice_free (EmpathyTpCallStream, priv->video);
@@ -677,7 +668,7 @@ empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
   g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
 
-  empathy_debug (DEBUG_DOMAIN, "Accepting incoming call");
+  DEBUG ("Accepting incoming call");
 
   self_contact = empathy_tp_group_get_self_contact (priv->group);
   empathy_tp_group_add_member (priv->group, self_contact, NULL);
@@ -694,8 +685,7 @@ empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
   g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
 
-  empathy_debug (DEBUG_DOMAIN,
-      "Requesting video stream direction - is_sending: %d", is_sending);
+  DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
 
   if (!priv->video->exists)
     {
@@ -724,7 +714,7 @@ empathy_tp_call_add_preview_video (EmpathyTpCall *call,
 
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
 
-  empathy_debug (DEBUG_DOMAIN, "Adding preview video");
+  DEBUG ("Adding preview video");
 
   emp_cli_stream_engine_call_add_preview_window (priv->stream_engine, -1,
       preview_video_socket_id,
@@ -741,7 +731,7 @@ empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
 
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
 
-  empathy_debug (DEBUG_DOMAIN, "Removing preview video");
+  DEBUG ("Removing preview video");
 
   emp_cli_stream_engine_call_remove_preview_window (priv->stream_engine, -1,
       preview_video_socket_id,
@@ -758,8 +748,7 @@ empathy_tp_call_add_output_video (EmpathyTpCall *call,
 
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
 
-  empathy_debug (DEBUG_DOMAIN, "Adding output video - socket: %d",
-      output_video_socket_id);
+  DEBUG ("Adding output video - socket: %d", output_video_socket_id);
 
   emp_cli_stream_engine_call_set_output_window (priv->stream_engine, -1,
       TP_PROXY (priv->channel)->object_path,
@@ -778,7 +767,7 @@ empathy_tp_call_set_output_volume (EmpathyTpCall *call,
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
   g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
 
-  empathy_debug (DEBUG_DOMAIN, "Setting output volume: %d", volume);
+  DEBUG ("Setting output volume: %d", volume);
 
   emp_cli_stream_engine_call_set_output_volume (priv->stream_engine, -1,
       TP_PROXY (priv->channel)->object_path,
@@ -796,7 +785,7 @@ empathy_tp_call_mute_output (EmpathyTpCall *call,
 
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
 
-  empathy_debug (DEBUG_DOMAIN, "Setting output mute: %d", is_muted);
+  DEBUG ("Setting output mute: %d", is_muted);
 
   emp_cli_stream_engine_call_mute_output (priv->stream_engine, -1,
       TP_PROXY (priv->channel)->object_path,
@@ -814,7 +803,7 @@ empathy_tp_call_mute_input (EmpathyTpCall *call,
 
   g_return_if_fail (EMPATHY_IS_TP_CALL (call));
 
-  empathy_debug (DEBUG_DOMAIN, "Setting input mute: %d", is_muted);
+  DEBUG ("Setting input mute: %d", is_muted);
 
   emp_cli_stream_engine_call_mute_input (priv->stream_engine, -1,
       TP_PROXY (priv->channel)->object_path,
index c53bd1b7267a2bfda5ad65e1763a03c6fc853ca0..61859c96e0d5ec4d5845713246c30b88c69f7b8d 100644 (file)
 #include "empathy-contact-factory.h"
 #include "empathy-contact-list.h"
 #include "empathy-marshal.h"
-#include "empathy-debug.h"
 #include "empathy-time.h"
 #include "empathy-utils.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CHAT
+#include "empathy-debug.h"
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv))
 
-#define DEBUG_DOMAIN "TpChat"
-
 struct _EmpathyTpChatPriv {
        EmpathyContactFactory *factory;
        EmpathyContact        *user;
@@ -98,7 +98,7 @@ tp_chat_invalidated_cb (TpProxy       *proxy,
                        gchar         *message,
                        EmpathyTpChat *chat)
 {
-       empathy_debug (DEBUG_DOMAIN, "Channel invalidated: %s", message);
+       DEBUG ("Channel invalidated: %s", message);
        g_signal_emit (chat, signals[DESTROY], 0);
 }
 
@@ -109,8 +109,7 @@ tp_chat_async_cb (TpChannel *proxy,
                  GObject *weak_object)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error %s: %s",
-                              user_data, error->message);
+               DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
        }
 }
 
@@ -309,7 +308,7 @@ tp_chat_sender_ready_notify_cb (EmpathyContact *contact,
                        break;
                }
 
-               empathy_debug (DEBUG_DOMAIN, "Queued message ready");
+               DEBUG ("Queued message ready");
                g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
                priv->message_queue = g_slist_remove (priv->message_queue,
                                                      message);
@@ -339,7 +338,7 @@ tp_chat_emit_or_queue_message (EmpathyTpChat  *chat,
        EmpathyContactReady  ready;
 
        if (priv->message_queue != NULL) {
-               empathy_debug (DEBUG_DOMAIN, "Message queue not empty");
+               DEBUG ("Message queue not empty");
                priv->message_queue = g_slist_append (priv->message_queue,
                                                      g_object_ref (message));
                return;
@@ -348,12 +347,12 @@ tp_chat_emit_or_queue_message (EmpathyTpChat  *chat,
        sender = empathy_message_get_sender (message);
        ready = empathy_contact_get_ready (sender);
        if (ready & EMPATHY_CONTACT_READY_NAME) {
-               empathy_debug (DEBUG_DOMAIN, "Message queue empty and sender ready");
+               DEBUG ("Message queue empty and sender ready");
                g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Sender not ready");
+       DEBUG ("Sender not ready");
        priv->message_queue = g_slist_append (priv->message_queue, 
                                              g_object_ref (message));
        g_signal_connect (sender, "notify::ready",
@@ -379,7 +378,7 @@ tp_chat_received_cb (TpChannel   *channel,
                return;
        }
  
-       empathy_debug (DEBUG_DOMAIN, "Message received: %s", message_body);
+       DEBUG ("Message received: %s", message_body);
 
        message = tp_chat_build_message (EMPATHY_TP_CHAT (chat),
                                         message_type,
@@ -416,7 +415,7 @@ tp_chat_sent_cb (TpChannel   *channel,
 {
        EmpathyMessage *message;
 
-       empathy_debug (DEBUG_DOMAIN, "Message sent: %s", message_body);
+       DEBUG ("Message sent: %s", message_body);
 
        message = tp_chat_build_message (EMPATHY_TP_CHAT (chat),
                                         message_type,
@@ -439,8 +438,7 @@ tp_chat_send_error_cb (TpChannel   *channel,
 {
        EmpathyMessage *message;
 
-       empathy_debug (DEBUG_DOMAIN, "Message sent error: %s (%d)",
-                      message_body, error_code);
+       DEBUG ("Message sent error: %s (%d)", message_body, error_code);
 
        message = tp_chat_build_message (EMPATHY_TP_CHAT (chat),
                                         message_type,
@@ -466,9 +464,8 @@ tp_chat_state_changed_cb (TpChannel *channel,
                                                           priv->account,
                                                           handle);
 
-       empathy_debug (DEBUG_DOMAIN, "Chat state changed for %s (%d): %d",
-                     empathy_contact_get_name (contact),
-                     handle, state);
+       DEBUG ("Chat state changed for %s (%d): %d",
+               empathy_contact_get_name (contact), handle, state);
 
        g_signal_emit (chat, signals[CHAT_STATE_CHANGED], 0, contact, state);
        g_object_unref (contact);
@@ -488,8 +485,7 @@ tp_chat_list_pending_messages_cb (TpChannel       *channel,
        priv->had_pending_messages = TRUE;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error listing pending messages: %s",
-                              error->message);
+               DEBUG ("Error listing pending messages: %s", error->message);
                return;
        }
 
@@ -517,7 +513,7 @@ tp_chat_list_pending_messages_cb (TpChannel       *channel,
                message_flags = g_value_get_uint (g_value_array_get_nth (message_struct, 4));
                message_body = g_value_get_string (g_value_array_get_nth (message_struct, 5));
 
-               empathy_debug (DEBUG_DOMAIN, "Message pending: %s", message_body);
+               DEBUG ("Message pending: %s", message_body);
 
                if (message_ids) {
                        g_array_append_val (message_ids, message_id);
@@ -572,9 +568,8 @@ tp_chat_property_flags_changed_cb (TpProxy         *proxy,
                        property = g_ptr_array_index (priv->properties, j);
                        if (property->id == id) {
                                property->flags = flags;
-                               empathy_debug (DEBUG_DOMAIN,
-                                              "property %s flags changed: %d",
-                                              property->name, property->flags);
+                               DEBUG ("property %s flags changed: %d",
+                                       property->name, property->flags);
                                break;
                        }
                }
@@ -613,8 +608,7 @@ tp_chat_properties_changed_cb (TpProxy         *proxy,
                                        property->value = tp_g_value_slice_dup (src_value);
                                }
 
-                               empathy_debug (DEBUG_DOMAIN, "property %s changed",
-                                              property->name);
+                               DEBUG ("property %s changed", property->name);
                                g_signal_emit (chat, signals[PROPERTY_CHANGED], 0,
                                               property->name, property->value);
                                break;
@@ -631,8 +625,7 @@ tp_chat_get_properties_cb (TpProxy         *proxy,
                           GObject         *chat)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error getting properties: %s",
-                              error->message);
+               DEBUG ("Error getting properties: %s", error->message);
                return;
        }
 
@@ -653,8 +646,7 @@ tp_chat_list_properties_cb (TpProxy         *proxy,
        priv->had_properties_list = TRUE;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error listing properties: %s",
-                              error->message);
+               DEBUG ("Error listing properties: %s", error->message);
                return;
        }
 
@@ -670,8 +662,8 @@ tp_chat_list_properties_cb (TpProxy         *proxy,
                property->name = g_value_dup_string (g_value_array_get_nth (prop_struct, 1));
                property->flags = g_value_get_uint (g_value_array_get_nth (prop_struct, 3));
 
-               empathy_debug (DEBUG_DOMAIN, "Adding property name=%s id=%d flags=%d",
-                              property->name, property->id, property->flags);
+               DEBUG ("Adding property name=%s id=%d flags=%d",
+                       property->name, property->id, property->flags);
                g_ptr_array_add (priv->properties, property);
                if (property->flags & TP_PROPERTY_FLAG_READ) {
                        g_array_append_val (ids, property->id);
@@ -722,7 +714,7 @@ empathy_tp_chat_set_property (EmpathyTpChat *chat,
                        properties = g_ptr_array_sized_new (1);
                        g_ptr_array_add (properties, prop);
 
-                       empathy_debug (DEBUG_DOMAIN, "Set property %s", name);
+                       DEBUG ("Set property %s", name);
                        tp_cli_properties_interface_call_set_properties (priv->channel, -1,
                                                                         properties,
                                                                         (tp_cli_properties_interface_callback_for_set_properties)
@@ -745,7 +737,7 @@ tp_chat_channel_ready_cb (EmpathyTpChat *chat)
        TpConnection      *connection;
        guint              handle, handle_type;
 
-       empathy_debug (DEBUG_DOMAIN, "Channel ready");
+       DEBUG ("Channel ready");
 
        g_object_get (priv->channel,
                      "connection", &connection,
@@ -846,7 +838,7 @@ tp_chat_finalize (GObject *object)
        guint              i;
 
        if (priv->acknowledge && priv->channel) {
-               empathy_debug (DEBUG_DOMAIN, "Closing channel...");
+               DEBUG ("Closing channel...");
                tp_cli_channel_call_close (priv->channel, -1,
                                           tp_chat_async_cb,
                                           "closing channel", NULL,
@@ -1191,7 +1183,7 @@ empathy_tp_chat_send (EmpathyTpChat *chat,
        message_body = empathy_message_get_body (message);
        message_type = empathy_message_get_type (message);
 
-       empathy_debug (DEBUG_DOMAIN, "Sending message: %s", message_body);
+       DEBUG ("Sending message: %s", message_body);
        tp_cli_channel_type_text_call_send (priv->channel, -1,
                                            message_type,
                                            message_body,
@@ -1209,7 +1201,7 @@ empathy_tp_chat_set_state (EmpathyTpChat      *chat,
        g_return_if_fail (EMPATHY_IS_TP_CHAT (chat));
        g_return_if_fail (priv->ready);
 
-       empathy_debug (DEBUG_DOMAIN, "Set state: %d", state);
+       DEBUG ("Set state: %d", state);
        tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1,
                                                                 state,
                                                                 tp_chat_async_cb,
index 25ebceb5f98b0dd2c66f18cd3269586267bf4e7a..eeb4ece71a0a0c1aa6b1faa4481e4cb9a8069674 100644 (file)
 
 #include "empathy-tp-contact-factory.h"
 #include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CONTACT
 #include "empathy-debug.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryPriv))
 
-#define DEBUG_DOMAIN "TpContactFactory"
-
 struct _EmpathyTpContactFactoryPriv {
        MissionControl *mc;
        McAccount      *account;
@@ -96,8 +96,7 @@ tp_contact_factory_weak_notify (gpointer data,
 {
        EmpathyTpContactFactoryPriv *priv = GET_PRIV (data);
 
-       empathy_debug (DEBUG_DOMAIN, "Remove finalized contact %p",
-                      where_the_object_was);
+       DEBUG ("Remove finalized contact %p", where_the_object_was);
 
        priv->contacts = g_list_remove (priv->contacts, where_the_object_was);
 }
@@ -140,11 +139,11 @@ tp_contact_factory_parse_presence_foreach (guint                    handle,
                              (GHFunc) tp_contact_factory_presences_table_foreach,
                              contact);
 
-       empathy_debug (DEBUG_DOMAIN, "Changing presence for contact %s (%d) to %s (%d)",
-                     empathy_contact_get_id (contact),
-                     handle,
-                     empathy_contact_get_presence_message (contact),
-                     empathy_contact_get_presence (contact));
+       DEBUG ("Changing presence for contact %s (%d) to %s (%d)",
+               empathy_contact_get_id (contact),
+               handle,
+               empathy_contact_get_presence_message (contact),
+               empathy_contact_get_presence (contact));
 }
 
 static void
@@ -155,8 +154,7 @@ tp_contact_factory_get_presence_cb (TpConnection *connection,
                                    GObject      *tp_factory)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error getting presence: %s",
-                             error->message);
+               DEBUG ("Error getting presence: %s", error->message);
                if (error->domain == TP_DBUS_ERRORS &&
                    error->code == TP_DBUS_ERROR_NO_INTERFACE) {
                        guint *handles = user_data;
@@ -204,8 +202,7 @@ tp_contact_factory_set_aliases_cb (TpConnection *connection,
                                   GObject      *tp_factory)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error setting alias: %s",
-                              error->message);
+               DEBUG ("Error setting alias: %s", error->message);
        }
 }
 
@@ -221,8 +218,7 @@ tp_contact_factory_request_aliases_cb (TpConnection *connection,
        const gchar **name;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error requesting aliases: %s",
-                             error->message);
+               DEBUG ("Error requesting aliases: %s", error->message);
 
                /* If we failed to get alias set it to NULL, like that if
                 * someone is waiting for the name to be ready it won't wait
@@ -251,10 +247,10 @@ tp_contact_factory_request_aliases_cb (TpConnection *connection,
                        continue;
                }
 
-               empathy_debug (DEBUG_DOMAIN, "Renaming contact %s (%d) to %s (request cb)",
-                              empathy_contact_get_id (contact),
-                              empathy_contact_get_handle (contact),
-                              *name);
+               DEBUG ("Renaming contact %s (%d) to %s (request cb)",
+                       empathy_contact_get_id (contact),
+                       empathy_contact_get_handle (contact),
+                       *name);
 
                empathy_contact_set_name (contact, *name);
 
@@ -287,9 +283,9 @@ tp_contact_factory_aliases_changed_cb (TpConnection    *connection,
                        continue;
                }
 
-               empathy_debug (DEBUG_DOMAIN, "Renaming contact %s (%d) to %s (changed cb)",
-                              empathy_contact_get_id (contact),
-                              handle, alias);
+               DEBUG ("Renaming contact %s (%d) to %s (changed cb)",
+                       empathy_contact_get_id (contact),
+                       handle, alias);
 
                empathy_contact_set_name (contact, alias);
        }
@@ -303,8 +299,7 @@ tp_contact_factory_set_avatar_cb (TpConnection *connection,
                                  GObject      *tp_factory)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error setting avatar: %s",
-                              error->message);
+               DEBUG ("Error setting avatar: %s", error->message);
        }
 }
 
@@ -315,8 +310,7 @@ tp_contact_factory_clear_avatar_cb (TpConnection *connection,
                                    GObject      *tp_factory)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error clearing avatar: %s",
-                              error->message);
+               DEBUG ("Error clearing avatar: %s", error->message);
        }
 }
 
@@ -338,9 +332,9 @@ tp_contact_factory_avatar_retrieved_cb (TpConnection *connection,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Avatar retrieved for contact %s (%d)",
-                      empathy_contact_get_id (contact),
-                      handle);
+       DEBUG ("Avatar retrieved for contact %s (%d)",
+               empathy_contact_get_id (contact),
+               handle);
 
        avatar = empathy_avatar_new (avatar_data->data,
                                     avatar_data->len,
@@ -358,8 +352,7 @@ tp_contact_factory_request_avatars_cb (TpConnection *connection,
                                       GObject      *tp_factory)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error requesting avatars: %s",
-                              error->message);
+               DEBUG ("Error requesting avatars: %s", error->message);
        }
 }
 
@@ -431,9 +424,7 @@ tp_contact_factory_get_known_avatar_tokens_cb (TpConnection *connection,
        TokensData data;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN,
-                              "Error getting known avatars tokens: %s",
-                              error->message);
+               DEBUG ("Error getting known avatars tokens: %s", error->message);
                return;
        }
 
@@ -443,9 +434,8 @@ tp_contact_factory_get_known_avatar_tokens_cb (TpConnection *connection,
                              tp_contact_factory_avatar_tokens_foreach,
                              &data);
 
-       empathy_debug (DEBUG_DOMAIN, "Got %d tokens, need to request %d avatars",
-                      g_hash_table_size (tokens),
-                      data.handles->len);
+       DEBUG ("Got %d tokens, need to request %d avatars",
+               g_hash_table_size (tokens), data.handles->len);
 
        /* Request needed avatars */
        if (data.handles->len > 0) {
@@ -475,8 +465,7 @@ tp_contact_factory_avatar_updated_cb (TpConnection *connection,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Need to request avatar for token %s",
-                      new_token);
+       DEBUG ("Need to request avatar for token %s", new_token);
 
        handles = g_array_new (FALSE, FALSE, sizeof (guint));
        g_array_append_val (handles, handle);
@@ -519,10 +508,10 @@ tp_contact_factory_update_capabilities (EmpathyTpContactFactory *tp_factory,
                }
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Changing capabilities for contact %s (%d) to %d",
-                      empathy_contact_get_id (contact),
-                      empathy_contact_get_handle (contact),
-                      capabilities);
+       DEBUG ("Changing capabilities for contact %s (%d) to %d",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               capabilities);
 
        empathy_contact_set_capabilities (contact, capabilities);
 }
@@ -538,8 +527,7 @@ tp_contact_factory_get_capabilities_cb (TpConnection    *connection,
        guint                    i;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error getting capabilities: %s",
-                              error->message);
+               DEBUG ("Error getting capabilities: %s", error->message);
                /* FIXME Should set the capabilities of the contacts for which this request
                 * originated to NONE */
                return;
@@ -662,8 +650,7 @@ tp_contact_factory_request_handles_cb (TpConnection *connection,
        guint  i = 0;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to request handles: %s",
-                              error->message);
+               DEBUG ("Failed to request handles: %s", error->message);
                return;
        }
 
@@ -692,8 +679,7 @@ tp_contact_factory_inspect_handles_cb (TpConnection  *connection,
        GList        *l;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to inspect handles: %s",
-                              error->message);
+               DEBUG ("Failed to inspect handles: %s", error->message);
                return;
        }
 
@@ -719,7 +705,7 @@ tp_contact_factory_connection_invalidated_cb (EmpathyTpContactFactory *tp_factor
 {
        EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
 
-       empathy_debug (DEBUG_DOMAIN, "Connection invalidated");
+       DEBUG ("Connection invalidated");
 
        g_object_unref (priv->connection);
        priv->connection = NULL;
@@ -748,12 +734,11 @@ tp_contact_factory_got_self_handle_cb (TpConnection *proxy,
        GList                       *id_needed_contacts = NULL;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get self handles: %s",
-                              error->message);
+               DEBUG ("Failed to get self handles: %s", error->message);
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Connection ready");
+       DEBUG ("Connection ready");
 
        empathy_contact_set_handle (priv->user, handle);
        priv->ready = TRUE;
@@ -907,9 +892,9 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory,
                           tp_factory);
        priv->contacts = g_list_prepend (priv->contacts, contact);
 
-       empathy_debug (DEBUG_DOMAIN, "Contact added: %s (%d)",
-                      empathy_contact_get_id (contact),
-                      empathy_contact_get_handle (contact));
+       DEBUG ("Contact added: %s (%d)",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact));
 }
 
 static void
@@ -919,8 +904,7 @@ tp_contact_factory_hold_handles_cb (TpConnection *connection,
                                    GObject      *tp_factory)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to hold handles: %s",
-                              error->message);
+               DEBUG ("Failed to hold handles: %s", error->message);
        }
 }
 
@@ -1093,9 +1077,9 @@ empathy_tp_contact_factory_set_alias (EmpathyTpContactFactory *tp_factory,
 
        handle = empathy_contact_get_handle (contact);
 
-       empathy_debug (DEBUG_DOMAIN, "Setting alias for contact %s (%d) to %s",
-                      empathy_contact_get_id (contact),
-                      handle, alias);
+       DEBUG ("Setting alias for contact %s (%d) to %s",
+               empathy_contact_get_id (contact),
+               handle, alias);
 
        new_alias = g_hash_table_new_full (g_direct_hash,
                                           g_direct_equal,
@@ -1133,8 +1117,8 @@ empathy_tp_contact_factory_set_avatar (EmpathyTpContactFactory *tp_factory,
                avatar.data = (gchar*) data;
                avatar.len = size;
 
-               empathy_debug (DEBUG_DOMAIN, "Setting avatar on account %s",
-                              mc_account_get_unique_name (priv->account));
+               DEBUG ("Setting avatar on account %s",
+                       mc_account_get_unique_name (priv->account));
 
                tp_cli_connection_interface_avatars_call_set_avatar (priv->connection,
                                                                     -1,
@@ -1144,8 +1128,8 @@ empathy_tp_contact_factory_set_avatar (EmpathyTpContactFactory *tp_factory,
                                                                     NULL, NULL,
                                                                     G_OBJECT (tp_factory));
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Clearing avatar on account %s",
-                              mc_account_get_unique_name (priv->account));
+               DEBUG ("Clearing avatar on account %s",
+                       mc_account_get_unique_name (priv->account));
 
                tp_cli_connection_interface_avatars_call_clear_avatar (priv->connection,
                                                                       -1,
@@ -1210,9 +1194,8 @@ tp_contact_factory_finalize (GObject *object)
        EmpathyTpContactFactoryPriv *priv = GET_PRIV (object);
        GList                       *l;
 
-       empathy_debug (DEBUG_DOMAIN, "Finalized: %p (%s)",
-                      object,
-                      mc_account_get_normalized_name (priv->account));
+       DEBUG ("Finalized: %p (%s)", object,
+               mc_account_get_normalized_name (priv->account));
 
        empathy_disconnect_account_status_changed (priv->token);
 
index 8b5c5610fa237c44820dec670ea14bfbfdffc724..b40042513c1dc931a3ac8a2b86bd30a643922988 100644 (file)
 #include "empathy-tp-contact-list.h"
 #include "empathy-contact-list.h"
 #include "empathy-tp-group.h"
-#include "empathy-debug.h"
 #include "empathy-utils.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CONTACT
+#include "empathy-debug.h"
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_TP_CONTACT_LIST, EmpathyTpContactListPriv))
 
-#define DEBUG_DOMAIN "TpContactList"
-
 struct _EmpathyTpContactListPriv {
        McAccount      *account;
        TpConnection   *connection;
@@ -88,8 +88,7 @@ tp_contact_list_group_destroy_cb (EmpathyTpGroup       *group,
 {
        EmpathyTpContactListPriv *priv = GET_PRIV (list);
 
-       empathy_debug (DEBUG_DOMAIN, "Group destroyed: %s",
-                      empathy_tp_group_get_name (group));
+       DEBUG ("Group destroyed: %s", empathy_tp_group_get_name (group));
 
        priv->groups = g_list_remove (priv->groups, group);
        g_object_unref (group);
@@ -121,10 +120,10 @@ tp_contact_list_group_member_added_cb (EmpathyTpGroup       *group,
 
        group_name = empathy_tp_group_get_name (group);
        if (!g_list_find_custom (*groups, group_name, (GCompareFunc) strcmp)) {
-               empathy_debug (DEBUG_DOMAIN, "Contact %s (%d) added to group %s",
-                              empathy_contact_get_id (contact),
-                              empathy_contact_get_handle (contact),
-                              group_name);
+               DEBUG ("Contact %s (%d) added to group %s",
+                       empathy_contact_get_id (contact),
+                       empathy_contact_get_handle (contact),
+                       group_name);
                *groups = g_list_prepend (*groups, g_strdup (group_name));
                g_signal_emit_by_name (list, "groups-changed", contact,
                                       group_name,
@@ -155,10 +154,10 @@ tp_contact_list_group_member_removed_cb (EmpathyTpGroup       *group,
 
        group_name = empathy_tp_group_get_name (group);
        if ((l = g_list_find_custom (*groups, group_name, (GCompareFunc) strcmp))) {
-               empathy_debug (DEBUG_DOMAIN, "Contact %s (%d) removed from group %s",
-                              empathy_contact_get_id (contact),
-                              empathy_contact_get_handle (contact),
-                              group_name);
+               DEBUG ("Contact %s (%d) removed from group %s",
+                       empathy_contact_get_id (contact),
+                       empathy_contact_get_handle (contact),
+                       group_name);
                *groups = g_list_delete_link (*groups, l);
                g_signal_emit_by_name (list, "groups-changed", contact,
                                       group_name,
@@ -240,10 +239,10 @@ tp_contact_list_added_cb (EmpathyTpGroup       *group,
        TpContactListType         list_type;
 
        list_type = tp_contact_list_get_type (list, group);
-       empathy_debug (DEBUG_DOMAIN, "Contact %s (%d) added to list type %d",
-                     empathy_contact_get_id (contact),
-                     empathy_contact_get_handle (contact),
-                     list_type);
+       DEBUG ("Contact %s (%d) added to list type %d",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               list_type);
 
        /* We now get the presence of that contact, add it to members */
        if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE &&
@@ -274,10 +273,10 @@ tp_contact_list_removed_cb (EmpathyTpGroup       *group,
        TpContactListType         list_type;
 
        list_type = tp_contact_list_get_type (list, group);
-       empathy_debug (DEBUG_DOMAIN, "Contact %s (%d) removed from list type %d",
-                     empathy_contact_get_id (contact),
-                     empathy_contact_get_handle (contact),
-                     list_type);
+       DEBUG ("Contact %s (%d) removed from list type %d",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               list_type);
 
        /* This contact refuses to send us his presence, remove from members. */
        if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE &&
@@ -312,10 +311,10 @@ tp_contact_list_pending_cb (EmpathyTpGroup       *group,
        TpContactListType         list_type;
 
        list_type = tp_contact_list_get_type (list, group);
-       empathy_debug (DEBUG_DOMAIN, "Contact %s (%d) pending in list type %d",
-                     empathy_contact_get_id (contact),
-                     empathy_contact_get_handle (contact),
-                     list_type);
+       DEBUG ("Contact %s (%d) pending in list type %d",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               list_type);
 
        /* We want this contact in our contact list but we don't get its 
         * presence yet. Add to members anyway. */
@@ -350,7 +349,7 @@ tp_contact_list_invalidated_cb (TpConnection         *connection,
        EmpathyTpContactListPriv *priv = GET_PRIV (list);
        GList                    *l;
 
-       empathy_debug (DEBUG_DOMAIN, "Connection invalidated");
+       DEBUG ("Connection invalidated");
 
        /* Remove all contacts */
        for (l = priv->members; l; l = l->next) {
@@ -455,15 +454,12 @@ tp_contact_list_add_channel (EmpathyTpContactList *list,
                        }
                        g_list_free (contacts);
                } else {
-                       empathy_debug (DEBUG_DOMAIN,
-                                     "Type of contact list channel unknown "
-                                     "or aleady have that list: %s",
-                                     empathy_tp_group_get_name (group));
+                       DEBUG ("Type of contact list channel unknown or aleady "
+                               "have that list: %s",
+                               empathy_tp_group_get_name (group));
                        goto OUT;
                }
-               empathy_debug (DEBUG_DOMAIN,
-                              "New contact list channel of type: %d",
-                              list_type);
+               DEBUG ("New contact list channel of type: %d", list_type);
 
                g_signal_connect (group, "member-added",
                                  G_CALLBACK (tp_contact_list_added_cb),
@@ -492,8 +488,7 @@ tp_contact_list_add_channel (EmpathyTpContactList *list,
                        goto OUT;
                }
 
-               empathy_debug (DEBUG_DOMAIN, "New server-side group channel: %s",
-                              group_name);
+               DEBUG ("New server-side group channel: %s", group_name);
 
                priv->groups = g_list_prepend (priv->groups, g_object_ref (group));
 
@@ -516,9 +511,8 @@ tp_contact_list_add_channel (EmpathyTpContactList *list,
                }
                g_list_free (contacts);
        } else {
-               empathy_debug (DEBUG_DOMAIN,
-                              "Unknown handle type (%d) for contact list channel",
-                              handle_type);
+               DEBUG ("Unknown handle type (%d) for contact list channel",
+                       handle_type);
        }
 
 OUT:
@@ -555,9 +549,8 @@ tp_contact_list_list_channels_cb (TpConnection    *connection,
        guint                     i;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Failed to get list of open channels: %s",
-                             error ? error->message : "No error given");
+               DEBUG ("Failed to get list of open channels: %s",
+                       error ? error->message : "No error given");
                return;
        }
 
@@ -591,7 +584,7 @@ tp_contact_list_finalize (GObject *object)
        list = EMPATHY_TP_CONTACT_LIST (object);
        priv = GET_PRIV (list);
 
-       empathy_debug (DEBUG_DOMAIN, "finalize: %p", object);
+       DEBUG ("finalize: %p", object);
 
        if (priv->subscribe) {
                g_object_unref (priv->subscribe);
@@ -893,16 +886,15 @@ tp_contact_list_get_group (EmpathyTpContactList *list,
                return tp_group;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "creating new group: %s", group);
+       DEBUG ("creating new group: %s", group);
 
        if (!tp_cli_connection_run_request_handles (priv->connection, -1,
                                                    TP_HANDLE_TYPE_GROUP,
                                                    names,
                                                    &handles,
                                                    &error, NULL)) {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Failed to RequestHandles: %s",
-                             error ? error->message : "No error given");
+               DEBUG ("Failed to RequestHandles: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
                return NULL;
        }
@@ -916,9 +908,8 @@ tp_contact_list_get_group (EmpathyTpContactList *list,
                                                    TRUE,
                                                    &object_path,
                                                    &error, NULL)) {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Failed to RequestChannel: %s",
-                             error ? error->message : "No error given");
+               DEBUG ("Failed to RequestChannel: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
                return NULL;
        }
@@ -981,7 +972,7 @@ tp_contact_list_rename_group (EmpathyContactList *list,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "rename group %s to %s", old_group, new_group);
+       DEBUG ("rename group %s to %s", old_group, new_group);
 
        /* Remove all members from the old group */
        members = empathy_tp_group_get_members (tp_group);
@@ -1013,7 +1004,7 @@ tp_contact_list_remove_group (EmpathyContactList *list,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "remove group %s", group);
+       DEBUG ("remove group %s", group);
 
        /* Remove all members of the group */
        members = empathy_tp_group_get_members (tp_group);
index f5cbb70815dfde87fe3e472cab44ff6b5516d63d..62212aaadccd666f13af5387c6ca920f94da3477 100644 (file)
 
 #include "empathy-tp-group.h"
 #include "empathy-contact-factory.h"
-#include "empathy-debug.h"
 #include "empathy-utils.h"
 #include "empathy-marshal.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_TP
+#include "empathy-debug.h"
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupPriv))
 
-#define DEBUG_DOMAIN "TpGroup"
-
 struct _EmpathyTpGroupPriv {
        TpChannel             *channel;
        gboolean               ready;
@@ -210,18 +210,17 @@ tp_group_update_members (EmpathyTpGroup *group,
 
        actor_contact = tp_group_get_contact (group, actor);
 
-       empathy_debug (DEBUG_DOMAIN, "Members changed for list %s:\n"
-                                    "  added-len=%d, current-len=%d\n"
-                                    "  removed-len=%d\n"
-                                    "  local-pending-len=%d, current-len=%d\n"
-                                    "  remote-pending-len=%d, current-len=%d",
-                      priv->group_name,
-                      added ? added->len : 0, g_list_length (priv->members),
-                      removed ? removed->len : 0,
-                      local_pending ? local_pending->len : 0,
-                      g_list_length (priv->local_pendings),
-                      remote_pending ? remote_pending->len : 0,
-                      g_list_length (priv->remote_pendings));
+       DEBUG ("Members changed for list %s:\n"
+               "  added-len=%d, current-len=%d\n"
+               "  removed-len=%d\n"
+               "  local-pending-len=%d, current-len=%d\n"
+               "  remote-pending-len=%d, current-len=%d",
+               priv->group_name, added ? added->len : 0,
+               g_list_length (priv->members), removed ? removed->len : 0,
+               local_pending ? local_pending->len : 0,
+               g_list_length (priv->local_pendings),
+               remote_pending ? remote_pending->len : 0,
+               g_list_length (priv->remote_pendings));
 
        /* Contacts added */
        contacts = tp_group_get_contacts (group, added);
@@ -293,14 +292,13 @@ tp_group_update_members (EmpathyTpGroup *group,
                g_object_unref (actor_contact);
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Members changed done for list %s:\n"
-                                    "  members-len=%d\n"
-                                    "  local-pendings-len=%d\n"
-                                    "  remote-pendings-len=%d",
-                      priv->group_name,
-                      g_list_length (priv->members),
-                      g_list_length (priv->local_pendings),
-                      g_list_length (priv->remote_pendings));
+       DEBUG ("Members changed done for list %s:\n"
+               "  members-len=%d\n"
+               "  local-pendings-len=%d\n"
+               "  remote-pendings-len=%d",
+               priv->group_name, g_list_length (priv->members),
+               g_list_length (priv->local_pendings),
+               g_list_length (priv->remote_pendings));
 }
 
 static void
@@ -335,8 +333,7 @@ tp_group_get_members_cb (TpChannel    *channel,
        EmpathyTpGroupPriv *priv = GET_PRIV (group);
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get members: %s",
-                              error->message);
+               DEBUG ("Failed to get members: %s", error->message);
                return;
        }
 
@@ -349,7 +346,7 @@ tp_group_get_members_cb (TpChannel    *channel,
                                 0,       /* actor */
                                 0);      /* reason */
 
-       empathy_debug (DEBUG_DOMAIN, "Ready");
+       DEBUG ("Ready");
        priv->ready = TRUE;
        g_object_notify (group, "ready");
 }
@@ -365,8 +362,7 @@ tp_group_get_local_pending_cb (TpChannel        *channel,
        guint   i = 0;
        
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get local pendings: %s",
-                              error->message);
+               DEBUG ("Failed to get local pendings: %s", error->message);
                return;
        }
 
@@ -407,8 +403,7 @@ tp_group_get_remote_pending_cb (TpChannel    *channel,
                                GObject      *group)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get remote pendings: %s",
-                              error->message);
+               DEBUG ("Failed to get remote pendings: %s", error->message);
                return;
        }
 
@@ -432,8 +427,7 @@ tp_group_inspect_handles_cb (TpConnection  *connection,
        EmpathyTpGroupPriv *priv = GET_PRIV (group);
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to inspect channel handle: %s",
-                              error->message);
+               DEBUG ("Failed to inspect channel handle: %s", error->message);
                return;
        }
 
@@ -447,7 +441,7 @@ tp_group_invalidated_cb (TpProxy        *proxy,
                         gchar          *message,
                         EmpathyTpGroup *group)
 {
-       empathy_debug (DEBUG_DOMAIN, "Channel invalidated: %s", message);
+       DEBUG ("Channel invalidated: %s", message);
        g_signal_emit (group, signals[DESTROY], 0);
 }
 
@@ -465,8 +459,7 @@ tp_group_get_self_handle_cb (TpChannel    *proxy,
        GArray             *handles;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get self handle: %s",
-                              error->message);
+               DEBUG ("Failed to get self handle: %s", error->message);
                return;
        }
 
@@ -546,7 +539,7 @@ tp_group_finalize (GObject *object)
        EmpathyTpGroupPriv      *priv = GET_PRIV (object);
        EmpathyTpContactFactory *tp_factory;
 
-       empathy_debug (DEBUG_DOMAIN, "finalize: %p", object);
+       DEBUG ("finalize: %p", object);
 
        tp_factory = empathy_contact_factory_get_tp_factory (priv->factory, priv->account);
        g_signal_handlers_disconnect_by_func (tp_factory, tp_group_factory_ready_cb, object);
@@ -742,7 +735,7 @@ tp_group_async_cb (TpChannel    *channel,
        const gchar *msg = user_data;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "%s: %s", msg, error->message);
+               DEBUG ("%s: %s", msg, error->message);
        }
 }
 
index 4193685dc994236cb9dc9094f63e4087bb126326..c88580a9394ea7d9305ee2370e01f3bec59d9022 100644 (file)
 #include "empathy-utils.h"
 #include "empathy-debug.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_TP
+#include "empathy-debug.h"
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_TP_ROOMLIST, EmpathyTpRoomlistPriv))
 
-#define DEBUG_DOMAIN "TpRoomlist"
-
 struct _EmpathyTpRoomlistPriv {
        TpConnection *connection;
        TpChannel    *channel;
@@ -72,7 +73,7 @@ tp_roomlist_listing_cb (TpChannel *channel,
 {
        EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
 
-       empathy_debug (DEBUG_DOMAIN, "Listing: %s", listing ? "Yes" : "No");
+       DEBUG ("Listing: %s", listing ? "Yes" : "No");
        priv->is_listing = listing;
        g_object_notify (list, "is-listing");
 }
@@ -139,8 +140,7 @@ tp_roomlist_get_listing_rooms_cb (TpChannel    *channel,
        EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error geting listing rooms: %s",
-                              error->message);
+               DEBUG ("Error geting listing rooms: %s", error->message);
                return;
        }
 
@@ -155,7 +155,7 @@ tp_roomlist_invalidated_cb (TpChannel         *channel,
                            gchar             *message,
                            EmpathyTpRoomlist *list)
 {
-       empathy_debug (DEBUG_DOMAIN, "Channel invalidated: %s", message);
+       DEBUG ("Channel invalidated: %s", message);
        g_signal_emit (list, signals[DESTROY], 0);
 }
 
@@ -169,8 +169,7 @@ tp_roomlist_request_channel_cb (TpConnection *connection,
        EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error requesting channel: %s",
-                              error->message);
+               DEBUG ("Error requesting channel: %s", error->message);
                return;
        }
 
@@ -207,7 +206,7 @@ tp_roomlist_finalize (GObject *object)
        EmpathyTpRoomlistPriv *priv = GET_PRIV (object);
 
        if (priv->channel) {
-               empathy_debug (DEBUG_DOMAIN, "Closing channel...");
+               DEBUG ("Closing channel...");
                g_signal_handlers_disconnect_by_func (priv->channel,
                                                      tp_roomlist_invalidated_cb,
                                                      object);
index 38f00cbdaee0d8ebe035da12c5f99914d5b86e06..b1e6676ffdaf524301b8284cfcabb8d05e45646a 100644 (file)
 #include <telepathy-glib/util.h>
 
 #include "empathy-contact-factory.h"
-#include "empathy-debug.h"
 #include "empathy-enum-types.h"
 #include "empathy-tp-tube.h"
 #include "empathy-utils.h"
 
-#define DEBUG_DOMAIN "TpTube"
+#define DEBUG_FLAG EMPATHY_DEBUG_TP
+#include "empathy-debug.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_TP_TUBE, \
     EmpathyTpTubePriv))
@@ -86,7 +86,7 @@ tp_tube_state_changed_cb (TpChannel *channel,
   if (id != priv->id)
       return;
 
-  empathy_debug (DEBUG_DOMAIN, "Tube state changed");
+  DEBUG ("Tube state changed");
 
   priv->state = state;
   g_object_notify (tube, "state");
@@ -99,7 +99,7 @@ tp_tube_invalidated_cb (TpChannel     *channel,
                         gchar         *message,
                         EmpathyTpTube *tube)
 {
-  empathy_debug (DEBUG_DOMAIN, "Channel invalidated: %s", message);
+  DEBUG ("Channel invalidated: %s", message);
   g_signal_emit (tube, signals[DESTROY], 0);
 }
 
@@ -114,7 +114,7 @@ tp_tube_closed_cb (TpChannel *channel,
   if (id != priv->id)
       return;
 
-  empathy_debug (DEBUG_DOMAIN, "Tube closed");
+  DEBUG ("Tube closed");
   g_signal_emit (tube, signals[DESTROY], 0);
 }
 
@@ -125,7 +125,7 @@ tp_tube_async_cb (TpChannel *channel,
                   GObject *tube)
 {
   if (error)
-      empathy_debug (DEBUG_DOMAIN, "Error %s: %s", user_data, error->message);
+      DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
 }
 
 static void
@@ -217,8 +217,7 @@ tp_tube_constructor (GType type,
   if (!tp_cli_channel_type_tubes_run_list_tubes (priv->channel, -1, &tubes,
       &error, NULL))
     {
-      empathy_debug (DEBUG_DOMAIN, "Couldn't list tubes: %s",
-          error->message);
+      DEBUG ("Couldn't list tubes: %s", error->message);
       g_clear_error (&error);
       return self;
     }
@@ -267,7 +266,7 @@ tp_tube_finalize (GObject *object)
 {
   EmpathyTpTubePriv *priv = GET_PRIV (object);
 
-  empathy_debug (DEBUG_DOMAIN, "Finalizing: %p", object);
+  DEBUG ("Finalizing: %p", object);
 
   if (priv->channel)
     {
@@ -397,13 +396,13 @@ empathy_tp_tube_new_stream_tube (EmpathyContact *contact,
       TP_IFACE_CHANNEL_TYPE_TUBES, TP_HANDLE_TYPE_CONTACT,
       empathy_contact_get_handle (contact), FALSE, &object_path, &error, NULL))
     {
-      empathy_debug (DEBUG_DOMAIN, "Error requesting channel: %s", error->message);
+      DEBUG ("Error requesting channel: %s", error->message);
       g_clear_error (&error);
       g_object_unref (connection);
       return NULL;
     }
 
-  empathy_debug (DEBUG_DOMAIN, "Offering a new stream tube");
+  DEBUG ("Offering a new stream tube");
 
   channel = tp_channel_new (connection, object_path,
       TP_IFACE_CHANNEL_TYPE_TUBES, TP_HANDLE_TYPE_CONTACT,
@@ -421,12 +420,12 @@ empathy_tp_tube_new_stream_tube (EmpathyContact *contact,
         service, params, type, address,
         TP_SOCKET_ACCESS_CONTROL_LOCALHOST, control_param, &id, &error, NULL))
     {
-      empathy_debug (DEBUG_DOMAIN, "Couldn't offer tube: %s", error->message);
+      DEBUG ("Couldn't offer tube: %s", error->message);
       g_clear_error (&error);
       goto OUT;
     }
 
-  empathy_debug (DEBUG_DOMAIN, "Stream tube id=%d offered", id);
+  DEBUG ("Stream tube id=%d offered", id);
 
   tube = empathy_tp_tube_new (channel, id);
 
@@ -449,7 +448,7 @@ tp_tube_accept_stream_cb (TpChannel *proxy,
                           GObject *weak_object)
 {
   if (error)
-      empathy_debug (DEBUG_DOMAIN, "Error accepting tube: %s", error->message);
+      DEBUG ("Error accepting tube: %s", error->message);
 }
 
 void
@@ -461,7 +460,7 @@ empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube,
 
   g_return_if_fail (EMPATHY_IS_TP_TUBE (tube));
 
-  empathy_debug (DEBUG_DOMAIN, "Accepting stream tube - id: %d", priv->id);
+  DEBUG ("Accepting stream tube - id: %d", priv->id);
 
   control_param = tp_g_value_slice_new (G_TYPE_STRING);
   tp_cli_channel_type_tubes_call_accept_stream_tube (priv->channel, -1, priv->id,
@@ -483,14 +482,13 @@ empathy_tp_tube_get_socket (EmpathyTpTube *tube,
 
   g_return_if_fail (EMPATHY_IS_TP_TUBE (tube));
 
-  empathy_debug (DEBUG_DOMAIN, "Getting stream tube socket address");
+  DEBUG ("Getting stream tube socket address");
 
   address = g_slice_new0 (GValue);
   if (!tp_cli_channel_type_tubes_run_get_stream_tube_socket_address (priv->channel,
       -1, priv->id, &address_type, &address, &error, NULL))
     {
-      empathy_debug (DEBUG_DOMAIN, "Couldn't get socket address: %s",
-          error->message);
+      DEBUG ("Couldn't get socket address: %s", error->message);
       g_clear_error (&error);
       return;
     }
index 3e363837f5577414a6b79eb4d1cd74bcbc7fc192..2bbaea18c4a3b6be55c60f6b2850a87edd70855f 100644 (file)
 
 #include <extensions/extensions.h>
 
-#include "empathy-debug.h"
 #include "empathy-tp-tube.h"
 #include "empathy-tube-handler.h"
 
-#define DEBUG_DOMAIN "TubeHandler"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
 
 static void empathy_tube_handler_iface_init (EmpSvcTubeHandlerClass *klass);
 
@@ -71,7 +71,7 @@ tube_handler_handle_tube_idle_cb (gpointer data)
   EmpathyTpTube *tube;
   static TpDBusDaemon *daemon = NULL;
 
-  empathy_debug (DEBUG_DOMAIN, "New tube to be handled id=%d", idle_data->id);
+  DEBUG ("New tube to be handled id=%d", idle_data->id);
 
   if (!daemon)
     daemon = tp_dbus_daemon_new (tp_get_bus ());
@@ -169,7 +169,7 @@ empathy_tube_handler_new (TpTubeType type, const gchar *service)
       G_TYPE_STRING, bus_name, G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE,
       G_TYPE_INVALID, G_TYPE_UINT, &result, G_TYPE_INVALID))
     {
-      empathy_debug (DEBUG_DOMAIN, "Failed to request name: %s",
+      DEBUG ("Failed to request name: %s",
           error ? error->message : "No error given");
       g_clear_error (&error);
       goto OUT;
index 8f5c72df5a2d515eeaef4e94b1c77c969960b2f4..fe6a787bb3395326bc2096f824cd7ca451994a6e 100644 (file)
 #include <telepathy-glib/channel.h>
 #include <telepathy-glib/dbus.h>
 
-#include "empathy-debug.h"
 #include "empathy-utils.h"
 #include "empathy-contact-factory.h"
 #include "empathy-contact-manager.h"
 #include "empathy-tp-group.h"
 
-#define DEBUG_DOMAIN "Utils"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
 
 static void regex_init (void);
 
@@ -151,9 +151,7 @@ empathy_regex_match (EmpathyRegExType  type,
        }
 
        if (type != EMPATHY_REGEX_ALL) {
-               empathy_debug (DEBUG_DOMAIN,
-                             "Found %d matches for regex type:%d",
-                             num_matches, type);
+               DEBUG ("Found %d matches for regex type:%d", num_matches, type);
                return num_matches;
        }
 
@@ -175,9 +173,7 @@ empathy_regex_match (EmpathyRegExType  type,
                }
        }
 
-       empathy_debug (DEBUG_DOMAIN,
-                     "Found %d matches for ALL regex types",
-                     num_matches);
+       DEBUG ("Found %d matches for ALL regex types", num_matches);
 
        return num_matches;
 }
@@ -222,7 +218,7 @@ empathy_xml_validate (xmlDoc      *doc,
                g_free (path);
                path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
        }
-       empathy_debug (DEBUG_DOMAIN, "Loading dtd file %s", path);
+       DEBUG ("Loading dtd file %s", path);
 
        /* The list of valid chars is taken from libxml. */
        escaped = xmlURIEscapeStr (path, ":@&=+$,/?;");
@@ -373,9 +369,8 @@ empathy_call_with_contact (EmpathyContact *contact)
                                                    &object_path,
                                                    &error,
                                                    NULL)) {
-               empathy_debug (DEBUG_DOMAIN, 
-                             "Couldn't request channel: %s",
-                             error ? error->message : "No error given");
+               DEBUG ("Couldn't request channel: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
                g_object_unref (connection);
                return;
@@ -562,7 +557,7 @@ static void
 run_until_ready_cb (RunUntilReadyData *data)
 {
        if (!data->func || data->func (data->object, data->user_data)) {
-               empathy_debug (DEBUG_DOMAIN, "Object %p is ready", data->object);
+               DEBUG ("Object %p is ready", data->object);
                g_main_loop_quit (data->loop);
        }
 }
@@ -595,8 +590,7 @@ empathy_run_until_ready_full (gpointer                  object,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Starting run until ready for object %p",
-                      object);
+       DEBUG ("Starting run until ready for object %p", object);
 
        data.func = func;
        data.user_data = user_data;
index ad0952891dc7b03695ea6687bdc3808a1ed93d69..24d3e07cf0ad17ebe2a9a72b24bd92831d41322b 100644 (file)
@@ -39,7 +39,6 @@
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-contact-manager.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-contact-list-view.h>
@@ -49,7 +48,8 @@
 
 #include "megaphone-applet.h"
 
-#define DEBUG_DOMAIN "MegaphoneApplet"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MEGAPHONE_TYPE_APPLET, MegaphoneAppletPriv))
 
@@ -268,7 +268,7 @@ megaphone_applet_set_contact (MegaphoneApplet *applet,
        McAccount           *account = NULL;
        gchar              **strv = NULL;
 
-       empathy_debug (DEBUG_DOMAIN, "Setting new contact %s", str);
+       DEBUG ("Setting new contact %s", str);
 
        /* Release old contact, if any */
        if (priv->contact) {
@@ -442,9 +442,9 @@ megaphone_applet_button_press_event_cb (GtkWidget       *widget,
                return TRUE;
        }
        
-       empathy_debug (DEBUG_DOMAIN, "Requesting text channel for contact %s (%d)",
-                      empathy_contact_get_id (priv->contact),
-                      empathy_contact_get_handle (priv->contact));
+       DEBUG ("Requesting text channel for contact %s (%d)",
+               empathy_contact_get_id (priv->contact),
+               empathy_contact_get_handle (priv->contact));
 
        mc = empathy_mission_control_new ();
        mission_control_request_channel (mc,
@@ -492,7 +492,7 @@ megaphone_applet_gconf_notify_cb (GConfClient     *client,
 
        key = gconf_entry_get_key (entry);
        value = gconf_entry_get_value (entry);
-       empathy_debug (DEBUG_DOMAIN, "GConf notification for key '%s'", key);
+       DEBUG ("GConf notification for key '%s'", key);
 
        if (value && g_str_has_suffix (key, "/contact_id")) {
                megaphone_applet_set_contact (applet,
@@ -514,7 +514,7 @@ megaphone_applet_factory (PanelApplet *applet,
                return FALSE;
        }
        
-       empathy_debug (DEBUG_DOMAIN, "Starting up new instance!");
+       DEBUG ("Starting up new instance!");
 
        /* Set up the right-click menu */
        panel_applet_setup_menu_from_file (applet,
index a722461c438ffa7e51208a67a8bc8f768161ae71..b45b06babb1a5259cea5045f342f1d049b416623 100644 (file)
 
 ;; Enumerations and flags ...
 
+(define-flags DebugFlags
+  (in-module "Empathy")
+  (c-name "EmpathyDebugFlags")
+  (gtype-id "EMPATHY_TYPE_DEBUG_FLAGS")
+  (values
+    '("tp" "EMPATHY_DEBUG_TP")
+    '("chat" "EMPATHY_DEBUG_CHAT")
+    '("contact" "EMPATHY_DEBUG_CONTACT")
+    '("account" "EMPATHY_DEBUG_ACCOUNT")
+    '("irc" "EMPATHY_DEBUG_IRC")
+    '("filter" "EMPATHY_DEBUG_FILTER")
+    '("other" "EMPATHY_DEBUG_OTHER")
+  )
+)
+
 (define-enum RegExType
   (in-module "Empathy")
   (c-name "EmpathyRegExType")
 
 ;; From empathy-debug.h
 
-(define-function empathy_debug_impl
-  (c-name "empathy_debug_impl")
+(define-function empathy_debug_flag_is_set
+  (c-name "empathy_debug_flag_is_set")
+  (return-type "gboolean")
+  (parameters
+    '("EmpathyDebugFlags" "flag")
+  )
+)
+
+(define-function empathy_debug
+  (c-name "empathy_debug")
   (return-type "none")
   (parameters
-    '("const-gchar*" "domain")
-    '("const-gchar*" "msg")
+    '("EmpathyDebugFlags" "flag")
+    '("const-gchar*" "format")
   )
   (varargs #t)
 )
 
-(define-function empathy_debug_set_log_file_from_env
-  (c-name "empathy_debug_set_log_file_from_env")
+(define-function empathy_debug_set_flags
+  (c-name "empathy_debug_set_flags")
   (return-type "none")
+  (parameters
+    '("const-gchar*" "flags_string")
+  )
 )
 
 
index 604c959cddc1d49a2d4d1053f4d60f264ee0e209..f0ea3b096ed1646d9e68ae1a62778566f20952e2 100644 (file)
   (c-name "empathy_chat_correct_word")
   (return-type "none")
   (parameters
-    '("GtkTextIter" "start")
-    '("GtkTextIter" "end")
+    '("GtkTextIter*" "start")
+    '("GtkTextIter*" "end")
     '("const-gchar*" "new_word")
   )
 )
   (return-type "none")
   (parameters
     '("EmpathyChat*" "chat")
-    '("GtkTextIter" "start")
-    '("GtkTextIter" "end")
+    '("GtkTextIter*" "start")
+    '("GtkTextIter*" "end")
     '("const-gchar*" "word")
   )
 )
index 38b31fd5804afe12868a6167274ca5d34e8d2513..65ede78ac7d8228490769c6c827a7d046443417a 100644 (file)
@@ -28,6 +28,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+#include <libempathy/empathy-debug.h>
 #include <libempathy-gtk/empathy-accounts-dialog.h>
 
 static void
@@ -44,6 +45,12 @@ main (int argc, char *argv[])
 
        gtk_init (&argc, &argv);
 
+       if (g_getenv ("EMPATHY_TIMING") != NULL) {
+               g_log_set_default_handler (tp_debug_timestamped_log_handler, NULL);
+       }
+       empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG"));
+       tp_debug_divert_messages (g_getenv ("EMPATHY_LOGFILE"));
+
        gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                           PKGDATADIR G_DIR_SEPARATOR_S "icons");
        dialog = empathy_accounts_dialog_show (NULL);
index b0fc66a55e71d024ed3ab83aeeb449c8430c2543..e8ae0a8b04710ab066d6e3872f932c96fbf697ca 100644 (file)
 
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-tp-call.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 
 #include "empathy-call-window.h"
 
-#define DEBUG_DOMAIN "CallWindow"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 typedef struct 
 {
@@ -98,7 +98,7 @@ call_window_update_timer (gpointer data)
 static void
 call_window_stop_timeout (EmpathyCallWindow *window)
 {
-  empathy_debug (DEBUG_DOMAIN, "Timer stopped");
+  DEBUG ("Timer stopped");
 
   if (window->timeout_event_id)
     {
@@ -111,8 +111,7 @@ static void
 call_window_set_output_video_is_drawing (EmpathyCallWindow *window,
                                          gboolean is_drawing)
 {
-  empathy_debug (DEBUG_DOMAIN,
-      "Setting output video is drawing - %d", is_drawing);
+  DEBUG ("Setting output video is drawing - %d", is_drawing);
 
   if (is_drawing && !window->is_drawing)
     {
@@ -162,12 +161,12 @@ call_window_socket_realized_cb (GtkWidget *widget,
 {
   if (widget == window->preview_video_socket)
     {
-      empathy_debug (DEBUG_DOMAIN, "Preview socket realized");
+      DEBUG ("Preview socket realized");
       empathy_tp_call_add_preview_video (window->call,
           gtk_socket_get_id (GTK_SOCKET (window->preview_video_socket)));
     }
   else
-      empathy_debug (DEBUG_DOMAIN, "Output socket realized");
+      DEBUG ("Output socket realized");
 }
 
 static void
@@ -179,7 +178,7 @@ call_window_video_button_toggled_cb (GtkWidget *button,
 
   is_sending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
-  empathy_debug (DEBUG_DOMAIN, "Send video toggled - %d", is_sending);
+  DEBUG ("Send video toggled - %d", is_sending);
 
   g_object_get (window->call, "status", &status, NULL);
   if (status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
@@ -190,7 +189,7 @@ static void
 call_window_hang_up_button_clicked_cb (GtkWidget *widget,
                                        EmpathyCallWindow *window)
 {
-  empathy_debug (DEBUG_DOMAIN, "Call clicked, end call");
+  DEBUG ("Call clicked, end call");
   call_window_finalize (window);
 }
 
@@ -238,7 +237,7 @@ call_window_delete_event_cb (GtkWidget *widget,
   gint result;
   guint status = EMPATHY_TP_CALL_STATUS_CLOSED;
 
-  empathy_debug (DEBUG_DOMAIN, "Delete event occurred");
+  DEBUG ("Delete event occurred");
 
   if (window->call)
       g_object_get (window->call, "status", &status, NULL);
@@ -349,7 +348,7 @@ call_window_update (EmpathyCallWindow *window)
   else
       stream_state = audio_stream->state;
 
-  empathy_debug (DEBUG_DOMAIN, "Status changed - status: %d, stream state: %d, "
+  DEBUG ("Status changed - status: %d, stream state: %d, "
       "is-incoming: %d video-stream direction: %d",
       window->status, stream_state, is_incoming, video_stream->direction);
 
index 0d4baef5793cec3af25e2bb0e15f533ae56d595d..82dfdd6622c00a4347cd40430cc399b88fb9c729 100644 (file)
@@ -40,7 +40,6 @@
 #include <libempathy/empathy-contact-factory.h>
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-message.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-images.h>
 #include "empathy-chat-window.h"
 #include "empathy-about-dialog.h"
 
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv))
+#define DEBUG_FLAG EMPATHY_DEBUG_CHAT
+#include <libempathy/empathy-debug.h>
 
-#define DEBUG_DOMAIN "ChatWindow"
+#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv))
 
 struct _EmpathyChatWindowPriv {
        EmpathyChat *current_chat;
@@ -297,7 +297,7 @@ chat_window_update (EmpathyChatWindow *window)
        name = chat_window_get_chat_name (priv->current_chat);
        n_chats = g_list_length (priv->chats);
 
-       empathy_debug (DEBUG_DOMAIN, "Update window");
+       DEBUG ("Update window");
 
        /* Update menu */
        gtk_widget_set_sensitive (priv->menu_tabs_next, !last_page);
@@ -351,8 +351,8 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        subject = empathy_chat_get_subject (chat);
        remote_contact = empathy_chat_get_remote_contact (chat);
 
-       empathy_debug (DEBUG_DOMAIN, "Updating chat tab, name=%s, subject=%s, "
-                      "remote_contact=%p", name, subject, remote_contact);
+       DEBUG ("Updating chat tab, name=%s, subject=%s, remote_contact=%p",
+               name, subject, remote_contact);
 
        /* Update tab image */
        if (g_list_find (priv->chats_new_msg, chat)) {
@@ -713,7 +713,7 @@ chat_window_delete_event_cb (GtkWidget        *dialog,
 
        priv = GET_PRIV (window);
 
-       empathy_debug (DEBUG_DOMAIN, "Delete event received");
+       DEBUG ("Delete event received");
 
        list = g_list_copy (priv->chats);
 
@@ -752,8 +752,7 @@ chat_window_set_urgency_hint (EmpathyChatWindow *window,
 
        priv = GET_PRIV (window);
 
-       empathy_debug (DEBUG_DOMAIN, "Turning %s urgency hint",
-                      urgent ? "on" : "off");
+       DEBUG ("Turning %s urgency hint", urgent ? "on" : "off");
        gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), urgent);
 }
 
@@ -807,7 +806,7 @@ chat_window_detach_hook (GtkNotebook *source,
        new_window = empathy_chat_window_new ();
        priv = GET_PRIV (new_window);
 
-       empathy_debug (DEBUG_DOMAIN, "Detach hook called");
+       DEBUG ("Detach hook called");
 
        empathy_chat_window_move_chat (window, new_window, chat);
 
@@ -827,7 +826,7 @@ chat_window_page_switched_cb (GtkNotebook      *notebook,
        EmpathyChat           *chat;
        GtkWidget            *child;
 
-       empathy_debug (DEBUG_DOMAIN, "Page switched");
+       DEBUG ("Page switched");
 
        priv = GET_PRIV (window);
 
@@ -864,12 +863,12 @@ chat_window_page_added_cb (GtkNotebook      *notebook,
         * it, so we return here and in "page-added".
         */
        if (priv->dnd_same_window) {
-               empathy_debug (DEBUG_DOMAIN, "Page added (back to the same window)");
+               DEBUG ("Page added (back to the same window)");
                priv->dnd_same_window = FALSE;
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Page added");
+       DEBUG ("Page added");
 
        /* Get chat object */
        chat = EMPATHY_CHAT (child);
@@ -909,11 +908,11 @@ chat_window_page_removed_cb (GtkNotebook      *notebook,
         * it, so we return here and in "page-added".
         */
        if (priv->dnd_same_window) {
-               empathy_debug (DEBUG_DOMAIN, "Page removed (and will be readded to same window)");
+               DEBUG ("Page removed (and will be readded to same window)");
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Page removed");
+       DEBUG ("Page removed");
 
        /* Get chat object */
        chat = EMPATHY_CHAT (child);
@@ -945,7 +944,7 @@ chat_window_focus_in_event_cb (GtkWidget        *widget,
 {
        EmpathyChatWindowPriv *priv;
 
-       empathy_debug (DEBUG_DOMAIN, "Focus in event, updating title");
+       DEBUG ("Focus in event, updating title");
 
        priv = GET_PRIV (window);
 
@@ -978,7 +977,7 @@ chat_window_drag_data_received (GtkWidget        *widget,
 
                id = (const gchar*) selection->data;
 
-               empathy_debug (DEBUG_DOMAIN, "DND contact from roster with id:'%s'", id);
+               DEBUG ("DND contact from roster with id:'%s'", id);
                
                strv = g_strsplit (id, "/", 2);
                account = mc_account_lookup (strv[0]);
@@ -1019,7 +1018,7 @@ chat_window_drag_data_received (GtkWidget        *widget,
                EmpathyChat        **chat;
                EmpathyChatWindow   *old_window = NULL;
 
-               empathy_debug (DEBUG_DOMAIN, "DND tab");
+               DEBUG ("DND tab");
 
                chat = (void*) selection->data;
                old_window = chat_window_find_chat (*chat);
@@ -1030,7 +1029,7 @@ chat_window_drag_data_received (GtkWidget        *widget,
                        priv = GET_PRIV (window);
 
                        if (old_window == window) {
-                               empathy_debug (DEBUG_DOMAIN, "DND tab (within same window)");
+                               DEBUG ("DND tab (within same window)");
                                priv->dnd_same_window = TRUE;
                                gtk_drag_finish (context, TRUE, FALSE, time);
                                return;
@@ -1046,7 +1045,7 @@ chat_window_drag_data_received (GtkWidget        *widget,
                 */
                gtk_drag_finish (context, TRUE, FALSE, time);
        } else {
-               empathy_debug (DEBUG_DOMAIN, "DND from unknown source");
+               DEBUG ("DND from unknown source");
                gtk_drag_finish (context, FALSE, FALSE, time);
        }
 }
@@ -1060,7 +1059,7 @@ chat_window_finalize (GObject *object)
        window = EMPATHY_CHAT_WINDOW (object);
        priv = GET_PRIV (window);
 
-       empathy_debug (DEBUG_DOMAIN, "Finalized: %p", object);
+       DEBUG ("Finalized: %p", object);
 
        if (priv->save_geometry_id != 0) {
                g_source_remove (priv->save_geometry_id);
@@ -1343,9 +1342,7 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window,
        gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (priv->notebook), child,
                                            TRUE, TRUE, GTK_PACK_START); 
 
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Chat added (%d references)",
-                     G_OBJECT (chat)->ref_count);
+       DEBUG ("Chat added (%d references)", G_OBJECT (chat)->ref_count);
 }
 
 void
@@ -1376,9 +1373,7 @@ empathy_chat_window_remove_chat (EmpathyChatWindow *window,
                                          GTK_WIDGET (chat));
        gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), position);
 
-       empathy_debug (DEBUG_DOMAIN, 
-                     "Chat removed (%d references)", 
-                     G_OBJECT (chat)->ref_count - 1);
+       DEBUG ("Chat removed (%d references)", G_OBJECT (chat)->ref_count - 1);
 
        g_object_unref (chat);
 }
@@ -1396,10 +1391,8 @@ empathy_chat_window_move_chat (EmpathyChatWindow *old_window,
 
        widget = GTK_WIDGET (chat);
 
-       empathy_debug (DEBUG_DOMAIN,
-                     "Chat moving with widget:%p (%d references)", 
-                     widget,
-                     G_OBJECT (widget)->ref_count);
+       DEBUG ("Chat moving with widget:%p (%d references)", widget,
+               G_OBJECT (widget)->ref_count);
 
        /* We reference here to make sure we don't loose the widget
         * and the EmpathyChat object during the move.
index 17da506a8e35d8508c189b7793a29f067ee6b5eb..552f8939b415a35e02ca6f2447d9d7eb5a335fde 100644 (file)
@@ -41,7 +41,6 @@
 #include <libempathy/empathy-tp-call.h>
 #include <libempathy/empathy-tp-group.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-tube-handler.h>
 #include <libempathy/empathy-contact-factory.h>
 
 #include "empathy-chat-window.h"
 #include "empathy-call-window.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_FILTER
+#include <libempathy/empathy-debug.h>
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_FILTER, EmpathyFilterPriv))
 
-#define DEBUG_DOMAIN "Filter"
-
 struct _EmpathyFilterPriv {
        GSList         *events;
        GHashTable     *accounts;
@@ -121,8 +121,7 @@ filter_emit_event (EmpathyFilter *filter,
        EmpathyFilterPriv     *priv = GET_PRIV (filter);
        EmpathyFilterEventExt *event;
 
-       empathy_debug (DEBUG_DOMAIN, "Emit event, icon_name=%s message='%s'",
-                      icon_name, message);
+       DEBUG ("Emit event, icon_name=%s message='%s'", icon_name, message);
 
        event = g_slice_new0 (EmpathyFilterEventExt);
        event->func = func;
@@ -152,7 +151,7 @@ empathy_filter_activate_event (EmpathyFilter      *filter,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Activating event");
+       DEBUG ("Activating event");
 
        is_top = (l == priv->events);
        priv->events = g_slist_delete_link (priv->events, l);
@@ -243,8 +242,7 @@ filter_chat_handle_channel (EmpathyFilter *filter,
 {
        EmpathyTpChat *tp_chat;
 
-       empathy_debug (DEBUG_DOMAIN, "New text channel to be filtered: %p",
-                      channel);
+       DEBUG ("New text channel to be filtered: %p", channel);
 
        tp_chat = empathy_tp_chat_new (channel, FALSE);
        empathy_run_until_ready (tp_chat);
@@ -301,8 +299,7 @@ filter_call_handle_channel (EmpathyFilter *filter,
 {
        EmpathyTpCall *call;
 
-       empathy_debug (DEBUG_DOMAIN, "New media channel to be filtered: %p",
-                      channel);
+       DEBUG ("New media channel to be filtered: %p", channel);
 
        call = empathy_tp_call_new (channel);
        if (is_incoming) {
@@ -334,7 +331,7 @@ filter_contact_list_local_pending_cb (EmpathyTpGroup *group,
 {
        GString *str;
 
-       empathy_debug (DEBUG_DOMAIN, "New local pending contact");
+       DEBUG ("New local pending contact");
 
        empathy_contact_run_until_ready (contact,
                                         EMPATHY_CONTACT_READY_NAME,
@@ -366,7 +363,7 @@ filter_contact_list_ready_cb (EmpathyTpGroup *group,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Publish contact list ready");
+       DEBUG ("Publish contact list ready");
 
        g_signal_connect (group, "local-pending",
                          G_CALLBACK (filter_contact_list_local_pending_cb),
@@ -391,8 +388,7 @@ filter_tubes_async_cb (TpProxy      *channel,
                       GObject      *filter)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error %s: %s",
-                              user_data, error->message);
+               DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
        }
 }
 
@@ -435,7 +431,7 @@ filter_tubes_dispatch (EmpathyFilter *filter,
                              "handle", &handle,
                              NULL);
 
-               empathy_debug (DEBUG_DOMAIN, "Dispatching tube");
+               DEBUG ("Dispatching tube");
                emp_cli_tube_handler_call_handle_tube (thandler, -1,
                                                       connection->bus_name,
                                                       connection->object_path,
@@ -470,7 +466,7 @@ filter_tubes_dispatch (EmpathyFilter *filter,
                                  G_CALLBACK (gtk_widget_destroy),
                                  NULL);
 
-               empathy_debug (DEBUG_DOMAIN, "Tube can't be handled, closing");
+               DEBUG ("Tube can't be handled, closing");
                tp_cli_channel_type_tubes_call_close_tube (data->channel, -1,
                                                           data->id,
                                                           NULL, NULL, NULL,
@@ -511,8 +507,7 @@ filter_tubes_new_tube_cb (TpChannel   *channel,
        number = GPOINTER_TO_UINT (g_hash_table_lookup (priv->tubes, channel));
        g_hash_table_replace (priv->tubes, g_object_ref (channel),
                              GUINT_TO_POINTER (++number));
-       empathy_debug (DEBUG_DOMAIN, "Increased tube count for channel %p: %d",
-                      channel, number);
+       DEBUG ("Increased tube count for channel %p: %d", channel, number);
 
        /* We dispatch only local pending tubes */
        if (state != TP_TUBE_STATE_LOCAL_PENDING) {
@@ -541,7 +536,7 @@ filter_tubes_new_tube_cb (TpChannel   *channel,
        tp_cli_dbus_daemon_run_name_has_owner (daemon, -1, data->bus_name,
                                               &running, NULL, NULL);
        if (running) {
-               empathy_debug (DEBUG_DOMAIN, "Tube handler running");
+               DEBUG ("Tube handler running");
                data->activatable = TRUE;
                filter_tubes_dispatch (EMPATHY_FILTER (filter), data);
                return;
@@ -552,8 +547,7 @@ filter_tubes_new_tube_cb (TpChannel   *channel,
        if (!tp_cli_dbus_daemon_run_list_activatable_names (daemon, -1,
                                                            &names, &error,
                                                            NULL)) {
-               empathy_debug (DEBUG_DOMAIN, "Error listing activatable names: %s",
-                              error->message);
+               DEBUG ("Error listing activatable names: %s", error->message);
                g_clear_error (&error);
        } else {
                gchar **name;
@@ -599,8 +593,7 @@ filter_tubes_list_tubes_cb (TpChannel       *channel,
        guint i;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error listing tubes: %s",
-                              error->message);
+               DEBUG ("Error listing tubes: %s", error->message);
                return;
        }
 
@@ -628,7 +621,7 @@ filter_tubes_channel_invalidated_cb (TpProxy       *proxy,
 {
        EmpathyFilterPriv *priv = GET_PRIV (filter);
 
-       empathy_debug (DEBUG_DOMAIN, "Channel %p invalidated: %s", proxy, message);
+       DEBUG ("Channel %p invalidated: %s", proxy, message);
 
        g_hash_table_remove (priv->tubes, proxy);
 }
@@ -644,13 +637,12 @@ filter_tubes_tube_closed_cb (TpChannel *channel,
 
        number = GPOINTER_TO_UINT (g_hash_table_lookup (priv->tubes, channel));
        if (number == 1) {
-               empathy_debug (DEBUG_DOMAIN, "Ended tube count for channel %p, "
-                              "closing channel", channel);
+               DEBUG ("Ended tube count for channel %p, closing channel",
+                       channel);
                tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);
        }
        else if (number > 1) {
-               empathy_debug (DEBUG_DOMAIN, "Decrease tube count for channel %p: %d",
-                              channel, number);
+               DEBUG ("Decrease tube count for channel %p: %d", channel, number);
                g_hash_table_replace (priv->tubes, g_object_ref (channel),
                                      GUINT_TO_POINTER (--number));
        }
@@ -667,7 +659,7 @@ filter_tubes_handle_channel (EmpathyFilter *filter,
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Handling new channel");
+       DEBUG ("Handling new channel");
 
        g_hash_table_insert (priv->tubes, g_object_ref (channel),
                             GUINT_TO_POINTER (0));
@@ -724,7 +716,7 @@ filter_connection_invalidated_cb (TpConnection  *connection,
        GHashTableIter     iter;
        gpointer           key, value;
 
-       empathy_debug (DEBUG_DOMAIN, "connection invalidated: %s", message);
+       DEBUG ("connection invalidated: %s", message);
 
        g_hash_table_iter_init (&iter, priv->accounts);
        while (g_hash_table_iter_next (&iter, &key, &value)) {
@@ -770,8 +762,7 @@ filter_conection_new_channel_cb (TpConnection *connection,
        else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TUBES)) {
                func = filter_tubes_handle_channel;
        } else {
-               empathy_debug (DEBUG_DOMAIN, "Unknown channel type %s",
-                              channel_type);
+               DEBUG ("Unknown channel type %s", channel_type);
                return;
        }
 
@@ -795,8 +786,7 @@ filter_connection_list_channels_cb (TpConnection    *connection,
        guint i;
 
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error listing channels: %s",
-                              error->message);
+               DEBUG ("Error listing channels: %s", error->message);
                return;
        }
 
@@ -824,8 +814,7 @@ filter_connection_advertise_capabilities_cb (TpConnection    *connection,
                                             GObject         *filter)
 {
        if (error) {
-               empathy_debug (DEBUG_DOMAIN, "Error advertising capabilities: %s",
-                              error->message);
+               DEBUG ("Error advertising capabilities: %s", error->message);
        }
 }
 
@@ -839,7 +828,7 @@ filter_connection_ready_cb (TpConnection  *connection,
        GValue       cap = {0, };
        const gchar *remove = NULL;
 
-       empathy_debug (DEBUG_DOMAIN, "Connection ready, accepting new channels");
+       DEBUG ("Connection ready, accepting new channels");
 
        tp_cli_connection_connect_to_new_channel (connection,
                                                  filter_conection_new_channel_cb,
index 3763ab279f925c6f8aa5b117ac065e6b951811f6..f49207ebfb05e977aea5c69ec5f818fc7b34c5e0 100644 (file)
@@ -28,6 +28,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+#include <libempathy/empathy-debug.h>
 #include <libempathy-gtk/empathy-log-window.h>
 
 static void
@@ -44,6 +45,12 @@ main (int argc, char *argv[])
 
        gtk_init (&argc, &argv);
 
+       if (g_getenv ("EMPATHY_TIMING") != NULL) {
+               g_log_set_default_handler (tp_debug_timestamped_log_handler, NULL);
+       }
+       empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG"));
+       tp_debug_divert_messages (g_getenv ("EMPATHY_LOGFILE"));
+
        gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                           PKGDATADIR G_DIR_SEPARATOR_S "icons");
        window = empathy_log_window_show (NULL, NULL, FALSE, NULL);
index b20ded7ed7e8f6bd10829e51cc299a32c2c17c96..8a8117f6e892cd4e13564f05da4aba00dee8db5d 100644 (file)
@@ -29,7 +29,6 @@
 #include <glib/gi18n.h>
 
 #include <libempathy/empathy-contact.h>
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-chatroom-manager.h>
 #include <libempathy/empathy-chatroom.h>
@@ -57,7 +56,8 @@
 #include "empathy-new-chatroom-dialog.h"
 #include "empathy-chatrooms-window.h"
 
-#define DEBUG_DOMAIN "MainWindow"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 /* Minimum width of roster window if something goes wrong. */
 #define MIN_WIDTH 50
@@ -309,7 +309,7 @@ empathy_main_window_show (void)
                /* Use the defaults from the glade file if we
                 * don't have good w, h geometry.
                 */
-               empathy_debug (DEBUG_DOMAIN, "Configuring window default size w:%d, h:%d", w, h);
+               DEBUG ("Configuring window default size w:%d, h:%d", w, h);
                gtk_window_set_default_size (GTK_WINDOW (window->window), w, h);
        }
 
@@ -317,7 +317,7 @@ empathy_main_window_show (void)
                /* Let the window manager position it if we
                 * don't have good x, y coordinates.
                 */
-               empathy_debug (DEBUG_DOMAIN, "Configuring window default position x:%d, y:%d", x, y);
+               DEBUG ("Configuring window default position x:%d, y:%d", x, y);
                gtk_window_move (GTK_WINDOW (window->window), x, y);
        }
 
@@ -506,7 +506,7 @@ main_window_favorite_chatroom_join (EmpathyChatroom *chatroom)
        account = empathy_chatroom_get_account (chatroom);
        room = empathy_chatroom_get_room (chatroom);
 
-       empathy_debug (DEBUG_DOMAIN, "Requesting channel for '%s'", room);
+       DEBUG ("Requesting channel for '%s'", room);
 
        mission_control_request_channel_with_string_handle (mc,
                                                            account,
@@ -1009,7 +1009,7 @@ main_window_accels_load (void)
 
        filename = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, ACCELS_FILENAME, NULL);
        if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
-               empathy_debug (DEBUG_DOMAIN, "Loading from:'%s'", filename);
+               DEBUG ("Loading from:'%s'", filename);
                gtk_accel_map_load (filename);
        }
 
@@ -1027,7 +1027,7 @@ main_window_accels_save (void)
        file_with_path = g_build_filename (dir, ACCELS_FILENAME, NULL);
        g_free (dir);
 
-       empathy_debug (DEBUG_DOMAIN, "Saving to:'%s'", file_with_path);
+       DEBUG ("Saving to:'%s'", file_with_path);
        gtk_accel_map_save (file_with_path);
 
        g_free (file_with_path);
index 5db40c0fbdc3164c2223ea3edaa6900b24927a8e..6aac17adaca8fbab4bce744c84848573187cd8d0 100644 (file)
@@ -39,7 +39,6 @@
 #include <libempathy/empathy-tp-roomlist.h>
 #include <libempathy/empathy-chatroom.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 
 #include <libempathy-gtk/empathy-account-chooser.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
@@ -47,7 +46,8 @@
 #include "empathy-new-chatroom-dialog.h"
 #include "ephy-spinner.h"
 
-#define DEBUG_DOMAIN "NewChatroomDialog"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 typedef struct {
        EmpathyTpRoomlist *room_list;
@@ -397,9 +397,9 @@ new_chatroom_dialog_new_room_cb (EmpathyTpRoomlist        *room_list,
        GtkListStore     *store;
        GtkTreeIter       iter;
 
-       empathy_debug (DEBUG_DOMAIN, "New chatroom listed: %s (%s)",
-                      empathy_chatroom_get_name (chatroom),
-                      empathy_chatroom_get_room (chatroom));
+       DEBUG ("New chatroom listed: %s (%s)",
+               empathy_chatroom_get_name (chatroom),
+               empathy_chatroom_get_room (chatroom));
 
        /* Add to model */
        view = GTK_TREE_VIEW (dialog->treeview);
@@ -506,7 +506,7 @@ new_chatroom_dialog_join (EmpathyNewChatroomDialog *dialog)
                room_name = g_strdup (room);
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Requesting channel for '%s'", room_name);
+       DEBUG ("Requesting channel for '%s'", room_name);
 
        mc = empathy_mission_control_new ();
        mission_control_request_channel_with_string_handle (mc,
index 9026315dbbc61e875a033069527b1e5fdc0c1313..aea68d4eafed186ab7f2b6cf9b219a8d47c55627 100644 (file)
@@ -27,7 +27,6 @@
 #include <glade/glade.h>
 #include <glib/gi18n.h>
 
-#include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-idle.h>
 
 #include "empathy-preferences.h"
 #include "empathy-filter.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_FILTER
+#include <libempathy/empathy-debug.h>
+
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                       EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv))
 
-#define DEBUG_DOMAIN "StatusIcon"
-
 /* Number of ms to wait when blinking */
 #define BLINK_TIMEOUT 500
 
@@ -95,8 +95,7 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
                if (accounts) {
                        mc_accounts_list_free (accounts);
                } else {
-                       empathy_debug (DEBUG_DOMAIN,
-                                     "No enabled account, Showing account dialog");
+                       DEBUG ("No enabled account, Showing account dialog");
                        empathy_accounts_dialog_show (GTK_WINDOW (priv->window));
                }
        }
@@ -182,8 +181,7 @@ status_icon_activate_cb (GtkStatusIcon     *status_icon,
 {
        EmpathyStatusIconPriv *priv = GET_PRIV (icon);
 
-       empathy_debug (DEBUG_DOMAIN, "Activated: %s",
-                      priv->event ? "event" : "toggle");
+       DEBUG ("Activated: %s", priv->event ? "event" : "toggle");
 
        if (priv->event) {
                empathy_filter_activate_event (priv->filter, priv->event);
index 08d1d0c12600b581a0591f401bc7bc58bea01752..f28eae9599d7497141962ea735eeecdb758e79eb 100644 (file)
@@ -38,7 +38,6 @@
 
 #include <libempathy/empathy-idle.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-debug.h>
 
 #include <libempathy-gtk/empathy-conf.h>
 
@@ -46,7 +45,8 @@
 #include "empathy-status-icon.h"
 #include "bacon-message-connection.h"
 
-#define DEBUG_DOMAIN "EmpathyMain"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
 static BaconMessageConnection *connection = NULL;
 
@@ -54,7 +54,7 @@ static void
 service_ended_cb (MissionControl *mc,
                  gpointer        user_data)
 {
-       empathy_debug (DEBUG_DOMAIN, "Mission Control stopped");
+       DEBUG ("Mission Control stopped");
 }
 
 static void
@@ -109,8 +109,7 @@ operation_error_cb (MissionControl *mc,
                message = _("Unknown error code");
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Error during operation %d: %s",
-                      operation_id, message);
+       DEBUG ("Error during operation %d: %s", operation_id, message);
 }
 
 static void
@@ -151,13 +150,13 @@ create_salut_account (void)
                return;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Try to add a salut account...");
+       DEBUG ("Try to add a salut account...");
 
        /* Check if the salut CM is installed */
        profile = mc_profile_lookup ("salut");
        protocol = mc_profile_get_protocol (profile);
        if (!protocol) {
-               empathy_debug (DEBUG_DOMAIN, "Salut not installed");
+               DEBUG ("Salut not installed");
                g_object_unref (profile);
                return;
        }
@@ -165,8 +164,8 @@ create_salut_account (void)
 
        /* Get self EContact from EDS */
        if (!e_book_get_self (&contact, &book, &error)) {
-               empathy_debug (DEBUG_DOMAIN, "Failed to get self econtact: %s",
-                              error ? error->message : "No error given");
+               DEBUG ("Failed to get self econtact: %s",
+                       error ? error->message : "No error given");
                g_clear_error (&error);
                g_object_unref (profile);
                return;
@@ -179,7 +178,7 @@ create_salut_account (void)
        /* Check if there is already a salut account */
        accounts = mc_accounts_list_by_profile (profile);
        if (accounts) {
-               empathy_debug (DEBUG_DOMAIN, "There is already a salut account");
+               DEBUG ("There is already a salut account");
                mc_accounts_list_free (accounts);
                g_object_unref (profile);
                return;
@@ -199,13 +198,9 @@ create_salut_account (void)
                nickname = NULL;
        }
 
-       empathy_debug (DEBUG_DOMAIN, "Salut account created:\n"
-                                    "  nickname=%s\n"
-                                    "  first-name=%s\n"
-                                    "  last-name=%s\n"
-                                    "  email=%s\n"
-                                    "  jid=%s\n",
-                      nickname, first_name, last_name, email, jid);
+       DEBUG ("Salut account created:\nnickname=%s\nfirst-name=%s\n"
+               "last-name=%s\nemail=%s\njid=%s\n",
+               nickname, first_name, last_name, email, jid);
 
        mc_account_set_param_string (account, "nickname", nickname ? nickname : "");
        mc_account_set_param_string (account, "first-name", first_name ? first_name : "");
@@ -238,9 +233,8 @@ on_bacon_message_received (const char *message,
 
        g_return_if_fail (message != NULL);
 
-       empathy_debug (DEBUG_DOMAIN,
-                      "Other instance launched, presenting the main window "
-                      "(message is '%s')", message);
+       DEBUG ("Other instance launched, presenting the main window. message='%s'",
+               message);
 
        startup_timestamp = atoi (message);
 
@@ -251,7 +245,7 @@ on_bacon_message_received (const char *message,
         * has been realized otherwise it will not work. lame. */
        if (startup_timestamp == 0) {
                /* Work if launched from the terminal */
-               empathy_debug (DEBUG_DOMAIN, "Using X server timestamp as a fallback");
+               DEBUG ("Using X server timestamp as a fallback");
 
                if (!GTK_WIDGET_REALIZED (window)) {
                        gtk_widget_realize (GTK_WIDGET (window));
@@ -329,11 +323,15 @@ main (int argc, char *argv[])
        if (!gtk_init_with_args (&argc, &argv,
                                 _("- Empathy Instant Messenger"),
                                 options, GETTEXT_PACKAGE, &error)) {
-               empathy_debug (DEBUG_DOMAIN, error->message);
+               g_warning ("Error in gtk init: %s", error->message);
                return EXIT_FAILURE;
        }
 
-       empathy_debug_set_log_file_from_env ();
+       if (g_getenv ("EMPATHY_TIMING") != NULL) {
+               g_log_set_default_handler (tp_debug_timestamped_log_handler, NULL);
+       }
+       empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG"));
+       tp_debug_divert_messages (g_getenv ("EMPATHY_LOGFILE"));
 
        g_set_application_name (PACKAGE_NAME);
 
@@ -347,7 +345,7 @@ main (int argc, char *argv[])
                if (!bacon_message_connection_get_is_server (connection)) {
                        gchar *message;
 
-                       empathy_debug (DEBUG_DOMAIN, "Activating existing instance");
+                       DEBUG ("Activating existing instance");
 
                        message = g_strdup_printf ("%" G_GUINT32_FORMAT,
                                                   startup_timestamp);