changeset 26067:a6e53d23bcbb

Use request API for a media invitation.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Fri, 30 Jan 2009 08:52:27 +0000
parents cd720cb4b47c
children f95aa2b14bec
files pidgin/gtkmedia.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkmedia.c	Fri Jan 30 08:09:20 2009 +0000
+++ b/pidgin/gtkmedia.c	Fri Jan 30 08:52:27 2009 +0000
@@ -30,6 +30,7 @@
 #include "media.h"
 #include "mediamanager.h"
 #include "pidgin.h"
+#include "request.h"
 
 #include "gtkmedia.h"
 
@@ -221,8 +222,6 @@
 
 	g_signal_connect(G_OBJECT(media), "delete-event",
 			G_CALLBACK(pidgin_media_delete_event_cb), media);
-
-	gtk_widget_show(GTK_WIDGET(media));
 }
 
 static gboolean
@@ -389,6 +388,7 @@
 {
 	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
 	pidgin_media_emit_message(gtkmedia, _("Call in progress."));
+	gtk_widget_show(GTK_WIDGET(gtkmedia));
 }
 
 static gboolean
@@ -732,8 +732,21 @@
 {
 	PidginMedia *gtkmedia = PIDGIN_MEDIA(
 			pidgin_media_new(media, screenname));
+	gboolean initiator;
 	gtkmedia->priv->pc = pc;
 
+	g_object_get(G_OBJECT(media), "initiator", &initiator, NULL);
+	if (initiator == FALSE) {
+		gchar *message = g_strdup_printf("%s wishes to start a "
+				"media session with you\n", screenname);
+		purple_request_accept_cancel(media, "Media invitation",
+				message, NULL, 1, (void*)pc, screenname,
+				NULL, media, purple_media_accept,
+				purple_media_reject);
+		g_free(message);
+	} else
+		gtk_widget_show(GTK_WIDGET(gtkmedia));
+
 	return TRUE;
 }