aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-main-window.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:46:11 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:46:11 +0800
commit3d889ffd601e614682577a8e6664c6656dce6764 (patch)
treeced5daeaa5d0c975ce4bc60a1a5d9c7a3908f9ed /src/empathy-main-window.c
parentca2a03e84bd231e8e9c8522f42778493c977a478 (diff)
downloadgsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.tar
gsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.tar.gz
gsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.tar.bz2
gsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.tar.lz
gsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.tar.xz
gsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.tar.zst
gsoc2013-empathy-3d889ffd601e614682577a8e6664c6656dce6764.zip
Only play logout sound if switching to Offline from Available.
svn path=/trunk/; revision=2028
Diffstat (limited to 'src/empathy-main-window.c')
-rw-r--r--src/empathy-main-window.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 58c4a0184..c286b0399 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -1116,7 +1116,9 @@ main_window_status_changed_cb (MissionControl *mc,
const gchar *unique_name,
EmpathyMainWindow *window)
{
- McAccount *account;
+ McAccount *account;
+ McPresence old_state;
+ EmpathyIdle *idle;
main_window_update_status (window);
@@ -1174,7 +1176,14 @@ main_window_status_changed_cb (MissionControl *mc,
main_window_error_display (window, account, message);
}
+ idle = empathy_idle_new ();
+ old_state = empathy_idle_get_state (idle);
+
+ /* play the sound only when the state changes from the current to
+ * UNSET, as we receive this signal two times when disconnecting.
+ */
if (status == TP_CONNECTION_STATUS_DISCONNECTED &&
+ old_state != MC_PRESENCE_UNSET &&
empathy_sound_pref_is_enabled (EMPATHY_PREFS_SOUNDS_SERVICE_LOGOUT)) {
ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
CA_PROP_EVENT_ID, "service-logout",
@@ -1184,15 +1193,12 @@ main_window_status_changed_cb (MissionControl *mc,
if (status == TP_CONNECTION_STATUS_CONNECTED) {
GtkWidget *error_widget;
- EmpathyIdle *idle;
-
- idle = empathy_idle_new ();
/* emit the sound only on first connect, i.e. when the saved
* idle state is MC_PRESENCE_UNSET.
*/
- if (empathy_idle_get_state (idle) == MC_PRESENCE_UNSET &&
+ if (old_state == MC_PRESENCE_UNSET &&
empathy_sound_pref_is_enabled (EMPATHY_PREFS_SOUNDS_SERVICE_LOGIN)) {
ca_gtk_play_for_widget (GTK_WIDGET (window->window), 0,
CA_PROP_EVENT_ID, "service-login",
@@ -1200,8 +1206,6 @@ main_window_status_changed_cb (MissionControl *mc,
NULL);
}
- g_object_unref (idle);
-
/* Account connected without error, remove error message if any */
error_widget = g_hash_table_lookup (window->errors, account);
if (error_widget) {
@@ -1211,6 +1215,7 @@ main_window_status_changed_cb (MissionControl *mc,
}
g_object_unref (account);
+ g_object_unref (idle);
}
static void