bug-buddy r2591 - trunk/src



Author: diegoe
Date: Sun Aug  3 21:39:25 2008
New Revision: 2591
URL: http://svn.gnome.org/viewvc/bug-buddy?rev=2591&view=rev

Log:
Ask for confirmation when sending a too short desc

To avoid the usual flood of reports without a description, this dialog will try
to get users to think again about sending a description less than 10 chars.
Hopefully they will click Review description and send something more useful.


Modified:
   trunk/src/bug-buddy.c

Modified: trunk/src/bug-buddy.c
==============================================================================
--- trunk/src/bug-buddy.c	(original)
+++ trunk/src/bug-buddy.c	Sun Aug  3 21:39:25 2008
@@ -66,6 +66,7 @@
 #define GTK_THEME_KEY	"/desktop/gnome/interface/gtk_theme"
 #define ICON_THEME_KEY  "/desktop/gnome/interface/icon_theme"
 #define DESKTOP_IS_HOME_DIR "/apps/nautilus/preferences/desktop_is_home_dir"
+#define MIN_REPORT_DETAILS_CHARS 10
 
 static GOptionData gopt_data;
 static int bug_count = 0;
@@ -993,21 +994,83 @@
 	GnomeVersionInfo *gnome_version;
 	GtkRequisition requisition;
 	GtkBuilder *ui = (GtkBuilder*) data;
+	GtkWidget *details;
+	int i;
 
 	app = g_object_get_data (G_OBJECT (ui), "app");
 	gnome_version = g_object_get_data (G_OBJECT (ui), "gnome-version");
 
-	/* hide the send button immediately so that the user can't click
-	 * it more than once (this will create multiple bugs) */
-	gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (ui, "send-button")));
+	details = GTK_WIDGET (gtk_builder_get_object (ui, "details-view"));
+	i = gtk_text_buffer_get_char_count (
+			gtk_text_view_get_buffer (GTK_TEXT_VIEW (details)));
+
+	if (i < MIN_REPORT_DETAILS_CHARS)
+	{
+		GtkWidget *dialog;
+		GtkWidget *button;
+		GtkWidget *icon;
+
+		int i;
+
+		dialog = gtk_message_dialog_new (NULL, 
+				GTK_DIALOG_MODAL, 
+				GTK_MESSAGE_INFO,
+				GTK_BUTTONS_NONE,
+				_("The description you provided for the \
+crash is very short. Are you sure you want to send it?"));
+
+		/* Secondary text */
+		gtk_message_dialog_format_secondary_text 
+			(GTK_MESSAGE_DIALOG (dialog),
+			 _("A short description is probably not of much help \
+to the developers investigating your report. If you provide a better one, for \
+instance specifying a way to reproduce the crash, the issue can be more \
+easily resolved"));
+
+		/* Review button */
+		button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+						_("Review description"),
+						GTK_RESPONSE_CANCEL);
+		icon = gtk_image_new_from_stock 
+				(GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON);
+		gtk_button_set_image (GTK_BUTTON (button), icon);
+		gtk_widget_show (button);
+
+		/* Send anyway button */
+		button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+						_("Send anyway"),
+						GTK_RESPONSE_OK);
+		icon = gtk_image_new_from_stock 
+				(GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON);
+		gtk_button_set_image (GTK_BUTTON (button), icon);
+		gtk_widget_show (button);
 
-	gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (ui, "progressbar")));
-	gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (ui, "final-box")));
-	gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (ui, "review-box")));
+		gtk_dialog_set_default_response (GTK_DIALOG (dialog), 
+						 GTK_RESPONSE_OK);
+		
+		i = gtk_dialog_run (GTK_DIALOG (dialog));
 
-	gtk_widget_size_request (GTK_WIDGET (gtk_builder_get_object (ui, "main-window")), &requisition);
-	gtk_window_resize (GTK_WINDOW (gtk_builder_get_object (ui, "main-window")),
-			   requisition.width, requisition.height);
+		gtk_widget_destroy (dialog);
+
+		if (i != GTK_RESPONSE_OK)
+			return;
+
+	}
+
+	gtk_widget_show (GTK_WIDGET (
+			gtk_builder_get_object (ui, "progressbar")));
+	gtk_widget_hide (GTK_WIDGET (
+			gtk_builder_get_object (ui, "final-box")));
+	gtk_widget_hide (GTK_WIDGET (
+			gtk_builder_get_object (ui, "review-box")));
+
+	gtk_widget_size_request (GTK_WIDGET (
+			gtk_builder_get_object (ui, "main-window")), 
+			&requisition);
+
+	gtk_window_resize (GTK_WINDOW (
+			gtk_builder_get_object (ui, "main-window")),
+			requisition.width, requisition.height);
 			   
 	send_report (app, gnome_version, ui);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]