Closed Bug 934443 Opened 11 years ago Closed 11 years ago

CustomizableUI should have events to know when we enter and leave the customization mode

Categories

(Firefox :: Toolbars and Customization, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 28

People

(Reporter: zer0, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

(Whiteboard: [Australis:M?][Australis:P3])

Attachments

(1 file)

Using CustomizableUI we can create widgets that are automatically added across all the existing and new windows.
Plus, the widgets are kept in sync so when they're moved, the position is automatically updated to all windows.

The good thing here is that CustomizableUI abstract the all windows management so that the developer doesn't have to handle manually it.

Unfortunately, it seems that the only way to know when we enter in the customization mode, is add a "beforecustomization" event to all windows, existing and new, and therefore we lost this big advantage of CustomizableUI.

It would be nice to have an event emitted when we enter (and leave) the customization mode, passing the window in customization mode as parameter.
 
In this way the developer doesn't have to keep trace of all the existing windows, and new windows.
Whiteboard: [Australis:M?]
Whiteboard: [Australis:M?] → [Australis:M?][Australis:P3]
I'm not sure whether we should add a generic way to fire notifications or not, because I'm afraid add-ons will abuse/confuse it. So I've added another simple 'gateway method' that fires specific notifications. Mike, what do you think?
Attachment #832876 - Flags: review?(mconley)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
To clarify why this is useful:

[2013-11-04 14:14:36] <ZER0> Gijs, when in australis we enter in customization mode,
[2013-11-04 14:15:14] <ZER0> what is happening to button with special status, like checked button (with pressed status) or download button (meanwhile they're downloading, so with the progress etc)
[2013-11-04 14:16:21] <Gijs> The same thing as with other buttons
[2013-11-04 14:16:29] <Gijs> they get wrapped in toolbarpaletteitems
[2013-11-04 14:16:35] <Gijs> we do remove some attribtues
[2013-11-04 14:16:38] <Gijs> *attributes
[2013-11-04 14:16:43] <Gijs> I don't think checked is one of them.
[2013-11-04 14:16:47] <Gijs> but maybe I'm wrong
[2013-11-04 14:17:06] <ZER0> Gijs, ok so virtually they would kept the status at the moment of the customization?
[2013-11-04 14:17:24] <ZER0> I was wondering what should be the default behavior of sdk button when we enter in customization mode
[2013-11-04 14:17:31] <ZER0> if we should do something special or not.
[2013-11-04 14:17:42] <ZER0> To give you a concrete example,
[2013-11-04 14:17:52] <Gijs> ZER0: ok, so it seems we explicitly uncheck the item
[2013-11-04 14:17:58] <Gijs> http://mxr.mozilla.org/projects-central/source/ux/browser/components/customizableui/src/CustomizeMode.jsm#437
[2013-11-04 14:18:02] <ZER0> imaging that you have a button with a green icon, and when you click it you make it red,
[2013-11-04 14:18:08] <Gijs> ZER0: we'll restore the state when customize mode is done
[2013-11-04 14:18:34] <Gijs> ZER0: so if the state changes during customize mode, you probably want to queue those updates and apply them when customize mode is finished
[2013-11-04 14:18:53] <ZER0> if we enter in customization mode, I would leave the red icon, or make it green as the default status is (the same displayed in the palette for example), and the restore when is over?
[2013-11-04 14:19:21] <ZER0> Gijs, do you think there is any guidelines about it or I can just do what is easier for the moment?
[2013-11-04 14:20:05] <Gijs> ZER0: so we un-disable and un-check items when entering customize mode, as per the above link
[2013-11-04 14:20:24] <Gijs> ZER0: so if your button has some kind of special status, I guess it should go back to 'normal' when wrapped, and restore when unwrapped


Obviously, in order to know not to update the button or when to restore state, it's useful to be notified of starting/ending customize mode.

(although thinking about this, you could check whether a button is currently in customize mode by checking if its parentNode has localName == "toolbarpaletteitem", and then add a listener specifically to that window, but that's pretty hacky...)
Comment on attachment 832876 [details] [diff] [review]
provide global notifications of customization start/stop,

Review of attachment 832876 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good! Thanks Gijs!
Attachment #832876 - Flags: review?(mconley) → review+
remote:   https://hg.mozilla.org/integration/fx-team/rev/ab49c1ad9f2b
Whiteboard: [Australis:M?][Australis:P3] → [Australis:M?][Australis:P3][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/ab49c1ad9f2b
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:M?][Australis:P3][fixed-in-fx-team] → [Australis:M?][Australis:P3]
Target Milestone: --- → Firefox 28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: