Commit Graph

70 Commits

Author SHA1 Message Date
Dan Winship
898b2b903d environment: put gettext stuff into global environment
Rather than defining _() as a local function in every module, put it
into the global environment (along with C_() and ngettext()).

https://bugzilla.gnome.org/show_bug.cgi?id=649203
2011-05-16 14:57:21 -04:00
Dan Winship
7921954a31 environment: move more init stuff here from main.js
Move some more environment-initializationy stuff from main.js to
environment.js, and be more careful about not importing shell JS
modules until after the environment has been fully patched.

Change gnome-shell-plugin to call Environment.init() before
Main.start(); this means that Environment.init() now runs before any
shell JS modules (besides environment itself) have been imported.

Make run-js-test create a ShellGlobal and use its js_context, so that
the shell_global_set_property_mutable() stuff in Environment.init()
will work correctly in tests as well.

https://bugzilla.gnome.org/show_bug.cgi?id=649203
2011-05-16 14:56:27 -04:00
Dan Winship
07a0960265 environment: improve Object.toString for delegate objects
If a JS object has an 'actor' property pointing to a ClutterActor,
include the actor's toString() output in the delegate's toString()
output. Eg:

  js>>> Main.panel
  [object Object delegate for 0xff6080 StBoxLayout.menu-bar "panel" ("Activities")]

https://bugzilla.gnome.org/show_bug.cgi?id=646919
2011-04-26 08:19:43 -04:00
Owen W. Taylor
7ad89dc46b Work around Spidermonkey problem with Unicode date formats
Monkey-patch Date.prototype.toLocaleFormat() with a version that uses
g_date_time_format() since the Spidermonkey built-in can't handle
format strings with Unicode characters.

https://bugzilla.gnome.org/show_bug.cgi?id=643350
2011-03-14 15:33:44 -04:00
Giovanni Campagna
15ec185be5 Don't declare global variables
Fix a typo in panel.js, and ensure that all variables used in
functions are scoped to the block (using let), to avoid polluting
the global namespace.

https://bugzilla.gnome.org/show_bug.cgi?id=643210
2011-02-24 21:22:44 +01:00
Florian Müllner
1dd35b7d08 environment: Fix runtime crash due to GTK+ change
As Gdk.Device.get_state() does not work properly from Javascript,
we used to block it in the environment. The method now has been
annotated with (skip), causing shell to crash on startup as only
existing methods may be blocked.
Just remove the block in question, as the annotation prevents the
use of that method anyway.
2011-01-20 16:44:16 +01:00
Owen W. Taylor
2763d8dcc1 Fix error from blocking removed Gdk.Display.get_device_state.
Gdk.Display.get_device_state() was removed in favor of a
non-GdkModifierType returning Gdk.Device.get_position(). But block
Gdk.Device.get_state() which does return a GdkModifierType mask.

https://bugzilla.gnome.org/show_bug.cgi?id=638158
2010-12-28 07:53:39 -05:00
Florian Müllner
4517f60630 environment: Get text direction from GTK+-3
Despite of switching to GTK+-3 unconditionally, the default text
direction was still taken from GTK+-2.
2010-11-29 22:00:37 +01:00
Florian Müllner
b33ebb450a tests: Fix environment
Environment.init() uses Shell.Global, which is not accessible outside
the mutter process; allowing to run the function when window.global is
undefined fixes the environment for tests.

https://bugzilla.gnome.org/show_bug.cgi?id=631091
2010-10-05 00:05:57 +02:00
Adel Gadllah
3fb7cce80f Drop custom ClutterActor.contains
Clutter 1.4 does provides a native implementation

https://bugzilla.gnome.org/show_bug.cgi?id=624571
2010-08-10 08:41:50 +02:00
Florian Müllner
643c7fdb3a Switch build to Gtk+-3.0
Update the build dependencies to gtk+-3.0 and adjust the javascript
to run on gtk+-3. Obviously depends on mutter compiled with gtk+-3
as well.

https://bugzilla.gnome.org/show_bug.cgi?id=621845
2010-07-07 12:57:59 -04:00
Florian Müllner
35764fa09e Move Tweener.slowDownFactor into St
It has probably crossed the line to evil by a mile or so, but here
it is: a Tweener.slowDownFactor replacement used by all animations
without exception.
While at it, update Tweener to use the new setTimeScale() upstream
function instead of adjusting the timeline directly.

https://bugzilla.gnome.org/show_bug.cgi?id=622249
2010-06-21 16:19:25 +02:00
Dan Winship
ab61017041 [environment] use St.describe_actor for Clutter.Actor.prototype.toString
https://bugzilla.gnome.org/show_bug.cgi?id=621668
2010-06-17 13:19:50 -04:00
Dan Winship
a4befeba53 De-duplicate "actor contains actor" code
Add _st_actor_contains() in st-private for use within St, and
monkey-patch in a Clutter.Actor.contains() for use by javascript, and
then replace all the duplicate implementations with one or the other
of those.

https://bugzilla.gnome.org/show_bug.cgi?id=621197
2010-06-11 10:05:46 -04:00
Dan Winship
fe542f8732 Add a hack to block calls to certain introspected functions
This is useful for keeping people from using methods that only fail in
certain circumstances, by making them fail in all circumstances
instead.

https://bugzilla.gnome.org/show_bug.cgi?id=618918
2010-05-20 15:49:16 -04:00
Marina Zhurakhinskaya
703b21cef0 Don't use double quotes for things that don't need to be translated
This is our convention.

The only exceptions are double quotes for words in comments that give
them a special meaning (though beware that these quotes are not truly
necessary most of the time) and double quotes that need to be a part
of the output string.
2010-05-13 16:00:38 -04:00
Abderrahim Kitouni
9ba5ca0193 environment.js: set default direction for St widgets
https://bugzilla.gnome.org/show_bug.cgi?id=584662
2009-11-16 11:46:35 -05:00
Adel Gadllah
64cd51667d Add String formatting
Add String formatting by extending the String object with a
format method.

Now we can do stuff like "Text: %s, %d".format(somevar, 5)

This is required for proper translation of some strings.

https://bugzilla.gnome.org/show_bug.cgi?id=595661
2009-10-04 23:37:33 +02:00
Owen W. Taylor
af3ec56ca1 Handle adding children to StTable from Javascript
Remove the StTable specific methods to add actors:

 st_table_add_actor()
 st_table_add_actor_with_properties()

Since they shadow the generic ClutterContainer add_actor() method,
and patch in our add() convenience function as we do for
StBoxLayout.

https://bugzilla.gnome.org/show_bug.cgi?id=596811
2009-10-01 14:46:33 -04:00
Owen W. Taylor
55497899dd Add some structure for interactive tests of UI components
js/ui/environment.js: Split out initial UI setup (Tweener initialization,
  ClutterContainer monkey-patching) into a separate file we can import from tests.

tests/: Directory for various types of tests
tests/run-test.sh: Shell script that to run tests with an appropriate
  environment set up.

tests/testcommon/: Common modules and data for tests
tests/interactive/: Interactive tests

tests/interactive/box-layout.js: A sample test of StLayout

https://bugzilla.gnome.org/show_bug.cgi?id=595987
2009-10-01 14:41:17 -04:00