Warning on empty trash [was Re: feature freeze]



Il giorno ven, 21-01-2005 alle 15:02 +0100, Alexander Larsson ha
scritto:
> On Fri, 2005-01-21 at 12:51 +0100, Luca Ferretti wrote:
> > Il giorno ven, 21-01-2005 alle 11:42 +0100, Alexander Larsson ha
> > scritto:
> > > We're currently in a feature freeze. The difference between fixing a bug
> > > and adding a feature is sometimes small, and some of the latest patches
> > > I've been committing  could be argued to be features. Since I was away
> > > for such a long time during the non-feature-frozen period I've been a
> > > bit lenient about this until now.
> > > 
> > > However, from now we need to take the feature freeze seriously and
> > > mainly work on fixing actual bugs.
> > 
> > What about change GTK_DIALOG_QUESTION in GTK_DIALOG_WARNING for
> > confirmation alerts? I.e. for the empty trash confirmation?
> > 
> > Note that HIG suggest the warning icon [1], while currently a lot of
> > GNOME projects still use the question one.
> 
> What about it? It sounds like a bugfix to me.

Using the new MessageDialog API? See attachment.

Note 1: the patch changes only the empty trash confirmation alert. Other
alerts could need simply a s/GTK_MESSAGE_QUESTION/GTK_MESSAGE_WARNING

Note 2 eel-stock-dialogs.h is used deeply in nautilus. Maybe a target
for the next release could be drop out this dependance and move to
GtkMessageDialog or at lease use GtkMessageDialog in eel-alert-dialog.c
and provide HIG compliant alerts.


-- 
Luca Ferretti <elle uca libero it>
diff -Naur /usr/src/GNOME/CVS/nautilus/libnautilus-private/nautilus-file-operations.c nautilus/libnautilus-private/nautilus-file-operations.c
--- /usr/src/GNOME/CVS/nautilus/libnautilus-private/nautilus-file-operations.c	2005-01-14 13:15:59.000000000 +0100
+++ nautilus/libnautilus-private/nautilus-file-operations.c	2005-01-21 16:52:11.414056632 +0100
@@ -39,6 +39,7 @@
 
 #include <gnome.h>
 #include <gtk/gtklabel.h>
+#include <gtk/gtkmessagedialog.h>
 #include <libgnomevfs/gnome-vfs-async-ops.h>
 #include <libgnomevfs/gnome-vfs-find-directory.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
@@ -2544,10 +2545,9 @@
 confirm_empty_trash (GtkWidget *parent_view)
 {
 	GtkWidget *dialog;
-	int response;
-	GtkWidget *hbox, *vbox, *image, *label, *button;
-	gchar     *str;
+	GtkWidget *button;
 	GdkScreen *screen;
+	int response;
 
 	/* Just Say Yes if the preference says not to confirm. */
 	if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH)) {
@@ -2556,13 +2556,21 @@
 	
 	screen = gtk_widget_get_screen (parent_view);
 
-	dialog = gtk_dialog_new ();
+	dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+					 GTK_MESSAGE_WARNING,
+					 GTK_BUTTONS_NONE,
+					 _("Empty all of the items from "
+					   "the trash?"));
+	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+						  _("If you choose to empty "
+						    "the trash, all items in "
+						    "it will be permanently "
+						    "lost. Please note that "
+						    "you can also delete them "
+						    "sepately."));
+
 	gtk_window_set_screen (GTK_WINDOW (dialog), screen);
 	atk_object_set_role (gtk_widget_get_accessible (dialog), ATK_ROLE_ALERT);
-	gtk_window_set_title (GTK_WINDOW (dialog), "");
-	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 	gtk_window_set_wmclass (GTK_WINDOW (dialog), "empty_trash",
 				"Nautilus");
 
@@ -2570,55 +2578,11 @@
         gtk_widget_realize (dialog);
 	gdk_window_set_transient_for (GTK_WIDGET (dialog)->window,
 				      gdk_screen_get_root_window (screen));
-	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-	
-	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
-	hbox = gtk_hbox_new (FALSE, 12);
-	gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
-	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_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-	gtk_widget_show (image);
-	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
-
-	vbox = gtk_vbox_new (FALSE, 12);
-	gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
-	gtk_widget_show (vbox);
-
-	str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", 
-		_("Are you sure you want to empty "
-		"all of the items from the trash?"), 
-		"</span>", 
-		NULL);
-		
-	label = gtk_label_new (str);  
-	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-	gtk_widget_show (label);
-	g_free (str);
-
-	label = gtk_label_new (_("If you empty the trash, items "
-		"will be permanently deleted."));
-	
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-	gtk_widget_show (label);
 
 	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);
+	button = gtk_button_new_with_mnemonic (_("_Empty Trash"));
 	gtk_widget_show (button);
 	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
 


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