After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 594546 - Make "global" global.
Make "global" global.
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2009-09-08 20:21 UTC by Dan Winship
Modified: 2009-09-08 21:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make "global" global. (20.01 KB, patch)
2009-09-08 20:21 UTC, Dan Winship
accepted-commit_now Details | Review

Description Dan Winship 2009-09-08 20:21:14 UTC
Rather than creating a local "global" everywhere we need it, just create
a single global "global".

This patch creates the global from main.js:start(), by doing

    window.global = Shell.Global.get();

where "window" means the global JS namespace, just like in a web browser,
because gjs has chosen to be wacky in that way. (If you remove "window.",
it still works but gjs warns about the assignment to an undeclared
variable. If you try to declare it with "let" or "var", it ends up being
scoped to Main rather than to the global object. So "window.global" seemed
best.

Alternatively, we could assign it from gnome-shell-plugin.c perhaps.
Comment 1 Dan Winship 2009-09-08 20:21:15 UTC
Created attachment 142726 [details] [review]
Make "global" global.

Rather than doing "let global = Shell.Global.get()" everywhere we
need it, just create a global variable called "global".
Comment 2 Colin Walters 2009-09-08 20:24:20 UTC
Comment on attachment 142726 [details] [review]
Make "global" global.

I approve of this message and wish to subscribe to your newsletter.
Comment 3 Owen Taylor 2009-09-08 20:37:23 UTC
Like it.

(It is a little strange that 'global' is just global stuff we implement in C, and not global stuff we implement in Javascript, but that's fine. )
Comment 4 Dan Winship 2009-09-08 21:08:05 UTC
committed