changeset 26061:f6a98b2b8d92

Add the accepted signal and make the accept button go away immediately.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 27 Jan 2009 22:18:01 +0000
parents 5b64b7d8da39
children 2091094745d9
files libpurple/media.c libpurple/media.h pidgin/gtkmedia.c
diffstat 3 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Tue Jan 27 09:40:24 2009 +0000
+++ b/libpurple/media.c	Tue Jan 27 22:18:01 2009 +0000
@@ -1893,6 +1893,15 @@
 	return ret;
 }
 
+gboolean
+purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
+		const gchar *participant)
+{
+	PurpleMediaSession *session =
+			purple_media_get_session(media, sess_id);
+	return session->accepted;
+}
+
 void purple_media_mute(PurpleMedia *media, gboolean active)
 {
 	GList *sessions = g_hash_table_get_values(media->priv->sessions);
--- a/libpurple/media.h	Tue Jan 27 09:40:24 2009 +0000
+++ b/libpurple/media.h	Tue Jan 27 22:18:01 2009 +0000
@@ -600,6 +600,18 @@
 gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id);
 
 /**
+ * Gets whether a streams selected have been accepted.
+ *
+ * @param media The media object to find the session in.
+ * @param sess_id The session id of the session to check.
+ * @param participant The participant to check.
+ *
+ * @return @c TRUE The selected streams have been accepted, or @c FALSE otherwise.
+ */
+gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
+		const gchar *participant);
+
+/**
  * Mutes or unmutes all the audio local audio sources.
  *
  * @param media The media object to mute or unmute
--- a/pidgin/gtkmedia.c	Tue Jan 27 09:40:24 2009 +0000
+++ b/pidgin/gtkmedia.c	Tue Jan 27 22:18:01 2009 +0000
@@ -357,6 +357,14 @@
 	g_signal_emit(gtkmedia, pidgin_media_signals[ERROR], 0, error);
 }
 
+static void
+pidgin_media_accepted_cb(PurpleMedia *media, const gchar *session_id,
+		const gchar *participant, PidginMedia *gtkmedia)
+{
+	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
+	pidgin_media_emit_message(gtkmedia, _("Call in progress."));
+}
+
 static gboolean
 plug_delete_event_cb(GtkWidget *widget, gpointer data)
 {
@@ -582,9 +590,6 @@
 		GstElement *audiosendbin = NULL, *audiorecvbin = NULL;
 		GstElement *videosendbin = NULL, *videorecvbin = NULL;
 
-		pidgin_media_emit_message(gtkmedia, _("Call in progress."));
-		pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
-
 		purple_media_get_elements(media, &audiosendbin, &audiorecvbin,
 					  &videosendbin, &videorecvbin);
 
@@ -625,6 +630,8 @@
 
 			g_signal_connect(G_OBJECT(media->priv->media), "error",
 				G_CALLBACK(pidgin_media_error_cb), media);
+			g_signal_connect(G_OBJECT(media->priv->media), "accepted",
+				G_CALLBACK(pidgin_media_accepted_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media), "state-changed",
 				G_CALLBACK(pidgin_media_state_changed_cb), media);
 			break;