Undo Close Tab

Registered by Julien Spautz

As reported in bug #1020350, granite should provide a way to restore closed tabs in our dynamic notebook widget. This blueprint summarizes all the UX and API changes.

----- UX/GUI changes -----

Ways to restore the last closed tab:

· [Keyboard] Shift + Ctrl + T
· [Mouse] Middle click on empty space in tab bar
· [Menu] Right click on empty space in tab bar reveals a menu, let's add something like "Restore Tab"

Note: closed tabs are saved in a stack-like way. When closing a tab, it is "pushed" on the stack, when restored, it is "popped" from the stack. When a duplicated tab is closed, it should be pushed on the stack and the duplicate should be removed. (It's not really a stack but a GLib.List)

Restoring any tab:

· There should be a little down facing arrow on the right side of the tab bar that reveals a menu when clicked, displaying all closed tabs in reversed order, i.e., last closed tab on top. When clicking an entry from this menu, remove it from the list and restore the tab.

When there is no tab to be restored:

· Keyboard and mouse shortcuts have no effect
· "Restore Tab" menu item and arrow on the right are insensitive, but still visible

When the app doesn't support restoring tabs:

· No changes at all to the way the app currently behaves

----- API changes -----

· To activate restoring tabs, "allow_restoring" in DynamicNotebook has to be set to true, default is false, so we don't break any apps.
· Every Granite.Widgets.Tab stores a string with information about it's content, called "data".
· When a tab is restored, create an empty tab and emit the signal "void tab_restored (Tab tab, string data);"

Note about the "data" thing:

Considering the use cases of dynamic tabs …

· Display files (Scratch, GIMP and pretty much every app the uses tabs)
· Display Websites (Any web browser)
· Display contents of a folder (Any file manager)
· Contain a terminal emulator, also connected to a folder (working directory)

… associating a string (data) to every tab should be enough information for the client app to restore the tab correctly since all these things can be stored as paths or URLs, i.e., as strings.

Blueprint information

Status:
Complete
Approver:
David Gomes
Priority:
Medium
Drafter:
elementary Application Drivers
Direction:
Approved
Assignee:
Julien Spautz
Definition:
New
Series goal:
Accepted for trunk
Implementation:
Implemented
Milestone target:
milestone icon 0.2
Started by
David Gomes
Completed by
Julien Spautz

Whiteboard

Sounds pretty good! I would recommend the string "Undo close tab". Even though the language is not as fluid sounding, I think it's more indicative of what the feature actually does. Also instead of a down arrow, I would suggest using "user-trash-symbolic" to keep with what users already know of the trash in Files, Shotwell, etc --DanRabbit

This seems like it's very well described Julien, good job. Overall, we just replicate the behavior of other big apps like Firefox or Chromium. -- Munchor

"Restore Last Tab" may also work. Or "Re-open last tab".

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.