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 595387 - x.set_property
x.set_property
Status: RESOLVED OBSOLETE
Product: seed
Classification: Bindings
Component: libseed
git master
Other Linux
: Normal normal
: ---
Assigned To: seed-maint
seed-maint
Depends on:
Blocks:
 
 
Reported: 2009-09-16 16:37 UTC by Luis Medinas
Modified: 2021-05-25 17:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Luis Medinas 2009-09-16 16:37:59 UTC
I across some gstreamer code i wanted to port to seed and i found that example.set_property() doesn't work. 
The same code on gjs works as expected.
Comment 1 Luis Medinas 2009-12-03 15:34:45 UTC
ping ?
Comment 2 Tim Horton 2010-01-15 05:31:31 UTC
If you have a little chunk of example code, I can take a peek.
Comment 3 Luis Medinas 2010-01-15 20:30:40 UTC
Example code, this works with gjs (adapted of course).

Gtk = imports.gi.Gtk;
Gst = imports.gi.Gst;
GLib = imports.gi.GLib;

Gtk.init(Seed.argv);
Gst.init(Seed.argv);

url = Seed.argv[2];

var pipeline = new Gst.Pipeline({name: "AudioTest"});

var player = Gst.ElementFactory.make("playbin2", "player");

//player.set_property("uri", "file:///home/metalgod/Projects/javascript/audio.mp3")
player.set_property("uri", url)

pipeline.add(player);

pipeline.set_state(Gst.State.PLAYING);

Gtk.main();
Comment 4 Alan Knowles 2010-02-16 04:56:08 UTC
Going through the code, 
Gobject methods are not natively exposed via introspection, but set/get properties are implemented by the JS getter/setter calls 

hence:
player.set_property("uri", url)

is written as
player.uri =  url;

It appears to work OK internally, g_object_set_property appears to return success..
Comment 5 Alan Knowles 2010-02-23 09:31:12 UTC
needs changing to NOTABUG  - I do not have privalliges to do this.. ;)
Comment 6 Luis Medinas 2010-02-23 15:17:05 UTC
I think we should keep this one open, i don't think "the seed-way" to do this is correct. Yes indeed .set_property works fine like

x.set_property("something", whatever)

as

x.something = whatever

But it's too much confusing and it gets away from GTK+ and bindings (even gjs itself which do it on the right way).
I would like to ear more opinions on this before closing the bug.
Comment 7 Alan Forbes 2010-02-24 23:10:06 UTC
As I am not involved as a developer of the project, it is not my place to say what direction it will take but I have to ask is it wise to deviate from the Gnome bindings as the reference manuals and code derived from it are the  primary sources of documentation to be used when coding JS stuff?

While Alan's solution does work, I think this buf should be kept open until  x.set_property function is fixed.
Comment 8 Giedrius Slavinskas 2010-08-20 15:50:20 UTC
This is solution for one word properties. But what about properties in WebKit.WebSettings, where words are separated by dash like "default-font-size"? 

This gives syntax error:

settings = new WebKit.WebSettings();
settings.default-font-size = 10;

By replacing dashes with underscores doesn't seem to work either.
Comment 9 Alan Knowles 2010-08-21 13:48:02 UTC
http://devel.akbkhome.com/seed/WebKit.WebSettings.html

Convert dashes to underscore.

use settings.default_font_size = 10;
Comment 10 André Klapper 2021-05-25 17:32:16 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new enhancement request ticket at
  https://gitlab.gnome.org/GNOME/seed/-/issues/

Thank you for your understanding and your help.