[patch] small cleanup in libnautilus-private/file-operations.c



A small code cleanup in
libnautilus-private/file-operations.c::confirm_empty_trash(). It
replaces the hancrafted message dialog with a call to
eel_create_question_dialog(): the result is unchanged.
Beside being a trivial code cleanup, it has the advantage that this
dialog would inherit any HIG improvements made to the eel function (e.g.
removal of the separator).

The patch has been diffed and tested some time ago, but I verified that
it still applies cleanly.

ciao
	paolo
--- cvs/gnome2/nautilus/libnautilus-private/nautilus-file-operations.c	2003-01-30 11:25:38.000000000 +0100
+++ nautilus/libnautilus-private/nautilus-file-operations.c	2003-01-30 11:30:48.000000000 +0100
@@ -2249,52 +2249,23 @@ do_empty_trash (GtkWidget *parent_view)
 static gboolean
 confirm_empty_trash (GtkWidget *parent_view)
 {
-	GtkWidget *dialog;
+	GtkDialog *dialog;
 	GtkWindow *parent_window;
 	int response;
-	GtkWidget *hbox, *image, *label, *button;
 
 	/* Just Say Yes if the preference says not to confirm. */
 	if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH)) {
 		return TRUE;
 	}
-	
-	parent_window = GTK_WINDOW (gtk_widget_get_toplevel (parent_view));
 
-	dialog = gtk_dialog_new ();
-	gtk_window_set_title (GTK_WINDOW (dialog), _("Empty Trash"));
-	gtk_window_set_wmclass (GTK_WINDOW (dialog), "empty_trash",
-				"Nautilus");
-	gtk_window_set_transient_for (GTK_WINDOW (dialog),
-				      GTK_WINDOW (parent_window));
-
-	hbox = gtk_hbox_new (FALSE, 6);
-	gtk_widget_show (hbox);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
-			    FALSE, FALSE, 0);
-
-	image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
-					  GTK_ICON_SIZE_DIALOG);
-	gtk_widget_show (image);
-	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
-
-	label = gtk_label_new (_("Are you sure you want to permanently delete "
-				 "all of the items in the Trash?"));
-	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-	gtk_widget_show (label);
-	gtk_box_pack_start (GTK_BOX (hbox), label,
-			    TRUE, TRUE, 0);
-
-	gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL,
-			       GTK_RESPONSE_CANCEL);
-
-	button = eel_gtk_button_new_with_stock_icon (_("_Empty"),
-						     GTK_STOCK_DELETE);
-	gtk_widget_show (button);
-	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+	parent_window = GTK_WINDOW (gtk_widget_get_toplevel (parent_view));
 
-	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
-				      GTK_RESPONSE_YES);
+	dialog = eel_create_question_dialog (_("Are you sure you want to permanently delete "
+					       "all of the items in the Trash?"),
+					     _("Empty Trash"),
+					     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					     GTK_STOCK_DELETE, GTK_RESPONSE_YES,
+					     GTK_WINDOW (parent_window));
 
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog),
 					 GTK_RESPONSE_YES);


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