r2820 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src
njp at sita.openmoko.org
njp at sita.openmoko.org
Thu Aug 23 18:30:56 CEST 2007
Author: njp
Date: 2007-08-23 18:30:55 +0200 (Thu, 23 Aug 2007)
New Revision: 2820
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c
Log:
2007-08-23 Neil J. Patel <njp at o-hand.com>
* src/moko-notify.c: (play), (play_timeout),
(moko_notify_start_ringtone), (moko_notify_stop_ringtone):
Some ringtone fixes, so there is a gap between playback.
Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog 2007-08-23 15:50:14 UTC (rev 2819)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog 2007-08-23 16:30:55 UTC (rev 2820)
@@ -1,5 +1,11 @@
2007-08-23 Neil J. Patel <njp at o-hand.com>
+ * src/moko-notify.c: (play), (play_timeout),
+ (moko_notify_start_ringtone), (moko_notify_stop_ringtone):
+ Some ringtone fixes, so there is a gap between playback.
+
+2007-08-23 Neil J. Patel <njp at o-hand.com>
+
* src/moko-dialer.c: (on_talking_accept_call), (on_incoming_call):
Make sure we don't do anything on an incmong call if we have already
accepted it.
Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c 2007-08-23 15:50:14 UTC (rev 2819)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c 2007-08-23 16:30:55 UTC (rev 2820)
@@ -46,6 +46,7 @@
/* Sound stuff */
pa_context *pac;
+ pa_operation *operation;
};
/*
enum
@@ -103,25 +104,33 @@
}
static gboolean
-play_timeout (MokoNotify *notify)
+play (MokoNotify *notify)
{
moko_notify_start_ringtone (notify);
return FALSE;
}
-static void
-on_sound_finished (pa_context *pa, gint success, MokoNotify *notify)
+static gboolean
+play_timeout (MokoNotify *notify)
{
MokoNotifyPrivate *priv;
- g_return_if_fail (MOKO_IS_NOTIFY (notify));
+ g_return_val_if_fail (MOKO_IS_NOTIFY (notify), FALSE);
priv = notify->priv;
if (!priv->pac)
- return;
-
- if (priv->started)
- g_timeout_add (1500, (GSourceFunc)play_timeout, (gpointer)notify);
+ return FALSE;
+
+ if (!priv->operation)
+ return FALSE;
+
+ if (pa_operation_get_state (priv->operation) == PA_OPERATION_DONE)
+ {
+ g_timeout_add (1500, (GSourceFunc)play, (gpointer)notify);
+ return FALSE;
+ }
+
+ return TRUE;
}
static void
@@ -135,13 +144,13 @@
if (!priv->pac)
return;
- pa_context_play_sample (priv->pac,
- "x11-bell",
- NULL,
- PA_VOLUME_NORM,
- (gpointer)on_sound_finished,
- (gpointer)notify);
-
+ priv->operation = pa_context_play_sample (priv->pac,
+ "x11-bell",
+ NULL,
+ PA_VOLUME_NORM,
+ NULL,
+ NULL);
+ g_timeout_add (500, (GSourceFunc)play_timeout, (gpointer)notify);
}
static void
@@ -151,6 +160,11 @@
g_return_if_fail (MOKO_IS_NOTIFY (notify));
priv = notify->priv;
+
+ if (priv->operation)
+ pa_operation_cancel (priv->operation);
+
+ priv->operation = NULL;
}
static void
More information about the commitlog
mailing list