]> git.0d.be Git - empathy.git/commitdiff
Adapt Patryk's patch to trunk.
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 6 Jan 2009 16:45:51 +0000 (16:45 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 6 Jan 2009 16:45:51 +0000 (16:45 +0000)
svn path=/trunk/; revision=2022

configure.ac
libempathy-gtk/empathy-conf.h
src/empathy-call-window.c
src/empathy-chat-window.c
src/empathy-main-window.c

index 9c5837c6f28f34dc5213260035a2986b9c392c9a..54f073245d6abfe45d17ad67a691da80815aa4cb 100644 (file)
@@ -107,6 +107,7 @@ PKG_CHECK_MODULES(EMPATHY,
    x11
    libglade-2.0 >= $LIBGLADE_REQUIRED
    libebook-1.2
+   libcanberra-gtk >= 0.4
 ])
 
 # -----------------------------------------------------------
index 2c361f468d934926787a3416516e0994d767d768..00f26c0770ae06c4e80e97dcbdb8bbbae153845a 100644 (file)
@@ -74,6 +74,7 @@ struct _EmpathyConfClass {
 #define EMPATHY_PREFS_AUTOCONNECT                  EMPATHY_PREFS_PATH "/autoconnect"
 #define EMPATHY_PREFS_IMPORT_ASKED                 EMPATHY_PREFS_PATH "/import_asked"
 #define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER EMPATHY_PREFS_PATH "/file_transfer/default_folder"
+#define EMPATHY_PREFS_INPUT_FEEDBACK_SOUNDS        "/desktop/gnome/sound/input_feedback_sounds"
 
 typedef void (*EmpathyConfNotifyFunc) (EmpathyConf  *conf, 
                                      const gchar *key,
index 8edf6817c1a7c934dc38d7b873f617f8a88ea10e..f8ccfc648d77cfd7588f3587c4a555d8daeac3b9 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <glade/glade.h>
 #include <glib/gi18n.h>
+#include <canberra-gtk.h>
 
 #include <telepathy-glib/enums.h>
 
@@ -194,6 +195,11 @@ static void
 call_window_hang_up_button_clicked_cb (GtkWidget *widget,
                                        EmpathyCallWindow *window)
 {
+  ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
+                          CA_PROP_EVENT_ID, "phone-hangup",
+                          CA_PROP_EVENT_DESCRIPTION, _("Voice call ended"),
+                          CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                          NULL);
   DEBUG ("Call clicked, end call");
   call_window_finalize (window);
 }
@@ -394,8 +400,25 @@ call_window_update (EmpathyCallWindow *window)
       gtk_window_set_title (GTK_WINDOW (window->window), title);
       gtk_label_set_text (GTK_LABEL (window->status_label), _("Ringing"));
       gtk_widget_set_sensitive (window->hang_up_button, TRUE);
+
       if (is_incoming)
+        {
           call_window_show_confirmation_dialog (window);
+          ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
+                                  CA_PROP_EVENT_ID, "phone-incoming-call",
+                                  CA_PROP_EVENT_DESCRIPTION, _("Incoming voice call"),
+                                  CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                                  NULL);
+        }
+      else
+        {
+          ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
+                                  CA_PROP_EVENT_ID, "phone-outgoing-calling",
+                                  CA_PROP_EVENT_DESCRIPTION, _("Outgoing voice call"),
+                                  CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                                  NULL);
+        }
+
     }
   else if (window->status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
     {
index e0e9dae5dd42586bd0267f2d23a73e4b88a934c5..b5e30d6470cc0f5dadb5dc04da10ef2f5b19170d 100644 (file)
@@ -33,6 +33,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <glade/glade.h>
 #include <glib/gi18n.h>
+#include <canberra-gtk.h>
 
 #include <telepathy-glib/util.h>
 #include <libmissioncontrol/mission-control.h>
@@ -841,11 +842,34 @@ chat_window_new_message_cb (EmpathyChat       *chat,
        EmpathyChatWindowPriv *priv;
        gboolean              has_focus;
        gboolean              needs_urgency;
+       gboolean              action_sounds_enabled;
+       EmpathyContact        *sender;
 
        priv = GET_PRIV (window);
 
        has_focus = empathy_chat_window_has_focus (window);
 
+       empathy_conf_get_bool (empathy_conf_get (),
+                              EMPATHY_PREFS_INPUT_FEEDBACK_SOUNDS,
+                              &action_sounds_enabled);
+       /* always play sounds if enabled, otherwise only play if chat is not in focus */
+       if (action_sounds_enabled || !has_focus || priv->current_chat != chat) {
+               sender = empathy_message_get_sender(message);
+               if (empathy_contact_is_user (sender) != FALSE) {
+                       ca_gtk_play_for_widget (GTK_WIDGET (priv->dialog), 0,
+                                               CA_PROP_EVENT_ID, "message-sent-instant",
+                                               CA_PROP_EVENT_DESCRIPTION, _("Sent an instant message"),
+                                               CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                                               NULL);
+               } else {
+                       ca_gtk_play_for_widget (GTK_WIDGET (priv->dialog), 0,
+                                               CA_PROP_EVENT_ID, "message-new-instant",
+                                               CA_PROP_EVENT_DESCRIPTION, _("Received an instant message"),
+                                               CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                                               NULL);
+               }
+       }
+
        if (has_focus && priv->current_chat == chat) {
                return;
        }
index 49bfe3d0a3762e757760e9b8b0e2e5082682db2c..5c82fe5997e7153aee0edccc4c4402ffd6c7d3ae 100644 (file)
@@ -27,6 +27,7 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include <glib/gi18n.h>
+#include <canberra-gtk.h>
 
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-utils.h>
@@ -212,7 +213,7 @@ main_window_flash_foreach (GtkTreeModel *model,
        /* To be used with gtk_tree_model_foreach, update the status icon
         * of the contact to show the event icon (on=TRUE) or the presence
         * (on=FALSE) */
-       gtk_tree_model_get (model, iter,
+       gtk_tree_model_get (model, iter,
                            EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
                            -1);
 
@@ -285,6 +286,11 @@ main_window_flash_cb (EmpathyMainWindow *window)
 static void
 main_window_flash_start (EmpathyMainWindow *window)
 {
+       ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
+                               CA_PROP_EVENT_ID, "message-new-instant",
+                               CA_PROP_EVENT_DESCRIPTION, _("Incoming chat request"),
+                               CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                               NULL);
 
        if (window->flash_timeout_id != 0) {
                return;
@@ -1166,9 +1172,22 @@ main_window_status_changed_cb (MissionControl           *mc,
                main_window_error_display (window, account, message);
        }
 
+       if (status == TP_CONNECTION_STATUS_DISCONNECTED) {
+               ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
+                                       CA_PROP_EVENT_ID, "service-logout",
+                                       CA_PROP_EVENT_DESCRIPTION, _("Disconnected from server"),
+                                       CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                                       NULL);
+       }
+
        if (status == TP_CONNECTION_STATUS_CONNECTED) {
                GtkWidget *error_widget;
 
+               ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
+                                       CA_PROP_EVENT_ID, "service-login",
+                                       CA_PROP_EVENT_DESCRIPTION, _("Connected to server"),
+                                       CA_PROP_APPLICATION_NAME, g_get_application_name (),
+                                       NULL);
                /* Account connected without error, remove error message if any */
                error_widget = g_hash_table_lookup (window->errors, account);
                if (error_widget) {