creationix / node-gir Goto Github PK
View Code? Open in Web Editor NEWNode bindings to libgirepository
Home Page: http://live.gnome.org/GObjectIntrospection
License: MIT License
Node bindings to libgirepository
Home Page: http://live.gnome.org/GObjectIntrospection
License: MIT License
node-waf configure
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : not found
Checking for gobject-introspection-1.0 : yes
Checking for glib-2.0 : yes
'configure' finished successfully (0.060s)
node-waf build
Waf: Entering directory `/my-node-gir-path/build'
[ 3/10] cxx: src/namespace_loader.cc -> build/Release/src/namespace_loader_1.o
[ 6/10] cxx: src/values.cc -> build/Release/src/values_1.o
[ 7/10] cxx: src/types/object.cc -> build/Release/src/types/object_1.o
[ 8/10] cxx: src/types/struct.cc -> build/Release/src/types/struct_1.o
../src/namespace_loader.cc: In static elementfunction »static void gir::NamespaceLoader::Initialize(v8::Handle<v8::Object>)«:
../src/namespace_loader.cc:18:58: Error: »NODE_SET_METHOD« not defined
Waf: Leaving directory `/my-node-gir-path/build'
Build failed: -> task failed (err #1):
{task: cxx namespace_loader.cc -> namespace_loader_1.o}
What's wrong?
For example
var box = new gtk.Box(gtk.Orientation.vertical, 4);
or
var box = new gtk.Box({orientation:gtk.Orientation.vertical});
are not working, the box has no vertical orientation or an error.
But this works:
box.orientation = gtk.Orientation.vertical;
Similar in
label = new gtk.Label("test");
This label has not the given text "test" inside it.
But this works:
label.set_label("test");
or this works,too:
label = new gtk.Label({label:"test"});
I get an error message with the few code of var rpg = Gir.load('rpg', '0.3');
Nevertheless I can use my library.
** (process:17727): CRITICAL **: g_irepository_find_by_name: assertion `typelib != NULL' failed
** (process:17727): CRITICAL **: g_irepository_find_by_name: assertion `typelib != NULL' failed
** (process:17727): CRITICAL **: g_interface_info_get_n_prerequisites: assertion `GI_IS_INTERFACE_INFO (info)' failed
** (process:17727): CRITICAL **: g_interface_info_get_n_methods: assertion `GI_IS_INTERFACE_INFO (info)' failed
** (process:17727): CRITICAL **: g_irepository_find_by_name: assertion `typelib != NULL' failed
** (process:17727): CRITICAL **: g_irepository_find_by_name: assertion `typelib != NULL' failed
** (process:17727): CRITICAL **: g_interface_info_get_n_prerequisites: assertion `GI_IS_INTERFACE_INFO (info)' failed
** (process:17727): CRITICAL **: g_interface_info_get_n_methods: assertion `GI_IS_INTERFACE_INFO (info)' failed
** (process:17727): CRITICAL **: g_irepository_find_by_name: assertion `typelib != NULL' failed
** (process:17727): CRITICAL **: g_irepository_find_by_name: assertion `typelib != NULL' failed
** (process:17727): CRITICAL **: g_interface_info_get_n_prerequisites: assertion `GI_IS_INTERFACE_INFO (info)' failed
** (process:17727): CRITICAL **: g_interface_info_get_n_methods: assertion `GI_IS_INTERFACE_INFO (info)' failed
This script:
var Midgard, gir;
gir = require("./build/default/girepository.node");
gir.init();
Midgard = gir.load("Midgard");
Causes:
Program received signal SIGSEGV, Segmentation fault.
0x00007fffd1cc63f4 in g_base_info_get_name ()
from /usr/lib/libgirepository-1.0.so.1
(gdb)
(gdb) bt full
#0 0x00007fffd1cc63f4 in g_base_info_get_name ()
from /usr/lib/libgirepository-1.0.so.1
No symbol table info available.
#1 0x00007fffd1f2c41a in gir::GIRObject::PropertyList (info=0xc4c800)
at ../src/interfaces/object.cc:554
parent = 0x0
l = 0
list = {val_ = 0xc16b18}
first = false
gcounter = 0
#2 0x00007fffd1f299c5 in gir::GIRObject::Prepare (target=...,
info=0xc4c800) at ../src/interfaces/object.cc:152
temp = {<v8::Handle<v8::FunctionTemplate>> = {
val_ = 0xc16ad0}, <No data fields>}
oft = {type_name = 0xc3ea80 "ParamLongtext", info = 0xc4c800,
function = {<v8::Handle<v8::FunctionTemplate>> = {
val_ = 0x7ffff7fa3d88}, <No data fields>}, type = 12893408}
scope = {prev_next_ = 0xc16ad0, prev_limit_ = 0xc18860,
is_closed_ = false}
name_ = 0x7fffd1f0b7a4 "ParamLongtext"
name = 0xc3ea80 "ParamLongtext"
t = {<v8::Handle<v8::FunctionTemplate>> = {
val_ = 0x7ffff7fa3d88}, <No data fields>}
l = 0
#3 0x00007fffd1f25166 in gir::NamespaceLoader::BuildClasses (
namespace_=0xc40eb0 "Midgard") at ../src/namespace_loader.cc:75
info = 0xc4c800
i = 58
exports = {val_ = 0xc16898}
length = 171
#4 0x00007fffd1f25073 in gir::NamespaceLoader::LoadNamespace (
namespace_=0xc40eb0 "Midgard") at ../src/namespace_loader.cc:52
er = 0x0
lib = 0xc42000
#5 0x00007fffd1f24e8c in gir::NamespaceLoader::Load (args=...)
at ../src/namespace_loader.cc:32
scope = {prev_next_ = 0xc16890, prev_limit_ = 0xc18860,
is_closed_ = false}
namespace_ = {str_ = 0xc40eb0 "Midgard", length_ = 7}
exports = {val_ = 0xc16890}
#6 0x000000000056db10 in ?? ()
No symbol table info available.
...
Midgard GIR file is from Ubuntu OBS packages, and today's checkout of node-gir.
eg:
to run the examples, first build the project with
node-waf configure
node-waf build
then run $SCRIPT
with node $SCRIPT
.
hi
i've some problems to understand where i fall, because it seems that when i try to connect a callback to a menuitem, when i click on that, it repeats the launching of the callback a number of times equals to the number of elements in that menu.
probably the function that link callbacks needs some work.
example:
var menu1=new gtk.Menu();
var menu1label=new gtk.MenuItem({label: "File"});
var openlabel=new gtk.MenuItem({label:"Open"});
var quitlabel=new gtk.MenuItem({label:"Quit"});
quitlabel.on("select", function() { console.log("quit"); } );
openlabel.on("select", function() { console.log("open"); });
menubar.append(menu1label);
menu1label.set_submenu(menu1);
menu1.append(openlabel);
menu1.append(quitlabel);
menu1label.show_all();
GError should extend Exception. Every derived exception should depend on GError's domain. For example, GFileError should be propagated as FileError exception with particular codes.
C structures are propagated as objects. However, node gir structure's constructor doesn't accept arguments if C function requires such to create new structure.
This link is handy :
https://live.gnome.org/GObjectIntrospection/Doctools
three lines after the WebKit 3.0 documentation is generated :)
I ported the guitar tuner example from GNOME developer docs to node-gir and CoffeeScript:
https://github.com/bergie/node-gir/blob/master/examples/guitartuner.coffee
When I try to make GStreamer to play a sound (by clicking a button), there is a segfault. Backtrace is:
(gdb) run guitartuner.js
Starting program: /usr/bin/node guitartuner.js
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff63a8700 (LWP 14064)]
[New Thread 0x7fffee905700 (LWP 14065)]
[New Thread 0x7fffed093700 (LWP 14066)]
369.23
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5769d60 in g_base_info_equal () from /usr/lib/libgirepository-1.0.so.1
(gdb) bt full
#0 0x00007ffff5769d60 in g_base_info_equal () from /usr/lib/libgirepository-1.0.so.1
No symbol table info available.
#1 0x00007ffff599f21b in gir::GIRObject::New(_GObject*, _GIBaseInfoStub*) () from /home/bergie/Projects/node-gir/build/Release/lib.target/girepository.node
No symbol table info available.
#2 0x00007ffff599c358 in gir::Args::FromGType(_GIArgument*, _GIBaseInfoStub*, int) () from /home/bergie/Projects/node-gir/build/Release/lib.target/girepository.node
No symbol table info available.
#3 0x00007ffff599d35b in gir::Func::Call(_GObject*, _GIBaseInfoStub*, v8::Arguments const&, bool) ()
from /home/bergie/Projects/node-gir/build/Release/lib.target/girepository.node
No symbol table info available.
#4 0x00007ffff599de75 in gir::GIRObject::CallStaticMethod(v8::Arguments const&) () from /home/bergie/Projects/node-gir/build/Release/lib.target/girepository.node
No symbol table info available.
#5 0x0000000000592b62 in ?? ()
saw bergies post in node gir, im the maintainer of seed, so if you need help there is a javascript mailing list on gnome.
Please rethink the camels method mangling, it will break all compatibility between gjs and seed.
The connect<>on mentioned should be feasible in the javascript wrapper layer
$ node browser.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Requiring namespace 'Gtk' version '2.0', but '3.0' is already loaded
at Object.<anonymous> (/home/james/src/node-gir/examples/webkit.js:6:35)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at require (module.js:346:19)
at Object.<anonymous> (/home/james/src/node-gir/examples/browser.js:5:14)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
yes I have gtk3 installed. example works fine when using gtk2.
Hi,
I'm trying to run some of your examples on a headless server / via Xvfb on a Linux box. I figured I'd ask if you had any advice / if this were possible.
The end goal is basically to run a headless server running some the examples in the ./examples dir, and then using a remote machine's browser to connect to the headless server to run the examples.
I'm going through it right now.
Thanks!
Hi,
i suppose you just forgot to set them...
I understand it is a missing type in node-gir.
This comes up when doing
webView.get_main_frame().print_full(printOp, gtk.PrintOperationAction.export);
or the webkitgtk C equivalent :
webkit_web_frame_print_full(mywebframe, myPrintOperation, GTK_PRINT_OPERATION_ACTION_EXPORT)
Just curious, but some portions of this code was licensed under GPL2, and the license was stripped out. I think that’s technically a license breach. Any particular reason the license was removed?
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm http GET https://registry.npmjs.org/gir
npm http 304 https://registry.npmjs.org/gir
> [email protected] install /home/alan/Projetos/gir/node_modules/gir
> node-gyp rebuild
static library binding.gyp:girepository#target has several files with the same basename:
function: src/function.cc src/types/function.cc
Some build systems, e.g. MSVC08, cannot handle that.
gyp: Duplicate basenames in sources section, see list above
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.8.0-30-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/alan/Projetos/gir/node_modules/gir
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
the latest version of gtk is gtk3. node-gir is a brand new project, there's no reason to start it off by using legacy gtk versions.
As I discovered that GNOME's docs are really unfriendly to JS-only developers.
And after a long time I didn't find a document about seed or gjs as friendly as Node APIs.
That's why I want to try node-gir.
Please is there any document I can refer to in writing GTK applications with node-gir?
I mean is there a plain description about gir when you implement node-gir?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.