aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-05-01 05:44:38 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-05-01 05:44:38 +0800
commit692886962aec6022d4fab9cdbd9867f2acd7f75c (patch)
treef0db8cc8325ed3b377d5663c7377db6967e41e8b /src
parentfb06002dc6fcf523f22f671aeaf22054515e926a (diff)
downloadgsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.tar
gsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.tar.gz
gsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.tar.bz2
gsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.tar.lz
gsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.tar.xz
gsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.tar.zst
gsoc2013-empathy-692886962aec6022d4fab9cdbd9867f2acd7f75c.zip
Make use of tp-glib debug system.
svn path=/trunk/; revision=1066
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts.c7
-rw-r--r--src/empathy-call-window.c21
-rw-r--r--src/empathy-chat-window.c55
-rw-r--r--src/empathy-filter.c63
-rw-r--r--src/empathy-logs.c7
-rw-r--r--src/empathy-main-window.c14
-rw-r--r--src/empathy-new-chatroom-dialog.c12
-rw-r--r--src/empathy-status-icon.c12
-rw-r--r--src/empathy.c46
9 files changed, 114 insertions, 123 deletions
diff --git a/src/empathy-accounts.c b/src/empathy-accounts.c
index 38b31fd58..65ede78ac 100644
--- a/src/empathy-accounts.c
+++ b/src/empathy-accounts.c
@@ -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);
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index b0fc66a55..e8ae0a8b0 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -30,13 +30,13 @@
#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);
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 0d4baef57..82dfdd662 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -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>
@@ -53,9 +52,10 @@
#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.
diff --git a/src/empathy-filter.c b/src/empathy-filter.c
index 17da506a8..552f8939b 100644
--- a/src/empathy-filter.c
+++ b/src/empathy-filter.c
@@ -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>
@@ -53,11 +52,12 @@
#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,
diff --git a/src/empathy-logs.c b/src/empathy-logs.c
index 3763ab279..f49207ebf 100644
--- a/src/empathy-logs.c
+++ b/src/empathy-logs.c
@@ -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);
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index b20ded7ed..8a8117f6e 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -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);
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index 5db40c0fb..6aac17ada 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -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,
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 9026315db..aea68d4ea 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -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>
@@ -42,11 +41,12 @@
#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);
diff --git a/src/empathy.c b/src/empathy.c
index 08d1d0c12..f28eae959 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -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);