Mercurial > pidgin
changeset 26007:6c8eabbef4d3
Fix crash when moving a tab with video.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 08 Jan 2009 00:24:11 +0000 |
parents | d703474d6b81 |
children | dd3bdf691623 |
files | pidgin/gtkmedia.c |
diffstat | 1 files changed, 51 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkmedia.c Wed Jan 07 20:18:44 2009 +0000 +++ b/pidgin/gtkmedia.c Thu Jan 08 00:24:11 2009 +0000 @@ -362,6 +362,25 @@ 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) { @@ -413,13 +432,28 @@ 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 @@ 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);