0

I have an application which contains several GtkSourceView widgets. The main interface is a sheet containing multiple "cells" - each a GtkSourceView. GtkSourceView has built-in support for undo, but each widget has its own "undo stack." I'd like to have the same undo stack across the entire sheet.

For example: Say the last edit was made in SourceView A and the second to last edit was in SourceView B. Regardless of which SourceView has the focus, the first press Ctrl-Z should revert the change in A, and the second press should revert the change in B.

Is there a way I can accomplish this while still keeping multiple SourceView widgets, or am I better off trying to implement this type of undo functionality myself?

Note: I think it'd be too clunky to try to have the entire sheet inside a single SourceView. Also, I'm using Python.

Sam Magura
  • 850
  • 8
  • 18

1 Answers1

2

Yes, bind the Ctrl-Z hotkey to your own Undo menu item, in which you keep track of the order in which the sourceviews were changed, and call the undo method on the appropriate sourceview.

ptomato
  • 56,175
  • 13
  • 112
  • 165