[gtk/wip/otte/undo: 13/17] undocommand: Don't merge commands that are too far apart



commit 3b11dcf442496b8c7535fa31fb96b6ca68bc352e
Author: Benjamin Otte <otte redhat com>
Date:   Mon Aug 17 06:58:43 2015 +0200

    undocommand: Don't merge commands that are too far apart
    
    For now, too far apart means 5 seconds. This was decided completely
    arbitrarily by me to have a number to test with.

 gtk/gtkundocommand.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkundocommand.c b/gtk/gtkundocommand.c
index c3688178a0..bbc60efabf 100644
--- a/gtk/gtkundocommand.c
+++ b/gtk/gtkundocommand.c
@@ -107,6 +107,12 @@ gboolean
 gtk_undo_command_real_should_merge (GtkUndoCommand *command,
                                     GtkUndoCommand *followup)
 {
+  GtkUndoCommandPrivate *command_priv = gtk_undo_command_get_instance_private (command);
+  GtkUndoCommandPrivate *followup_priv = gtk_undo_command_get_instance_private (followup);
+
+  if (followup_priv->timestamp - command_priv->timestamp > 5 * G_USEC_PER_SEC)
+    return FALSE;
+
   return TRUE;
 }
 


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