Re: JS documentation ST...



On 14 July 2012 09:28, Jasper St. Pierre <jstpierre mecheye net> wrote:
> On Fri, Jul 13, 2012 at 7:26 PM, Yaa101 <yaa101 xs4all nl> wrote:
>> On Fri, 13 Jul 2012 16:38:26 -0400
>> "Jasper St. Pierre" <jstpierre mecheye net> wrote:
>>
>>> On Fri, Jul 13, 2012 at 4:20 PM, Yaa101 <yaa101 xs4all nl> wrote:
>>> It should complain wildly in stderr, but maybe you weren't looking
>>> there :)
>> You mean in lookingglass on the error log? nope, no complaints there,
>> not before my solution nor after.
>
> I mean in stderr. That's usually redirected to ~/.xsession-errors.
>
>>> >> Most CSS properties are supported by all elements, and you can add
>>> >> your own properties by looking them up on the theme node.
>>> >
>>> > Can you explain further? looking up where?
>>>
>>> On the theme node
>> theme node? please elaborate, just trying to learn here and sometimes I
>> have to get pointed to what I am missing.
>
> If you have an StWidget on the stage, you can call get_theme_node on
> it, and look up various CSS properties, and do whatever you want with
> the values.
>
>>>
>>> > And to come back at my first question, is there any reference
>>> > document for ST besides the C version?
>>>
>>> Currently, no. There is going to be a new doc tool which will handle
>>> language differences when generating docs, hopefully. It should for
>>> the most part be a 1:1 mapping, except when it isn't (destroy notify,
>>> gerror, out parameters). If work on the doc tool doesn't improve,
>>> maybe we can lay down some rules of how to translate the C API into
>>> the JS API. That would be a shitty last resort, though.

Yaa101 - I often find it helpful to start gnome-shell from a terminal
(gnome-shell --replace), in which case you can see stderr messages
appear on it directly (much more logging information than the error
console in looking glass). Also, from your code you can use
'log'/'print' to output to that terminal, whereas global.log only goes
to the error console in the looking glass.

...

>>> >> > Does somebody know where to find a proper reference on ST for
>>> >> > gjs? I can find the C references
>>> >> > ( http://developer.gnome.org/st/3.4/ ) but they lack detail on
>>> >> > usage and interaction within the js system.
>>> >> >
>>> >> > What I am searching for is a document ala
>>> >> > ( http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/index.html ) but
>>> >> > for ST.
>>> >> >
>>> >> > Is there any document that has this information?

I find it isn't too hard to convert from the C function names to the
JS function names - usually the class name becomes an object in the
namespace (e.g. st_theme_context_get_for_stage ->
St.ThemeContext.get_for_stage).

If you can't find a documented function on the Javascript side I
sometimes find it helpful to look to the corresponding .gir file
(St-1.0.gir, I forget which package installs it though).

>>> >> > For instance I want to know what CSS properties each ST element
>>> >> > use.

>From my experience, any CSS property that you can think of is
more-or-less supported by the St objects. You can always test by doing
(e.g.):

    object.set_style('color: red; background-color: blue'); // etc.
Each call overrides the last.

In terms of seeing what possibilities are out there, I found it useful
to look at /usr/share/gnome-shell/theme/gnome-shell.js which defines
the styles for all the things used by gnome-shell.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]