Coder Social home page Coder Social logo

node-gtk's Introduction

This project is abandoned, it not even a work in progress anymore, but @romgrk is working in his fork.

node-gtk's People

Contributors

benwaffle avatar h4ck3rm1k3 avatar magcius avatar webreflection avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-gtk's Issues

Why was this abandoned?

Simple as that. I've been working on nodejs<->winapi for Windows to have native UI there. I also wanted to do this in the *nix space too, but of course if there are solutions already I will leverage them.

I see there is node-gjs, but what is the difference between the two?

Thanks a bunch @WebReflection.

Cannot pass function as argument to Vte

terminal = new Vte.Terminal
terminal.spawn_sync(
    terminal,
    0, #Vte.PtyFlags.DEFAULT
    __dirname,
    ['/bin/zsh'],
    ( "#{key}=#{process.env[key]}" for key of process.env ),
    4, #GLib.SpawnFlags.SEARCH_PATH
    null, 
)

Error code:

ERROR:../src/value.cc:180:void GNodeJS::V8ToGIArgument(v8::Isolate*, GITypeInfo*, GIArgument*, v8::Handle<v8::Value>, bo
ol): code should not be reached
[1]    21304 abort      node .

Code

    case GI_TYPE_TAG_INTERFACE:
        {
            GIBaseInfo *interface_info = g_type_info_get_interface (type_info);
            GIInfoType interface_type = g_base_info_get_type (interface_info);

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

            g_base_info_unref (interface_info);
        }
        break;

From what I can see there are various unimplemented types. (ref: https://developer.gnome.org/gi/stable/gi-GIBaseInfo.html#GIInfoType)

Are some of them unrelevant to implement or is this todo?

Rewrite constructors in JS code

Currently, constructors are written in C++ as part of the construct call. This makes it hard to override, for camel case transforms and such.

Let's rewrite the constructor in JS, and then bind an External to the object. This might be a bit difficult with toggle refs, but we should be able to make it work.

Problem installing or running

I tried to add this with npm and got a couple warnings after remembering to add a package.json, I'm fairly new to node but I didn't think that was absolutely required. also I got this as an error
module.js:328
throw err;
^

Error: Cannot find module 'node-gtk'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/stephen/Desktop/gtktest/gtktest.js:4:11)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:430:10)

I'm running Ubuntu 15.04 and Node 5.4.0

Add a test suite

Both gobject-introspection and gjs have a pretty good test suite for testing introspection. We should add a similar one.

Gtk.init(null); throws an error

The following code works in node-gtk but doesn't in GJS

#!/usr/bin/env node
var
  GNode = require('node-gtk'),
  Gtk = GNode.importNS('Gtk')
;

GNode.startLoop();
Gtk.init(0, null);

The GJS version:

#!/usr/bin/env gjs
imports.gi.Gtk.init(0, null);

// Gjs-WARNING **: JS ERROR: Error: Expected type utf8 for Argument 'argv' but got type 'number'
// @./gjs:2

Moreover, if I use just null as unique argument, GJS works just fine and node-gtk throws an error.

Gtk.init(null);
    ^

TypeError: Not enough arguments.
    at TypeError (native)
    at Object.<anonymous> (/home/webreflection/test/gjs/node-gtk:8:5)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)
    at startup (node.js:141:18)
    at node.js:980:3

I believe these two way to initialize should be kinda consistent across environment otherwise code might result not shareable/reusable/testable in both envs.

FYI I've also aligned jsgtk to reflect your node-gtk import and API so these can share pretty much exact same code as long as non native node modules are used. ( example and it's visible I had to use Gtk.init(null) instead of Gtk.init(0, null) due previously described error )

Windows 8.1

Have you sam tip haw implement on windows ?
I have all important class and msys32, mingw .... visual expres studio etc, but
node-pre-gyp with msbuild cannot find glib.h and girepository.h

Run JS code to build NS from C++ hooks

When importing an object (or other resource) by pointer, we simply get the class template and construct the object:

https://github.com/WebReflection/node-gtk/blob/master/src/gobject.cc#L243-L251

We need to make sure that if something returns an object that hasn't been imported, we run everything required to build up that class, install methods, etc.

This should also be the class if an object inherits from a parent that's also unimported.

That means we should rewrite this code to call a JS hook. Perhaps we install one when the JS code calls Bootstrap.

https://github.com/WebReflection/node-gtk/blob/master/src/gobject.cc#L163-L182

Arch Linux Build Fails

Debug log is available at http://pastebin.com/raw/dCPt7pUE

Console log is littered with
../src/QtGui/qsound.h:49:47: error: ‘Arguments’ in namespace ‘v8’ does not name a type
static v8::Handlev8::Value Play(const v8::Arguments& args);
and in places other than just qsound

Running the examples from the source works fine

Failing to install on Ubuntu 16.04 with Node 6.7.0

I've just cloned a fresh VirtualBox from osboxes.org to try out this project. I've installed Node 6.7 and tried to install this project. If there's a simple tweak I can try I'll change my setup rather than wait for an upstream solution.

Here's my Bash log:

osboxes@osboxes:~$ sudo npm install -g node-gtk
[sudo] password for osboxes: 

> [email protected] install /usr/lib/node_modules/node-gtk
> if [ "$(uname)" = "Darwin" ] && [ "$(which brew)" != "" ]; then export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig; fi; node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://github.com/WebReflection/node-gtk/releases/download/0.0.16/node-v48-linux-ia32.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp) 
make: Entering directory '/usr/lib/node_modules/node-gtk/build'
  CXX(target) Release/obj.target/node-gtk/src/loop.o
  CXX(target) Release/obj.target/node-gtk/src/gi.o
  CXX(target) Release/obj.target/node-gtk/src/value.o
  CXX(target) Release/obj.target/node-gtk/src/function.o
../src/function.cc: In function ‘v8::Local<v8::Function> GNodeJS::MakeFunction(v8::Isolate*, GIBaseInfo*)’:
../src/function.cc:184:48: error: ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackData<T, P>::Callback) [with P = GNodeJS::FunctionInfo; T = v8::FunctionTemplate; typename v8::WeakCallbackData<T, P>::Callback = void (*)(const v8::WeakCallbackData<v8::FunctionTemplate, GNodeJS::FunctionInfo>&)]’ is deprecated: use WeakCallbackInfo version [-Werror=deprecated-declarations]
     persistent.SetWeak (func, FunctionDestroyed);
                                                ^
In file included from /home/osboxes/.node-gyp/6.7.0/include/node/node.h:42:0,
                 from ../src/function.h:4,
                 from ../src/function.cc:2:
/home/osboxes/.node-gyp/6.7.0/include/node/v8.h:7647:6: note: declared here
 void PersistentBase<T>::SetWeak(
      ^
/home/osboxes/.node-gyp/6.7.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackData<T, P>::Callback) [with P = GNodeJS::FunctionInfo; T = v8::FunctionTemplate; typename v8::WeakCallbackData<T, P>::Callback = void (*)(const v8::WeakCallbackData<v8::FunctionTemplate, GNodeJS::FunctionInfo>&)]’:
../src/function.cc:184:48:   required from here
/home/osboxes/.node-gyp/6.7.0/include/node/v8.h:7650:16: error: ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackData<S, P>::Callback) [with S = v8::FunctionTemplate; P = GNodeJS::FunctionInfo; T = v8::FunctionTemplate; typename v8::WeakCallbackData<S, P>::Callback = void (*)(const v8::WeakCallbackData<v8::FunctionTemplate, GNodeJS::FunctionInfo>&)]’ is deprecated: use WeakCallbackInfo version [-Werror=deprecated-declarations]
   SetWeak<T, P>(parameter, callback);
                ^
/home/osboxes/.node-gyp/6.7.0/include/node/v8.h:7635:6: note: declared here
 void PersistentBase<T>::SetWeak(
      ^
cc1plus: all warnings being treated as errors
node-gtk.target.mk:98: recipe for target 'Release/obj.target/node-gtk/src/function.o' failed
make: *** [Release/obj.target/node-gtk/src/function.o] Error 1
make: Leaving directory '/usr/lib/node_modules/node-gtk/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gtk/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-21-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/node-gtk/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/lib/node_modules/node-gtk/build/Release/node-v48-linux-ia32/node-gtk.node" "--module_name=node-gtk" "--module_path=/usr/lib/node_modules/node-gtk/build/Release/node-v48-linux-ia32"
gyp ERR! cwd /usr/lib/node_modules/node-gtk
gyp ERR! node -v v6.7.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/node-gtk/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/node-gtk/build/Release/node-v48-linux-ia32/node-gtk.node --module_name=node-gtk --module_path=/usr/lib/node_modules/node-gtk/build/Release/node-v48-linux-ia32' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/node-gtk/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-21-generic
node-pre-gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/node-gtk/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/node-gtk
node-pre-gyp ERR! node -v v6.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.30
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/node-gtk/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/node-gtk/build/Release/node-v48-linux-ia32/node-gtk.node --module_name=node-gtk --module_path=/usr/lib/node_modules/node-gtk/build/Release/node-v48-linux-ia32' (1)
/usr/lib
└── (empty)

npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "node-gtk"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `if [ "$(uname)" = "Darwin" ] && [ "$(which brew)" != "" ]; then export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig; fi; node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'if [ "$(uname)" = "Darwin" ] && [ "$(which brew)" != "" ]; then export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig; fi; node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-gtk package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     if [ "$(uname)" = "Darwin" ] && [ "$(which brew)" != "" ]; then export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig; fi; node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-gtk
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-gtk
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/osboxes/npm-debug.log
npm ERR! code 1

No package 'gobject-introspection-1.0' found

Hello I've tried to run 'npm install node-gkt' but I have some issues in the output. i'm running Fedora 23. I have installed npm, node and GTK3 correctly. here is the output

[nolersiam@localhost ~]$ mkdir -p nodeGTK
[nolersiam@localhost ~]$ cd nodeGTK
[nolersiam@localhost nodeGTK]$ npm install node-gtk
npm http GET https://registry.npmjs.org/node-gtk
npm http 304 https://registry.npmjs.org/node-gtk
npm http GET https://registry.npmjs.org/node-pre-gyp-github
npm http GET https://registry.npmjs.org/node-pre-gyp
npm http GET https://registry.npmjs.org/node-gyp
npm http 304 https://registry.npmjs.org/node-gyp
npm http 304 https://registry.npmjs.org/node-pre-gyp
npm http 304 https://registry.npmjs.org/node-pre-gyp-github
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/github
npm http GET https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/github
npm http GET https://registry.npmjs.org/graceful-readlink
npm http GET https://registry.npmjs.org/extend
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/stringstream
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/isstream
npm http GET https://registry.npmjs.org/is-typedarray
npm http GET https://registry.npmjs.org/har-validator
npm http GET https://registry.npmjs.org/bl
npm http GET https://registry.npmjs.org/caseless
npm http 304 https://registry.npmjs.org/graceful-readlink
npm http 304 https://registry.npmjs.org/mime-types
npm http 304 https://registry.npmjs.org/extend
npm http 304 https://registry.npmjs.org/form-data
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/npmlog
npm http GET https://registry.npmjs.org/osenv
npm http GET https://registry.npmjs.org/path-array
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/tough-cookie
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/oauth-sign
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/aws-sign2
npm http 304 https://registry.npmjs.org/stringstream
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/isstream
npm http 304 https://registry.npmjs.org/is-typedarray
npm http 304 https://registry.npmjs.org/har-validator
npm http 304 https://registry.npmjs.org/bl
npm http 304 https://registry.npmjs.org/caseless
npm http 304 https://registry.npmjs.org/graceful-fs
npm WARN engine [email protected]: wanted: {"node":">=0.8","npm":">=1.3.7"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/npmlog
npm http 304 https://registry.npmjs.org/osenv
npm http 304 https://registry.npmjs.org/path-array
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/tar
npm http 304 https://registry.npmjs.org/semver
npm http 304 https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/delayed-stream
npm http GET https://registry.npmjs.org/mime-db
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/readable-stream
npm http GET https://registry.npmjs.org/array-index
npm http GET https://registry.npmjs.org/is-absolute
npm http GET https://registry.npmjs.org/os-homedir
npm http GET https://registry.npmjs.org/os-tmpdir
npm http 304 https://registry.npmjs.org/delayed-stream
npm http GET https://registry.npmjs.org/assert-plus
npm http GET https://registry.npmjs.org/jsprim
npm http GET https://registry.npmjs.org/sshpk
npm http GET https://registry.npmjs.org/gauge
npm http GET https://registry.npmjs.org/ansi
npm http GET https://registry.npmjs.org/are-we-there-yet
npm http GET https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/mime-db
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/once
npm http GET https://registry.npmjs.org/inflight
npm http 304 https://registry.npmjs.org/is-absolute
npm http GET https://registry.npmjs.org/chalk
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/is-my-json-valid
npm http GET https://registry.npmjs.org/pinkie-promise
npm http 304 https://registry.npmjs.org/os-homedir
npm http 304 https://registry.npmjs.org/os-tmpdir
npm http 304 https://registry.npmjs.org/assert-plus
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/jsprim
npm http GET https://registry.npmjs.org/is-relative
npm http 304 https://registry.npmjs.org/sshpk
npm http 304 https://registry.npmjs.org/array-index
npm http 304 https://registry.npmjs.org/readable-stream
npm http 304 https://registry.npmjs.org/gauge
npm http GET https://registry.npmjs.org/path-is-absolute
npm http 304 https://registry.npmjs.org/ansi
npm http 304 https://registry.npmjs.org/are-we-there-yet
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/once
npm http 304 https://registry.npmjs.org/inflight
npm http 304 https://registry.npmjs.org/chalk
npm http 304 https://registry.npmjs.org/is-my-json-valid
npm http 304 https://registry.npmjs.org/pinkie-promise
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/is-relative
npm http 304 https://registry.npmjs.org/path-is-absolute
npm http GET https://registry.npmjs.org/wrappy
npm http GET https://registry.npmjs.org/extsprintf/1.0.2
npm http GET https://registry.npmjs.org/json-schema/0.2.2
npm http GET https://registry.npmjs.org/verror/1.3.6
npm http GET https://registry.npmjs.org/pinkie
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/supports-color
npm http GET https://registry.npmjs.org/ansi-styles
npm http GET https://registry.npmjs.org/escape-string-regexp
npm http GET https://registry.npmjs.org/has-ansi
npm http GET https://registry.npmjs.org/strip-ansi
npm http GET https://registry.npmjs.org/delegates
npm http GET https://registry.npmjs.org/brace-expansion
npm http GET https://registry.npmjs.org/lodash.pad
npm http GET https://registry.npmjs.org/lodash.padleft
npm http GET https://registry.npmjs.org/lodash.padright
npm http GET https://registry.npmjs.org/has-unicode
npm http 304 https://registry.npmjs.org/wrappy
npm WARN engine [email protected]: wanted: {"node":">=0.8","npm":">=1.3.7"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm http 304 https://registry.npmjs.org/verror/1.3.6
npm http 304 https://registry.npmjs.org/json-schema/0.2.2
npm http 304 https://registry.npmjs.org/extsprintf/1.0.2
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/pinkie
npm http 304 https://registry.npmjs.org/supports-color
npm http 304 https://registry.npmjs.org/ansi-styles
npm http 304 https://registry.npmjs.org/escape-string-regexp
npm http 304 https://registry.npmjs.org/has-ansi
npm http 304 https://registry.npmjs.org/strip-ansi
npm http 304 https://registry.npmjs.org/delegates
npm http 304 https://registry.npmjs.org/brace-expansion
npm http 304 https://registry.npmjs.org/lodash.pad
npm http 304 https://registry.npmjs.org/lodash.padleft
npm http 304 https://registry.npmjs.org/lodash.padright
npm http 304 https://registry.npmjs.org/has-unicode
npm http GET https://registry.npmjs.org/block-stream
npm http GET https://registry.npmjs.org/ansi-regex
npm http 304 https://registry.npmjs.org/block-stream
npm http GET https://registry.npmjs.org/lodash._basetostring
npm http GET https://registry.npmjs.org/lodash._createpadding
npm http GET https://registry.npmjs.org/balanced-match
npm http GET https://registry.npmjs.org/concat-map/0.0.1
npm http GET https://registry.npmjs.org/isarray/0.0.1
npm http GET https://registry.npmjs.org/process-nextick-args
npm http GET https://registry.npmjs.org/string_decoder
npm http GET https://registry.npmjs.org/util-deprecate
npm http GET https://registry.npmjs.org/core-util-is
npm http GET https://registry.npmjs.org/dashdash
npm http GET https://registry.npmjs.org/jsbn
npm http GET https://registry.npmjs.org/tweetnacl
npm http GET https://registry.npmjs.org/jodid25519
npm http GET https://registry.npmjs.org/ecc-jsbn
npm http GET https://registry.npmjs.org/asn1
npm http GET https://registry.npmjs.org/ms/0.7.1
npm http 304 https://registry.npmjs.org/ansi-regex
npm http 304 https://registry.npmjs.org/isarray/0.0.1
npm http 304 https://registry.npmjs.org/lodash._basetostring
npm http 304 https://registry.npmjs.org/concat-map/0.0.1
npm http 304 https://registry.npmjs.org/balanced-match
npm http 304 https://registry.npmjs.org/process-nextick-args
npm http 304 https://registry.npmjs.org/string_decoder
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/util-deprecate
npm http 304 https://registry.npmjs.org/core-util-is
npm http 304 https://registry.npmjs.org/lodash._createpadding
npm http 304 https://registry.npmjs.org/dashdash
npm http 304 https://registry.npmjs.org/jsbn
npm http 304 https://registry.npmjs.org/tweetnacl
npm http 304 https://registry.npmjs.org/jodid25519
npm http 304 https://registry.npmjs.org/ecc-jsbn
npm http 304 https://registry.npmjs.org/asn1
npm http 304 https://registry.npmjs.org/ms/0.7.1
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/boom
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm http GET https://registry.npmjs.org/generate-function
npm http GET https://registry.npmjs.org/generate-object-property
npm http GET https://registry.npmjs.org/jsonpointer/2.0.0
npm http GET https://registry.npmjs.org/xtend
npm http GET https://registry.npmjs.org/lodash.repeat
npm http 304 https://registry.npmjs.org/generate-function
npm http 304 https://registry.npmjs.org/generate-object-property
npm http 304 https://registry.npmjs.org/jsonpointer/2.0.0
npm http 304 https://registry.npmjs.org/xtend
npm http 304 https://registry.npmjs.org/lodash.repeat
npm http GET https://registry.npmjs.org/is-property
npm http 304 https://registry.npmjs.org/is-property
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.36","npm":"1.3.6"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.36","npm":"1.3.6"})

[email protected] install /home/nolersiam/nodeGTK/node_modules/node-gtk
node-pre-gyp install --fallback-to-build

node-pre-gyp http GET https://github.com/WebReflection/node-gtk/releases/download/0.0.16/node-v11-linux-x64.tar.gz
node-pre-gyp http 404 https://github.com/WebReflection/node-gtk/releases/download/0.0.16/node-v11-linux-x64.tar.gz
node-pre-gyp http Pre-built binary not available for your system, looked for https://github.com/WebReflection/node-gtk/releases/download/0.0.16/node-v11-linux-x64.tar.gz (falling back to source compile with node-gyp)
Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing gobject-introspection-1.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gobject-introspection-1.0' found gyp: Call to 'pkg-config --libs gobject-introspection-1.0' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error:gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/nolersiam/nodeGTK/node_modules/node-gtk/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 4.3.3-300.fc23.x86_64
gyp ERR! command "/usr/bin/node" "/home/nolersiam/nodeGTK/node_modules/node-gtk/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/nolersiam/nodeGTK/node_modules/node-gtk/build/Release/node-v11-linux-x64/node-gtk.node" "--module_name=node-gtk" "--module_path=/home/nolersiam/nodeGTK/node_modules/node-gtk/build/Release/node-v11-linux-x64"
gyp ERR! cwd /home/nolersiam/nodeGTK/node_modules/node-gtk
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /home/nolersiam/nodeGTK/node_modules/node-gtk/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/nolersiam/nodeGTK/node_modules/node-gtk/build/Release/node-v11-linux-x64/node-gtk.node --module_name=node-gtk --module_path=/home/nolersiam/nodeGTK/node_modules/node-gtk/build/Release/node-v11-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/nolersiam/nodeGTK/node_modules/node-gtk/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:766:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:833:5)
node-pre-gyp ERR! System Linux 4.3.3-300.fc23.x86_64
node-pre-gyp ERR! command "node" "/home/nolersiam/nodeGTK/node_modules/node-gtk/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/nolersiam/nodeGTK/node_modules/node-gtk
node-pre-gyp ERR! node -v v0.10.36
node-pre-gyp ERR! node-pre-gyp -v v0.6.19
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /home/nolersiam/nodeGTK/node_modules/node-gtk/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/nolersiam/nodeGTK/node_modules/node-gtk/build/Release/node-v11-linux-x64/node-gtk.node --module_name=node-gtk --module_path=/home/nolersiam/nodeGTK/node_modules/node-gtk/build/Release/node-v11-linux-x64' (1)
npm ERR! weird error 1
npm ERR! not ok code 0
[nolersiam@localhost nodeGTK]$

Error in node-gtk lib, after try run code

Hi, I tried to use your library, but there was this error.

node: symbol lookup error: /home/anton/nodeGtk/node_modules/node-gtk/build/Release/node-gtk.node: undefined symbol: g_irepository_get_default

All libraries for the development of gtk installed. The assembly took place without problems. OS - Ubuntu 16.04 Gnome.

GObject properties currently not supported

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 :-(

Support interfaces

css = new Gtk.CssProvider();
css.load_from_path('./style.css');
context = win.get_style_context();
context.add_provider(css, 200);

The last call is the one producing this:
screenshot from 2016-01-06 23-56-56
(Red text is debug info; just a printf of base_info and type in method V8ToGIArgument)

Failed to start on Mac OS X 10.11.6 with Node.js 6.3.1

(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.

==== JS stack trace =========================================

Security context: 0xa09333c9e31 <JS Object>#0#
    1: /* anonymous */ [/Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js:20] [pc=0x15fcf7b43bff] (this=0xa09333e15d9 <JS Global Object>#1#)
    2: /* anonymous */ [/Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js:35] [pc=0x15fcf7b4449e] (this=0x98031005511 <an Object with map 0x85c30707ac1>#2#,exports=0x98031005511 <an Object with map 0x85c30707ac1>#2#,require=0x980310054c9 <JS Function require (SharedFunctionInfo 0x15162d45bed9)>#3#,module=0x98031005441 <a Module with map 0x1a40d1d1a891>#4#,__filename=0x980310053e9 <String[62]: /Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js>,__dirname=0x980310053c1 <String[53]: /Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib>)
    3: _compile [module.js:541] [pc=0x15fcf7b3ddb0] (this=0x98031005441 <a Module with map 0x1a40d1d1a891>#4#,content=0x98031006a29 <Very long string[4957]>#5#,filename=0x980310053e9 <String[62]: /Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js>)
    4: .js [module.js:550] [pc=0x15fcf7b36d6b] (this=0x98031007da1 <an Object with map 0x1a40d1d1a2b9>#6#,module=0x98031005441 <a Module with map 0x1a40d1d1a891>#4#,filename=0x980310053e9 <String[62]: /Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js>)
    5: load [module.js:458] [pc=0x15fcf7b35772] (this=0x98031005441 <a Module with map 0x1a40d1d1a891>#4#,filename=0x980310053e9 <String[62]: /Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js>)
    6: tryModuleLoad(aka tryModuleLoad) [module.js:417] [pc=0x15fcf7b3529d] (this=0xa0933304189 <undefined>,module=0x98031005441 <a Module with map 0x1a40d1d1a891>#4#,filename=0x980310053e9 <String[62]: /Users/iddan/Desktop/ide.js/node_modules/node-gtk/lib/index.js>)
    7: _load [module.js:409] [pc=0x15fcf7b30e82] (this=0x98031007ec9 <JS Function Module (SharedFunctionInfo 0x15162d42d3f9)>#7#,request=0x15162d45b969 <String[8]: node-gtk>,parent=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,isMain=0xa0933304299 <false>)
    8: require [module.js:468] [pc=0x15fcf7b3e893] (this=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,path=0x15162d45b969 <String[8]: node-gtk>)
    9: require(aka require) [internal/module.js:20] [pc=0x15fcf7b3e5c6] (this=0xa0933304189 <undefined>,path=0x15162d45b969 <String[8]: node-gtk>)
   10: /* anonymous */ [/Users/iddan/Desktop/ide.js/main.js:1] [pc=0x15fcf7b3e07b] (this=0x98031008049 <an Object with map 0x85c30707ac1>#9#,exports=0x98031008049 <an Object with map 0x85c30707ac1>#9#,require=0x98031007f51 <JS Function require (SharedFunctionInfo 0x15162d45bed9)>#10#,module=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,__filename=0x98031008009 <String[35]: /Users/iddan/Desktop/ide.js/main.js>,__dirname=0x98031007fe1 <String[27]: /Users/iddan/Desktop/ide.js>)
   11: _compile [module.js:541] [pc=0x15fcf7b3ddb0] (this=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,content=0x98031008491 <String[918]\: require('node-gtk');\n// const Gtk = require('Gtk');\n// const Gio = require('Gio');\n// const store = require('./store');\n//\n// Gtk.init (null, null);\n//\n// let app = new Gtk.Application();\n// let cancellable = new Gio.Cancellable();\n// app.register(cancellable);\n//\n// let window = new Gtk.ApplicationWindow({\n//     title: 'Code',\n//     application: app,\n//     window_position: Gtk.WindowPosition.CENTER,\n//     default_height: 200,\n//     default_width: 400\n// });\n// let textView = new Gtk.TextView();\n//\n// app.addWindow(window);\n// window.add(textView);\n// window.showAll();\n//\n// let textViewBuffer = textView.getBuffer();\n//\n// textViewBuffer.on('changed', () => console.log(textViewBuffer.getText(\n//     textViewBuffer.get_start_iter(),\n//     textViewBuffer.get_end_iter(),\n//     false\n// )));\n//\n// textView.on('move-cursor', (a, b, c) => console.log('move-cursor', a, b, c)); // works!\n//\n// Gtk.main();\n>,filename=0x98031008009 <String[35]: /Users/iddan/Desktop/ide.js/main.js>)
   12: .js [module.js:550] [pc=0x15fcf7b36d6b] (this=0x98031007da1 <an Object with map 0x1a40d1d1a2b9>#6#,module=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,filename=0x98031008009 <String[35]: /Users/iddan/Desktop/ide.js/main.js>)
   13: load [module.js:458] [pc=0x15fcf7b35772] (this=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,filename=0x98031008009 <String[35]: /Users/iddan/Desktop/ide.js/main.js>)
   14: tryModuleLoad(aka tryModuleLoad) [module.js:417] [pc=0x15fcf7b3529d] (this=0xa0933304189 <undefined>,module=0x98031007e41 <a Module with map 0x1a40d1d1a891>#8#,filename=0x98031008009 <String[35]: /Users/iddan/Desktop/ide.js/main.js>)
   15: _load [module.js:409] [pc=0x15fcf7b30e82] (this=0x98031007ec9 <JS Function Module (SharedFunctionInfo 0x15162d42d3f9)>#7#,request=0x98031008861 <String[35]: /Users/iddan/Desktop/ide.js/main.js>,parent=0xa0933304101 <null>,isMain=0xa0933304231 <true>)
   16: /* anonymous */(aka /* anonymous */) [module.js:575] [pc=0x15fcf7b3094a] (this=0xa0933304189 <undefined>)
   17: run(aka run) [bootstrap_node.js:352] [pc=0x15fcf7b307c8] (this=0xa0933304189 <undefined>,entryFunction=0x15162d452381 <JS Function Module.runMain (SharedFunctionInfo 0x15162d42e179)>#11#)
   18: startup(aka startup) [bootstrap_node.js:144] [pc=0x15fcf7a40695] (this=0xa0933304189 <undefined>)
   19: /* anonymous */(aka /* anonymous */) [bootstrap_node.js:467] [pc=0x15fcf7a3e61f] (this=0xa0933304101 <null>,process=0xa09333dd3f1 <a process with map 0x85c307115c9>#12#)
=====================


==== C stack trace ===============================

 1: v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)
 2: GNodeJS::GetClassTemplate(v8::Isolate*, _GIBaseInfoStub*, unsigned long)
 3: GNodeJS::GetClassTemplate(v8::Isolate*, _GIBaseInfoStub*, unsigned long)
 4: GNodeJS::WrapperFromGObject(v8::Isolate*, _GObject*)
 5: GNodeJS::FunctionInvoker(v8::FunctionCallbackInfo<v8::Value> const&)
 6: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))
 7: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>)
 8: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
 9: 0x15fcf7a0961b
10: 0x15fcf7b43bff

Compilation errors

Does this project require a particular version of Node?

I'm failing to compile it with 0.12.7.

In file included from /home/djdeath/.node-gyp/0.12.7/src/node.h:61:0,
                 from ../src/gobject.h:4,
                 from ../src/gobject.cc:2:
/home/djdeath/.node-gyp/0.12.7/deps/v8/include/v8.h: In instantiation of ‘static v8::Handle<T> v8::Handle<T>::New(v8::Isolate*, T*) [with T = v8::FunctionTemplate]’:
/home/djdeath/.node-gyp/0.12.7/deps/v8/include/v8.h:293:15:   required from ‘static v8::Handle<T> v8::Handle<T>::New(v8::Isolate*, const v8::PersistentBase<T>&) [with T = v8::FunctionTemplate]’
../src/gobject.cc:160:91:   required from here
/home/djdeath/.node-gyp/0.12.7/deps/v8/include/v8.h:820:29: error: ‘static v8::internal::Object** v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)’ is protected
   static internal::Object** CreateHandle(internal::Isolate* isolate,
                             ^

Implement a simple camelCase transform

To ease writing JS code, one of the proposals we have is to allow users to opt-in to a camelCaseifier type module, similar to how bluebird has promisifyAll. One would imagine that it could look like this:

var Gtk = gi.importNs('Gtk');
var ngc = require('node-gtk-camelcase');
ngc.camelCaseifyAll(Gtk);

var window = new Gtk.Window({ iconName: "my-application" });
window.setSizeRequest(800, 600);
window.showAll();

console.log(window.getTitle());

This would add camel-case equivalents to all functions and properties.

The hope is that by making this explicit, it becomes less like incomprehensible magic to the community, and it can help explain edge cases e.g. signals still being named "notify::icon-name" because our module does not mangle signal names automatically -- only functions and properties.

There's also plenty of other strange kinds and edge cases to tackle. One simple example is acronym based names. Obviously, we'll only be able to automatically transform to createHttpServer and not createHTTPServer, but I'm not sure if this is natural enough for JS users. I'm not even sure the JS community has a consistent standard for this (you can see this in the amazingly named XMLHttpRequest)

Anyway, let's build a simple, opt-in transform module to test it out.

First-run fails with missing symbol

Installed as noted in README.md; running ./examples/hello-gtk.js results in

node: symbol lookup error: /home/rsi-bryan/Personal/node-gtk/build/Release/node-gtk.node: undefined symbol: g_irepository_get_default

Getting window size

Hello!

I've tried this library and it seems to work for the most part! I'm having some trouble though that I hope someone can guide me with. I'm trying to figure out the size of a GtkWindow when a user resizes it. I found a signal that works, 'check-resize', but I can't figure out how to get the actual size of the window.

It seems like GTK isn't tracking this by itself, but via GDK, so it seems like the easiest way would normally be using the get_allocation method and then read width and height from there. However, it seems like I can't get this from node-gtk.

Of course, get_request_size doesn't work since it's not the actual size of the window.

Does anyone have any suggestions for how I can access the size in node-gtk?

Make it more "JavaScripty"

In JavaScript and modern ES2015 class declaration, methods as well as properties getters and setters, are not enumerable but configurable .

(function () {'use strict';
  class A {
    static public () {}
    method() {}
    get prop() {}
  }

  console.log(Object.getOwnPropertyDescriptor(A, 'public'));
  console.log(Object.getOwnPropertyDescriptor(A.prototype, 'method'));
  console.log(Object.getOwnPropertyDescriptor(A.prototype, 'prop'));

}());

Accordingly, these two operations should probably be based on Object.defineProperty which has been used later on in an opposite way than it should be (which is configurable and not enumerable).

camelCase instead of Ruby_case

In this line properties with hyphens - on their name will be converted into _

I've asked about this already in the GNOME JavaScript ML and it looks like GJS as well as Seed did a mistake believing that JavaScript uses ruby_case notation and the HowToWriteALanguageBinding GNOME page states it should be familiar with the language. However, Java got it right but for some reason JS didn't.

I've built the entire GNOME locally in order to be able to automate the generation of this file through each gir info I could think of:
https://github.com/WebReflection/jsgtk/blob/master/jsgtk/gi.js

Since Proxies are nowhere in V8, and these are not transparent in SpiderMonkey 24, that generation ensures that in GJS I can use per each class method and each class property a camelCase version, delegating entirely to GJS ruby_case.

Looking at the current code, and since we are somehow delegating everything anyway, we could intercept upfront all ruby_cased methods and properties and define them with the right JS name.

We could either choose to duplicate and have both versions initially or simply drop the ruby_case and make this project more friendly for JS developers.

This is/was apparently an idea goal in node-gir too and since I've complained about ruby_case, node-gir complained about ruby_cased, I wonder if we should just stop complaining and make it happen at this early stage.

What do you think? I wouldn't mind having internally the _gir reflecting 1:1 the C name but as exposed API we could do better.

// with a simple utility like this one
function toCamelCase(key) {
  return key.replace(/[_-]([a-z])/g, function ($0, $1) {
    return $1.toUpperCase();
  });
}

// ...
// we could improve the properties assignment as such:

        Object.defineProperty(constructor.prototype, toCamelCase(propertyName), {
            configuraable: true,
            get: propertyGetter(propertyName),
            set: propertySetter(propertyName),
        });


// also improving classes
function declareFunction(obj, info) {
    var name = toCamelCase(_gir.BaseInfo_get_name.call(info));
    var flags = _gir.function_info_get_flags(info);
    var func = _gi.MakeFunction(info);
    var target = flags & GIRepository.FunctionInfoFlags.IS_METHOD ?
      obj.prototype : obj;
    Object.defineProperty(target, name, {
      configurable: true,
      writable: true,
      value: func
    });
}

I'll create a camel-case branch and push it so that we could play around with it.

repeated imports ?

I have the feeling that right now we are importing multiple time doing multiple time same operations per each namespace. If I've got it right, we should probably improve here.

var NS = Object.create(null); // <== avoid name clashes
exports.importNS = function(ns, version) {
    if (!version) version = 'default';
    if (!(ns in NS)) NS[ns] = {};
    if (!(version in NS[ns])) NS[ns][version] = importNS(ns, version);
    return NS[ns][version];
};

thoughts ?

Regards

Windows build is failing

I'm trying to make this repo build-able in Linux, OSX, and Windows.

First two are OK, last one a bit messed up.

Ideally we'll publish to npm precompiled binaries and fallback only if necessary in order to simplify npm usage and installation ... anyway ...

The following happens and I'm not sure how to solve since AFAIK there's no equivalent in Windows for g_source_add_unix_fd

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  loop.cc
  gi.cc
  value.cc
  function.cc
../src/value.cc(43): warning C4244: 'argument': conversion from 'gint64' to 'double', possible loss of data [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/value.cc(45): warning C4244: 'argument': conversion from 'guint64' to 'double', possible loss of data [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'unsigned' is illegal (did you forget a ';'?) (compiling source file ../src/gi.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'unsigned' is illegal (did you forget a ';'?) (compiling source file ../src/function.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'int' is illegal (did you forget a ';'?) (compiling source file ../src/gi.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'int' is illegal (did you forget a ';'?) (compiling source file ../src/function.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/value.cc(159): warning C4244: '=': conversion from 'double' to 'gint64', possible loss of data [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2208: 'unsigned __int64': no members defined using this type (compiling source file ../src/gi.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2208: 'unsigned __int64': no members defined using this type (compiling source file ../src/function.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/value.cc(162): warning C4244: '=': conversion from 'double' to 'guint64', possible loss of data [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/value.cc(165): warning C4244: '=': conversion from 'double' to 'gfloat', possible loss of data [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/value.cc(256): warning C4244: 'argument': conversion from 'double' to 'gfloat', possible loss of data [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/function.cc(52): error C2131: expression did not evaluate to a constant [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(52): note: failure was caused by non-constant arguments or reference to a non-constant symbol
  ../src/function.cc(52): note: see usage of 'n_callable_args'
../src/function.cc(63): error C2228: left of '.type' must have class/struct/union [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(63): note: type is 'GNodeJS::Parameter [n_callable_args]'
../src/function.cc(64): error C2228: left of '.type' must have class/struct/union [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(64): note: type is 'GNodeJS::Parameter [n_callable_args]'
../src/function.cc(71): error C2228: left of '.type' must have class/struct/union [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(71): note: type is 'GNodeJS::Parameter [n_callable_args]'
../src/function.cc(95): error C2131: expression did not evaluate to a constant [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(95): note: failure was caused by non-constant arguments or reference to a non-constant symbol
  ../src/function.cc(95): note: see usage of 'n_total_args'
../src/function.cc(108): error C2228: left of '.type' must have class/struct/union [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(108): note: type is 'GNodeJS::Parameter [n_callable_args]'
../src/function.cc(124): error C2228: left of '.type' must have class/struct/union [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(124): note: type is 'GNodeJS::Parameter [n_callable_args]'
../src/function.cc(144): error C2131: expression did not evaluate to a constant [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  ../src/function.cc(144): note: failure was caused by non-constant arguments or reference to a non-constant symbol
  ../src/function.cc(144): note: see usage of 'n_total_args'
../src/function.cc(146): error C3863: array type 'void *[n_total_args]' is not assignable [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
  gobject.cc
  closure.cc
  boxed.cc
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'unsigned' is illegal (did you forget a ';'?) (compiling source file ../src/gobject.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'int' is illegal (did you forget a ';'?) (compiling source file ../src/gobject.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2208: 'unsigned __int64': no members defined using this type (compiling source file ../src/gobject.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'unsigned' is illegal (did you forget a ';'?) (compiling source file ../src/closure.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'int' is illegal (did you forget a ';'?) (compiling source file ../src/closure.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2208: 'unsigned __int64': no members defined using this type (compiling source file ../src/closure.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'unsigned' is illegal (did you forget a ';'?) (compiling source file ../src/boxed.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2628: 'ffi_arg' followed by 'int' is illegal (did you forget a ';'?) (compiling source file ../src/boxed.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
C:\msys64\mingw64\lib\libffi-3.2.1\include\ffi.h(264): error C2208: 'unsigned __int64': no members defined using this type (compiling source file ../src/boxed.cc) [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
../src/loop.cc(61): error C3861: 'g_source_add_unix_fd': identifier not found [C:\msys64\home\samsung\oss\node-gtk\build\node-gtk.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\msys64\home\samsung\oss\node-gtk\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\msys64\\home\\samsung\\oss\\node-gtk\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\msys64\\home\\samsung\\oss\\node-gtk\\build\\Release\\node-v47-win32-x64\\node-gtk.node" "--module_name=node-gtk" "--module_path=C:\\msys64\\home\\samsung\\oss\\node-gtk\\build\\Release\\node-v47-win32-x64"
gyp ERR! cwd C:\msys64\home\samsung\oss\node-gtk
gyp ERR! node -v v5.7.0
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\msys64\home\samsung\oss\node-gtk\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\msys64\home\samsung\oss\node-gtk\build\Release\node-v47-win32-x64\node-gtk.node --module_name=node-gtk --module_path=C:\msys64\home\samsung\oss\node-gtk\build\Release\node-v47-win32-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\msys64\home\samsung\oss\node-gtk\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:100:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:827:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 10.0.10586
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\msys64\\home\\samsung\\oss\\node-gtk\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\msys64\home\samsung\oss\node-gtk
node-pre-gyp ERR! node -v v5.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.21
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\msys64\home\samsung\oss\node-gtk\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\msys64\home\samsung\oss\node-gtk\build\Release\node-v47-win32-x64\node-gtk.node --module_name=node-gtk --module_path=C:\msys64\home\samsung\oss\node-gtk\build\Release\node-v47-win32-x64' (1)

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v5.7.0
npm ERR! npm  v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-gtk package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-gtk
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-gtk
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\msys64\home\samsung\oss\node-gtk\npm-debug.log

GtkSettings error in browser.js

/tmp/node-gtk/examples/browser.js:44
    gtkSettings.set_property('gtk-application-prefer-dark-theme', true);
                ^

TypeError: gtkSettings.set_property is not a function
    at /tmp/node-gtk/examples/browser.js:44:17
    at Object.<anonymous> (/tmp/node-gtk/examples/browser.js:113:2)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:141:18)
    at node.js:933:3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.