After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 130237 - HIGgify revert dialog
HIGgify revert dialog
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2003-12-30 19:24 UTC by Paolo Borelli
Modified: 2005-08-15 01:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
higgify revert dialog (1.38 KB, patch)
2003-12-30 19:26 UTC, Paolo Borelli
none Details | Review
updated (2.60 KB, patch)
2004-01-05 18:14 UTC, Paolo Borelli
none Details | Review

Description Paolo Borelli 2003-12-30 19:24:19 UTC
As discussed on irc, here is a small patch to HIGgify the "revert" alert
dialog.
I also slightly changed the string: Removed the "Do you want to" and used
"file" instead of 'file', since it's similar to the examples in the HIG.
Comment 1 Paolo Borelli 2003-12-30 19:26:03 UTC
Created attachment 22779 [details] [review]
higgify revert dialog
Comment 2 Paolo Maggi 2003-12-31 00:30:30 UTC
The patch looks good.

I'm not sure removing "Do you want to " is a good idea. 

Please, ask to an english speaking guy on IRC and commit.

Thanks,
Paolo
Comment 3 Paolo Borelli 2003-12-31 11:32:59 UTC
According to various people on #gnome removing the "Do you want to" is
fine, since "Do you ..." leads to "Yes" or "No" response buttons,
while omitting it leads to "Revert" response.

Anyway since #usability was silent at the moment, so I'm cc'ing
usability for a final response.
Comment 4 Gregory Merchan 2003-12-31 12:13:38 UTC
You can omit the item if your users don't need it.

If you keep it, let the user have some measure of how much will change
by indicating when to file was last saved, how much time has passed,
or something like "%d lines will be lost and %d lines will be changed."
An alternative button could allow the user to see a diff instead.

Removing the limits from Undo/Redo, so that the user can either redo
all the changes or undo the reversion, would allow you to eliminate
this alert entirely.
Comment 5 Paolo Borelli 2003-12-31 12:49:38 UTC
(copying some of the comments I made on IRC)

I'm not sure about other peoples, but I never used/noticed the Revert
item myself: the few times I needed to restart from scratch with a
file I just closed the file and reopened it from the list of recently
opened docs.


If it stays:

- maybe the secondary message could become "Changes made to the file
will be lost" instead of "You will not be able to undo this operation"
(of course adding "... changes made in the last x minutes... would be
even better)

- providing a diff button: not sure... it's a nice idea but probably
it's overkill, beside the "diff" plugin is in a separate package
(gedit-plugins)

- undo: beside being (probably) hard to implement (you are reloading
the file from disk, not making changes to the current loaded doc), I
don't think it's really necessary; IMHO the user is really saying:
"Hey I really mean to throw this crap away and restart from scratch!".
Beside even if the action could be undoed, I'm not sure if the alert
dialog telling the user that he is reverting all the changes he made
could be removed.
Comment 6 Paolo Maggi 2004-01-01 17:51:29 UTC
I think it should stay.

About the other comments, I agree with Paolo B.

- I think the secondary message should become "Changes made to the
document in the last X minutes will be definitively lost"

- about the "Diff" button: I think it is overkill. Would be a normal
user able to read a diff file?

- undo: it cannot be easily implemented with the current undo manager
in a memory safe way
Comment 7 Paolo Maggi 2004-01-02 00:10:06 UTC
Giving a look at conglomerate code I saw the following function:

GtkDialog *cong_dialog_revert_confirmation_alert_new(GtkWindow *parent, 
						     const gchar *document_name,
						     glong seconds_since_last_save_or_load)
{
	GtkWidget *dialog, *content;
	gchar *primary_text, *secondary_text;
	glong minutes;

	g_return_val_if_fail(document_name, NULL);

	dialog = gtk_dialog_new_with_buttons(NULL, /* empty title string */
					     parent,
					     GTK_DIALOG_MODAL,

					     GTK_STOCK_CANCEL,
					     CONG_REVERT_CONFIRMATION_RESULT_CANCEL,

					     GTK_STOCK_REVERT_TO_SAVED,
					     CONG_REVERT_CONFIRMATION_RESULT_REVERT,

					     NULL);
	gtk_dialog_set_default_response(GTK_DIALOG(dialog),
					CONG_REVERT_CONFIRMATION_RESULT_REVERT);
					
	gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);

	primary_text = g_strdup_printf(_("Revert unsaved changes to document
\"%s\"?"), document_name);

	minutes = seconds_since_last_save_or_load/60;

	if (minutes>120) {
		secondary_text = g_strdup_printf(_("Changes from the past %li hours
will be discarded."), (minutes/60));
	} else if (minutes>1) {
		secondary_text = g_strdup_printf(_("Changes from the past %li
minutes will be discarded."), minutes);
	} else {
		secondary_text = g_strdup_printf(_("Changes from the past minute
will be discarded."));
	}

	content = cong_alert_content_new(GTK_STOCK_DIALOG_WARNING,
					 primary_text, 
					 secondary_text, 
					 NULL);


	g_free(primary_text);
	g_free(secondary_text);

	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), content);
	gtk_widget_show_all(dialog);

	return GTK_DIALOG(dialog);
}

They use "Revert unsaved changes to document \"%s\"?" as primary text.
I like it. I still prefer the text I suggested in my previous comment
as secondary text.
I don't like very much the way they have implemented the function.
First of all ngettext should be used. Second, I'd prefer to manage
hours and seconds too.

If seconds < 60 use seconds only (i.e. in the last xx seconds)
If seconds (60, 90) use "in the last minute"
if seconds [90, 120] use "in the last two minutes"
if seconds (120, 3600) use "in the last xx minutes"
if seconds [3600, 7200) use "in the last hour and xx minutes"
if seconds >= 7200 use in the last xx hours

Comment 8 Paolo Maggi 2004-01-02 00:36:09 UTC
I have just added to gedit-document.[ch] the following function:

glong gedit_document_get_seconds_since_last_save_or_load
(GeditDocument *doc);
Comment 9 alexander.winston 2004-01-05 10:08:39 UTC
Adding the HIG keyword.
Comment 10 Paolo Borelli 2004-01-05 18:13:38 UTC
Here is an updated patch. As discussed on irc it only handles seconds
and minutes.

Some doubts I have about it:

+	if (seconds < 1)
+		seconds = 1;
+
paranoid? 



+		secondary_msg = g_strdup_printf (ngettext ("Changes made in the
last second will be definitively lost",
+							   "Changes made in the last %li seconds will be definitively
lost",
+	
Is it ok for ngettext/translators that the singular case doesn't use
%li seconds at all?



+		secondary_msg = g_strdup_printf (_("Changes made in the last %li
minutes will be definitively lost"),
+						 seconds/60 + 1);
+
Should use ngettext anyway even if it doesn't have a singular case? If
yes how?



Last note that I used (seconds/60 + 1) so that 1 min 26 secs is
reported as 2 minutes. Ok?

Comment 11 Paolo Borelli 2004-01-05 18:14:43 UTC
Created attachment 22948 [details] [review]
updated
Comment 12 Paolo Borelli 2004-01-05 18:17:50 UTC
(oops of course \n\n must be removed from primary_msg)
Comment 13 Paolo Maggi 2004-01-09 11:12:46 UTC
Fixed it in my local copy.

I have only a doubt:

Using the Revert command you can also Reload an unmodified file from
the disk. Think to this scenario:
1. cvs -z3 up -Pd (on terminal)
2. File->Revert (on gedit)

In this way you can reload the current document and eventually get a
newer version.
Are the messages "Revert unsaved changes to document \"%s\"?" and
"Changes made to the document in the last X minutes will be
definitively lost" correct in this case too? Also in the case the
document in gedit in "unmodified" but different from the on-disk file.
Comment 14 Paolo Maggi 2004-01-12 17:03:57 UTC
Fixed in CVS HEAD.