pidgin.vv: e13834da: Fix crash when moving a tab with video.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Wed Jan 7 19:31:22 EST 2009


-----------------------------------------------------------------
Revision: e13834da8fb12496c12a2b1bbee9fd93028a75b1
Ancestor: ba535b40360bb540f8cf7e2dfcf181882cf9811c
Author: maiku at soc.pidgin.im
Date: 2009-01-08T00:24:11
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/e13834da8fb12496c12a2b1bbee9fd93028a75b1

Modified files:
        pidgin/gtkmedia.c

ChangeLog: 

Fix crash when moving a tab with video.

-------------- next part --------------
============================================================
--- pidgin/gtkmedia.c	b1dfdba124a88372233dc6e2c7d92251f43923b8
+++ pidgin/gtkmedia.c	c16fe158c9e4c2532eb7b3103da2c5c304d30d5c
@@ -362,7 +362,26 @@ pidgin_media_error_cb(PidginMedia *media
 	g_signal_emit(gtkmedia, pidgin_media_signals[ERROR], 0, error);
 }
 
+static gboolean
+plug_delete_event_cb(GtkWidget *widget, gpointer data)
+{
+	return TRUE;
+}
+
+static gboolean
+plug_removed_cb(GtkWidget *widget, gpointer data)
+{
+	return TRUE;
+}
+
 static void
+socket_realize_cb(GtkWidget *widget, gpointer data)
+{
+	gtk_socket_add_id(GTK_SOCKET(widget),
+			gtk_plug_get_id(GTK_PLUG(data)));
+}
+
+static void
 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia)
 {
 	GstElement *pipeline = purple_media_get_pipeline(media);
@@ -413,13 +432,28 @@ pidgin_media_ready_cb(PurpleMedia *media
 	if (videorecvbool) {
 		GtkWidget *aspect;
 		GtkWidget *remote_video;
+		GtkWidget *plug;
+		GtkWidget *socket;
 
 		aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE);
 		gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
 		gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0);
 
+		plug = gtk_plug_new(0);
+		g_signal_connect(G_OBJECT(plug), "delete-event",
+				G_CALLBACK(plug_delete_event_cb), plug);
+		gtk_widget_show(plug);
+
+		socket = gtk_socket_new();
+		g_signal_connect(G_OBJECT(socket), "realize",
+				G_CALLBACK(socket_realize_cb), plug);
+		g_signal_connect(G_OBJECT(socket), "plug-removed",
+				G_CALLBACK(plug_removed_cb), NULL);
+		gtk_container_add(GTK_CONTAINER(aspect), socket);
+		gtk_widget_show(socket);
+
 		remote_video = gtk_drawing_area_new();
-		gtk_container_add(GTK_CONTAINER(aspect), remote_video);
+		gtk_container_add(GTK_CONTAINER(plug), remote_video);
 		gtk_widget_set_size_request (GTK_WIDGET(remote_video), 100, -1);
 		gtk_widget_show(remote_video);
 		gtk_widget_show(aspect);
@@ -429,16 +463,30 @@ pidgin_media_ready_cb(PurpleMedia *media
 	if (videosendbin) {
 		GtkWidget *aspect;
 		GtkWidget *local_video;
+		GtkWidget *plug;
+		GtkWidget *socket;
 
 		aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE);
 		gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
 		gtk_box_pack_start(GTK_BOX(send_widget), aspect, TRUE, TRUE, 0);
 
+		plug = gtk_plug_new(0);
+		g_signal_connect(G_OBJECT(plug), "delete-event",
+				G_CALLBACK(plug_delete_event_cb), plug);
+		gtk_widget_show(plug);
+
+		socket = gtk_socket_new();
+		g_signal_connect(G_OBJECT(socket), "realize",
+				G_CALLBACK(socket_realize_cb), plug);
+		g_signal_connect(G_OBJECT(socket), "plug-removed",
+				G_CALLBACK(plug_removed_cb), NULL);
+		gtk_container_add(GTK_CONTAINER(aspect), socket);
+		gtk_widget_show(socket);
+
 		local_video = gtk_drawing_area_new();
 		g_signal_connect(G_OBJECT(local_video), "realize",
 				G_CALLBACK(realize_cb), videosendbin);
-
-		gtk_container_add(GTK_CONTAINER(aspect), local_video);
+		gtk_container_add(GTK_CONTAINER(plug), local_video);
 		gtk_widget_set_size_request (GTK_WIDGET(local_video), 100, -1);
 
 		gtk_widget_show(local_video);


More information about the Commits mailing list