changeset 29395:8594fde2ace3

Display a confirmation prompt when attempting to clear the whiteboard. Fixes #7746. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author kartikmohta@gmail.com
date Tue, 09 Feb 2010 06:21:52 +0000
parents d1cecbc467c6
children bafc2a8bb747
files pidgin/gtkwhiteboard.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkwhiteboard.c	Tue Feb 09 06:19:49 2010 +0000
+++ b/pidgin/gtkwhiteboard.c	Tue Feb 09 06:21:52 2010 +0000
@@ -738,12 +738,24 @@
 {
 	PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data);
 
-	pidgin_whiteboard_clear(gtkwb->wb);
+	/* Confirm whether the user really wants to clear */
+	GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(gtkwb->window),
+											   GTK_DIALOG_DESTROY_WITH_PARENT,
+											   GTK_MESSAGE_QUESTION,
+											   GTK_BUTTONS_YES_NO,
+											   _("Do you really want to clear?"));
+	gint response = gtk_dialog_run(GTK_DIALOG(dialog));
+	gtk_widget_destroy(dialog);
 
-	pidgin_whiteboard_set_canvas_as_icon(gtkwb);
+	if (response == GTK_RESPONSE_YES)
+	{
+		pidgin_whiteboard_clear(gtkwb->wb);
 
-	/* Do protocol specific clearing procedures */
-	purple_whiteboard_send_clear(gtkwb->wb);
+		pidgin_whiteboard_set_canvas_as_icon(gtkwb);
+
+		/* Do protocol specific clearing procedures */
+		purple_whiteboard_send_clear(gtkwb->wb);
+	}
 }
 
 static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data)