/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2010 Collabora Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
#include <libempathy-gtk/empathy-log-window.h>
#include <libempathy-gtk/empathy-geometry.h>
#include <libempathy-gtk/empathy-smiley-manager.h>
-#include <libempathy-gtk/empathy-sound.h>
+#include <libempathy-gtk/empathy-sound-manager.h>
#include <libempathy-gtk/empathy-ui-utils.h>
#include <libempathy-gtk/empathy-notify-manager.h>
GSettings *gsettings_chat;
GSettings *gsettings_notif;
GSettings *gsettings_ui;
+
+ EmpathySoundManager *sound_mgr;
} EmpathyChatWindowPriv;
static GList *chat_windows = NULL;
static void
chat_window_new_message_cb (EmpathyChat *chat,
EmpathyMessage *message,
+ gboolean pending,
EmpathyChatWindow *window)
{
EmpathyChatWindowPriv *priv;
sender = empathy_message_get_sender (message);
if (empathy_contact_is_user (sender)) {
- empathy_sound_play (GTK_WIDGET (priv->dialog),
+ empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (priv->dialog),
EMPATHY_SOUND_MESSAGE_OUTGOING);
}
chat_window_set_highlight_room_tab_label (chat);
}
- empathy_sound_play (GTK_WIDGET (priv->dialog),
+ empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (priv->dialog),
EMPATHY_SOUND_MESSAGE_INCOMING);
- chat_window_show_or_update_notification (window, message, chat);
+
+ /* Pending messages have already been displayed in the approver, so we don't
+ * display a notification for those. */
+ if (!pending)
+ chat_window_show_or_update_notification (window, message, chat);
}
/* update the number of unread messages and the window icon */
g_object_unref (priv->gsettings_chat);
g_object_unref (priv->gsettings_notif);
g_object_unref (priv->gsettings_ui);
+ g_object_unref (priv->sound_mgr);
if (priv->notification != NULL) {
notify_notification_close (priv->notification, NULL);
priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
priv->chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
+ priv->sound_mgr = empathy_sound_manager_dup_singleton ();
+
priv->notebook = gtk_notebook_new ();
g_signal_connect (priv->notebook, "create-window",