changeset 26117:958a5d614f71

Replace the got-request signal in PidginMedia.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 13 Jan 2009 11:22:19 +0000
parents 3b82059e4069
children bc22d0a449dd fc921eb8b220
files pidgin/gtkmedia.c
diffstat 1 files changed, 16 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkmedia.c	Tue Jan 13 10:42:20 2009 +0000
+++ b/pidgin/gtkmedia.c	Tue Jan 13 11:22:19 2009 +0000
@@ -400,6 +400,7 @@
 	gboolean audiorecvbool = FALSE;
 	gboolean videorecvbool = FALSE;
 	GstBus *bus;
+	gboolean is_initiator;
 
 	PurpleMediaSessionType type = purple_media_get_session_type(media, sid);
 	if (type & PURPLE_MEDIA_AUDIO) {
@@ -542,29 +543,24 @@
 		gtkmedia->priv->send_widget = send_widget;
 	if (recv_widget != NULL)
 		gtkmedia->priv->recv_widget = recv_widget;
-}
 
-static void
-pidgin_media_got_request_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
-	PurpleMediaSessionType type = purple_media_get_overall_type(media);
-	gchar *message;
+	g_object_get(G_OBJECT(media), "initiator", &is_initiator, NULL);
 
-	if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) {
-		message = g_strdup_printf(_("%s wishes to start an audio/video session with you."),
-					  gtkmedia->priv->screenname);
-	} else if (type & PURPLE_MEDIA_AUDIO) {
-		message = g_strdup_printf(_("%s wishes to start an audio session with you."),
-					  gtkmedia->priv->screenname);
-	} else if (type & PURPLE_MEDIA_VIDEO) {
-		message = g_strdup_printf(_("%s wishes to start a video session with you."),
-					  gtkmedia->priv->screenname);
-	} else {
-		return;
+	if (is_initiator == FALSE) {
+		gchar *message;
+		if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) {
+			message = g_strdup_printf(_("%s wishes to start an audio/video session with you."),
+						  gtkmedia->priv->screenname);
+		} else if (type & PURPLE_MEDIA_AUDIO) {
+			message = g_strdup_printf(_("%s wishes to start an audio session with you."),
+						  gtkmedia->priv->screenname);
+		} else if (type & PURPLE_MEDIA_VIDEO) {
+			message = g_strdup_printf(_("%s wishes to start a video session with you."),
+						  gtkmedia->priv->screenname);
+		}
+		pidgin_media_emit_message(gtkmedia, message);
+		g_free(message);
 	}
-
-	pidgin_media_emit_message(gtkmedia, message);
-	g_free(message);
 }
 
 static void
@@ -634,8 +630,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), "got-request",
-				G_CALLBACK(pidgin_media_got_request_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media), "state-changed",
 				G_CALLBACK(pidgin_media_state_changed_cb), media);
 			break;