Skip to content
This repository has been archived by the owner on Jul 12, 2018. It is now read-only.

GObject properties currently not supported #1

Closed
WebReflection opened this issue Dec 19, 2015 · 9 comments
Closed

GObject properties currently not supported #1

WebReflection opened this issue Dec 19, 2015 · 9 comments

Comments

@WebReflection
Copy link
Owner

The current code fails

var
  gi = require('./lib/node-gtk'),
  Gtk = gi.importNS('Gtk')
;
Gtk.Settings.get_default().get_property('gtk-application-prefer-dark-theme');

with the following error message (using actually a second argument otherwise it doesn't even try saying not enough arguments)

**
ERROR:../src/value.cc:180:void GNodeJS::V8ToGIArgument(v8::Isolate*, GITypeInfo*, GIArgument*, v8::Handle<v8::Value>, bool): code should not be reached
Aborted (core dumped)

It seems like the interface is never the only handled one:

switch (interface_type) {
  case GI_INFO_TYPE_OBJECT:
    arg->v_pointer = GObjectFromWrapper (value);
    break;
  default:
    g_assert_not_reached ();
}

No idea how to solve this :-(

@magcius
Copy link
Collaborator

magcius commented Dec 19, 2015

So, there's a few issues. First off, this isn't specific to GSettings, you're calling g_object_get_property. It takes two values -- a const gchar *, and a GValue, which is technically an (inout caller-allocates), but it's not marked as such, because supporting this sort of GValue use is very uncommon. g_object_get_property should likely be marked as (skip).

We need native property support in here.

@magcius magcius changed the title Gtk Settings completely broken via both get and set properties GObject properties currently not supported Dec 19, 2015
@WebReflection
Copy link
Owner Author

uhm, not sure how much this helps and I'm sure you know this already but in GJS I've not such issue.

What do you mean by: "we need native property support in here" ?

Anyhow I can help on JS side? Thanks

@romgrk
Copy link

romgrk commented Dec 20, 2015

Hey hi! I ran in a problem with the same section of code yesterday, and was looking into this.
If you need some inspiration take a look there:

https://github.com/creationix/node-gir
https://github.com/pavouk/lgi
https://wiki.gnome.org/action/show/Projects/GObjectIntrospection

@magcius
Copy link
Collaborator

magcius commented Dec 20, 2015

Implemented basic read support for GObject properties.

Gtk.Settings.get_default().gtk_application_prefer_dark_theme now works.

@WebReflection
Copy link
Owner Author

thanks @magcius

to @romgrk I actually wonder if we are overlapping with node-gir ... is that project already capable of bringing Gtk in node? How much does this node-gtk differ from that?

Thanks for clarification

@romgrk
Copy link

romgrk commented Dec 20, 2015

From what I have tested, node-gir isnt complete enough (at least for the parts I need). I also looks somewhat inactive. (Well, in my perspective 4 months is inactive)

Also, for having looked at both source codes, I prefer this implementation.

@magcius
Copy link
Collaborator

magcius commented Dec 20, 2015

I hadn't seen node-gir before. It's a bit like what I've done, though.

@WebReflection
Copy link
Owner Author

FYI I've asked Tim directly and this was the answer about the status of node-gir https://twitter.com/creationix/status/678713068851847168

TL;DR not touched it in years.

@magcius
Copy link
Collaborator

magcius commented Jan 3, 2016

I implemented write support a little while ago, so this is done.

@magcius magcius closed this as completed Jan 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants