pidgin.vv: c4a6cbd2: Convert PidginMedia to use the state-cha...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Tue Jan 13 06:35:56 EST 2009


-----------------------------------------------------------------
Revision: c4a6cbd29e988622dcec3545e731f03b7ffcd06a
Ancestor: fc5fe0f88226b374c4d42d65ed90e97a059f4d0f
Author: maiku at soc.pidgin.im
Date: 2009-01-13T08:40:27
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/c4a6cbd29e988622dcec3545e731f03b7ffcd06a

Modified files:
        libpurple/media.c pidgin/gtkmedia.c

ChangeLog: 

Convert PidginMedia to use the state-changed signal.

-------------- next part --------------
============================================================
--- libpurple/media.c	a4fba0042db41ed308ecd5e9687fb63ac2ec8591
+++ libpurple/media.c	8e0d49b46b87817c35303c9a2069efabcd3a5765
@@ -1318,7 +1318,6 @@ purple_media_hangup(PurpleMedia *media)
 	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 			0, PURPLE_MEDIA_STATE_CHANGED_END,
 			NULL, NULL);
-	g_signal_emit(media, purple_media_signals[HANGUP], 0);
 }
 
 void
@@ -1330,7 +1329,6 @@ purple_media_reject(PurpleMedia *media)
 	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 			0, PURPLE_MEDIA_STATE_CHANGED_END,
 			NULL, NULL);
-	g_signal_emit(media, purple_media_signals[REJECT], 0);
 }
 
 void
@@ -1345,7 +1343,6 @@ purple_media_got_hangup(PurpleMedia *med
 	g_signal_emit(media, purple_media_signals[STATE_CHANGED],
 			0, PURPLE_MEDIA_STATE_CHANGED_END,
 			NULL, NULL);
-	g_signal_emit(media, purple_media_signals[GOT_HANGUP], 0);
 }
 
 void
============================================================
--- pidgin/gtkmedia.c	3784f8db846aedcd337587b3d5348da4768dd2ff
+++ pidgin/gtkmedia.c	f85b325dc1aa272dc8be817089bd45571e5ddd78
@@ -564,13 +564,6 @@ static void
 }
 
 static void
-pidgin_media_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
-	pidgin_media_emit_message(gtkmedia, _("You have ended the call."));
-	gtk_widget_destroy(GTK_WIDGET(gtkmedia));
-}
-
-static void
 pidgin_media_got_request_cb(PurpleMedia *media, PidginMedia *gtkmedia)
 {
 	PurpleMediaSessionType type = purple_media_get_overall_type(media);
@@ -594,20 +587,26 @@ static void
 }
 
 static void
-pidgin_media_got_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia)
+pidgin_media_state_changed_cb(PurpleMedia *media,
+		PurpleMediaStateChangedType type,
+		gchar *sid, gchar *name, PidginMedia *gtkmedia)
 {
-	pidgin_media_emit_message(gtkmedia, _("The call has been terminated."));
-	gtk_widget_destroy(GTK_WIDGET(gtkmedia));
+	purple_debug_info("gtkmedia", "type: %d sid: %s name: %s\n",
+			type, sid, name);
+	if (sid == NULL && name == NULL) {
+		if (type == PURPLE_MEDIA_STATE_CHANGED_END) {
+			pidgin_media_emit_message(gtkmedia,
+					_("The call has been terminated."));
+			gtk_widget_destroy(GTK_WIDGET(gtkmedia));
+			
+		} else if (type == PURPLE_MEDIA_STATE_CHANGED_REJECTED) {
+			pidgin_media_emit_message(gtkmedia,
+					_("You have rejected the call."));
+		}
+	}
 }
 
 static void
-pidgin_media_reject_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
-	pidgin_media_emit_message(gtkmedia, _("You have rejected the call."));
-	gtk_widget_destroy(GTK_WIDGET(gtkmedia));
-}
-
-static void
 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
 	PidginMedia *media;
@@ -635,16 +634,12 @@ pidgin_media_set_property (GObject *obje
 				G_CALLBACK(pidgin_media_ready_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media) ,"wait",
 				G_CALLBACK(pidgin_media_wait_cb), media);
-			g_signal_connect(G_OBJECT(media->priv->media), "hangup",
-				G_CALLBACK(pidgin_media_hangup_cb), media);
-			g_signal_connect(G_OBJECT(media->priv->media), "reject",
-				G_CALLBACK(pidgin_media_reject_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), "got-hangup",
-				G_CALLBACK(pidgin_media_got_hangup_cb), media);
 			g_signal_connect(G_OBJECT(media->priv->media), "got-accept",
 				G_CALLBACK(pidgin_media_accept_cb), media);
+			g_signal_connect(G_OBJECT(media->priv->media), "state-changed",
+				G_CALLBACK(pidgin_media_state_changed_cb), media);
 			break;
 		case PROP_SCREENNAME:
 			if (media->priv->screenname)


More information about the Commits mailing list