[DynamicNotebook] The name of "tab_removed" signal is misleading
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Granite |
Fix Released
|
High
|
Niclas Lockner |
Bug Description
From the current trunk (http://
public void remove_tab (Tab tab) {
if (Signal.
var sure = tab_removed (tab);
if (!sure)
}
var pos = get_tab_position (tab);
if (pos != -1)
}
"tab_removed" is emitted before deleting the tab in cuestion, with the apparent purpose of letting a developer interfere with the event of a tab removal, up tthiso the point of cancelling the tab removal altogether. So, in the end, maybe a tab wasn't removed at all.
In light of its purpose, a more sensible name for the signal would be something along the lines of "tab_removal_
Related branches
- David Gomes (community): Approve
- Mario Guerriero: Pending requested
-
Diff: 598 lines (+168/-121)2 files modifieddemo/GraniteDemo.vala (+14/-8)
lib/Widgets/DynamicNotebook.vala (+154/-113)
Changed in granite: | |
status: | New → Confirmed |
Changed in granite: | |
importance: | Undecided → High |
milestone: | none → 0.3-beta1 |
tags: | added: dynamic-notebook pantheon-files |
summary: |
- DynamicNotebook emits tab_removed signal before actually deleting a tab + [DynamicNotebook] The name of "tab_removed" signal is misleading |
description: | updated |
Changed in granite: | |
assignee: | Casper Christiansen (fault) → nobody |
status: | In Progress → Confirmed |
Changed in granite: | |
assignee: | nobody → Niclas Lockner (niclasl) |
Changed in granite: | |
status: | Confirmed → In Progress |
Changed in granite: | |
status: | In Progress → Fix Released |
A concrete example:
I was experimenting with using DynamicNotebook in pantheon-files.
I wanted to bake the tab bar disappear whenever there were only one tab.
I connected an anonym function to the tab_removed signal, which would hide the tab bar when the number of tabs reached one.
When there are two tabs, and one of them is closed, the anonym function reports that there are still two tabs (because the signal is fired up before actually closing the tab) and so, it doesn't work.