changeset 28204:58c8d6fc3aaf

Close the colour selection dialog when the whiteboard window is closed. Fixes #9867.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 09 Aug 2009 05:17:11 +0000
parents da22b6d0151e
children f05c87f3121e 2f7386e1c5d1
files pidgin/gtkwhiteboard.c
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkwhiteboard.c	Sun Aug 09 00:15:14 2009 +0000
+++ b/pidgin/gtkwhiteboard.c	Sun Aug 09 05:17:11 2009 +0000
@@ -273,6 +273,7 @@
 static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb)
 {
 	PidginWhiteboard *gtkwb;
+	GtkWidget *colour_dialog;
 
 	g_return_if_fail(wb != NULL);
 	gtkwb = wb->ui_data;
@@ -287,6 +288,12 @@
 		gtkwb->pixmap = NULL;
 	}
 
+	colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog");
+	if (colour_dialog) {
+		gtk_widget_destroy(colour_dialog);
+		g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL);
+	}
+
 	if(gtkwb->window)
 	{
 		gtk_widget_destroy(gtkwb->window);
@@ -804,7 +811,7 @@
 	{
 		gtk_widget_destroy(dialog);
 
-		purple_debug_info("gtkwhiteboard", "File not Saved... Canceled\n");
+		purple_debug_info("gtkwhiteboard", "File not Saved... Cancelled\n");
 	}
 }
 
@@ -848,9 +855,11 @@
 	purple_whiteboard_send_brush(wb, old_size, new_color);
 }
 
-static void color_selection_dialog_destroy(GtkWidget *w, GtkWidget *destroy)
+static void color_selection_dialog_destroy(GtkWidget *w, PidginWhiteboard *gtkwb)
 {
-	gtk_widget_destroy(destroy);
+	GtkWidget *dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog");
+	gtk_widget_destroy(dialog);
+	g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL);
 }
 
 static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb)
@@ -859,6 +868,7 @@
 	GtkColorSelectionDialog *dialog;
 
 	dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color"));
+	g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog);
 
 	g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed",
 					G_CALLBACK(change_color_cb), gtkwb);
@@ -867,7 +877,7 @@
 	gtk_widget_destroy(dialog->help_button);
 
 	g_signal_connect(G_OBJECT(dialog->ok_button), "clicked",
-					G_CALLBACK(color_selection_dialog_destroy), dialog);
+					G_CALLBACK(color_selection_dialog_destroy), gtkwb);
 
 	gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE);