changeset 28176:584fa66dfb31

Remove the "accepted" signal from PurpleMedia as it was redundant.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 05 Aug 2009 03:37:45 +0000
parents fa2e83d7ba7f
children 94abbb806273 f660386afa66 1cf504b5e62a
files libpurple/media.c libpurple/protocols/jabber/jingle/rtp.c pidgin/gtkmedia.c
diffstat 3 files changed, 9 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Wed Aug 05 02:17:12 2009 +0000
+++ b/libpurple/media.c	Wed Aug 05 03:37:45 2009 +0000
@@ -157,7 +157,6 @@
 
 enum {
 	S_ERROR,
-	ACCEPTED,
 	CANDIDATES_PREPARED,
 	CODECS_CHANGED,
 	NEW_CANDIDATE,
@@ -332,10 +331,6 @@
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 g_cclosure_marshal_VOID__STRING,
 					 G_TYPE_NONE, 1, G_TYPE_STRING);
-	purple_media_signals[ACCEPTED] = g_signal_new("accepted", G_TYPE_FROM_CLASS(klass),
-					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-					 purple_smarshal_VOID__STRING_STRING,
-					 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
 	purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 purple_smarshal_VOID__STRING_STRING,
@@ -2155,9 +2150,6 @@
 					stream->session->type), NULL);
 			stream->accepted = TRUE;
 		}
-
-		g_signal_emit(media, purple_media_signals[ACCEPTED],
-				0, NULL, NULL);
 	} else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
 			type == PURPLE_MEDIA_INFO_UNMUTE)) {
 		GList *sessions;
--- a/libpurple/protocols/jabber/jingle/rtp.c	Wed Aug 05 02:17:12 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Wed Aug 05 03:37:45 2009 +0000
@@ -355,14 +355,6 @@
 static void jingle_rtp_ready(JingleSession *session);
 
 static void
-jingle_rtp_accepted_cb(PurpleMedia *media, gchar *sid, gchar *name,
-		JingleSession *session)
-{
-	purple_debug_info("jingle-rtp", "jingle_rtp_accepted_cb\n");
-	jingle_rtp_ready(session);
-}
-
-static void
 jingle_rtp_candidates_prepared_cb(PurpleMedia *media,
 		gchar *sid, gchar *name, JingleSession *session)
 {
@@ -480,6 +472,9 @@
 		jabber_iq_send(jingle_session_terminate_packet(
 				session, "decline"));
 		g_object_unref(session);
+	} else if (type == PURPLE_MEDIA_INFO_ACCEPT &&
+			jingle_session_is_initiator(session) == FALSE) {
+		jingle_rtp_ready(session);
 	}
 }
 
@@ -504,8 +499,6 @@
 		}
 
 		g_signal_handlers_disconnect_by_func(G_OBJECT(media),
-				G_CALLBACK(jingle_rtp_accepted_cb), session);
-		g_signal_handlers_disconnect_by_func(G_OBJECT(media),
 				G_CALLBACK(jingle_rtp_candidates_prepared_cb),
 				session);
 		g_signal_handlers_disconnect_by_func(G_OBJECT(media),
@@ -539,9 +532,6 @@
 	purple_media_set_prpl_data(media, session);
 
 	/* connect callbacks */
-	if (jingle_session_is_initiator(session) == FALSE)
-		g_signal_connect(G_OBJECT(media), "accepted",
-				G_CALLBACK(jingle_rtp_accepted_cb), session);
 	g_signal_connect(G_OBJECT(media), "candidates-prepared",
 				 G_CALLBACK(jingle_rtp_candidates_prepared_cb), session);
 	g_signal_connect(G_OBJECT(media), "codecs-changed",
--- a/pidgin/gtkmedia.c	Wed Aug 05 02:17:12 2009 +0000
+++ b/pidgin/gtkmedia.c	Wed Aug 05 03:37:45 2009 +0000
@@ -501,17 +501,6 @@
 }
 
 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."));
-	gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar),
-			0, _("Call in progress."));
-	gtk_widget_show(GTK_WIDGET(gtkmedia));
-}
-
-static void
 pidgin_media_accept_cb(PurpleMedia *media, int index)
 {
 	purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT,
@@ -843,6 +832,12 @@
 	if (type == PURPLE_MEDIA_INFO_REJECT) {
 		pidgin_media_emit_message(gtkmedia,
 				_("You have rejected the call."));
+	} else if (type == PURPLE_MEDIA_INFO_ACCEPT) {
+		pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
+		pidgin_media_emit_message(gtkmedia, _("Call in progress."));
+		gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar),
+				0, _("Call in progress."));
+		gtk_widget_show(GTK_WIDGET(gtkmedia));
 	}
 }
 
@@ -869,8 +864,6 @@
 
 			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);
 			g_signal_connect(G_OBJECT(media->priv->media), "stream-info",