Vala

vala Webkit.WebView DOM manipulation

♀尐吖头ヾ 提交于 2019-12-24 13:07:33
问题 How can manipulate the DOM tree in webkit2gtk-4.0? Old version: WebKit.DOM.Document doc = get_dom_document(); WebKit.DOM.Element el = doc.create_element("div"); el.append_child(doc.create_text_node(color)); ((WebKit.DOM.EventTarget) el).add_event_listener("dblclick", (Callback) on_div_clicked, false, this); doc.body.insert_before(el, null); compile: valac --pkg gtk+-3.0 --pkg libsoup-2.4 --pkg webkitgtk-3.0 New version compile: valac --pkg gtk+-3.0 --pkg webkit2gtk-4.0 error: error: The

webkit/webkit.h: No such file or directory

只愿长相守 提交于 2019-12-24 04:41:10
问题 I am trying to create Vala program with WebKit. Here is how I compile it: valac --pkg gtk+-3.0 --pkg granite --pkg glib-2.0 --pkg webkitgtk-3.0 <filenames> and in one file I included WebKit: using WebKit; The compiler says: fatal error: webkit/webkit.h: No such file or directory #include <webkit/webkit.h> I heard that this file should be in /usr/include/webkit/webkit.h, but it isn't there. I'm using elementary OS Freya x64. Can you tell me which packages I need to install or what else I need

How does Vala support the C language's __function__ __file__ __line__ macros?

感情迁移 提交于 2019-12-24 02:17:04
问题 I need add some log informations with souce file name, function name, line number etc... I have check the official docs, but not found... so, how to do for it ? 回答1: This is usually done via GLib logging. For example try this Vala application: int main (string[] args) { // info () is not shown by default, set G_MESSAGES_DEBUG=all in your shell to see them info ("Hello World"); warning ("Hello World"); //assert_true (false); // error () terminates the program error ("Hello World"); return 0; }

Bounded type parameters in Vala

拥有回忆 提交于 2019-12-23 19:22:49
问题 In Java you can have something like this class MyClass<E extends A> { ... In C# class MyClass<E> where E : A { ... Anything similar in Vala? 回答1: No, not supported in Vala. This is all available keywords in the language Vala, and the "where" specifier is not there. Here is a filled bug to ask for this feature. I've had need for constraints as well, in the and I had to change my design to use a normal generic type. 来源: https://stackoverflow.com/questions/40692468/bounded-type-parameters-in

Chain up to 'Gtk.Box.new' not supported

六眼飞鱼酱① 提交于 2019-12-22 17:56:26
问题 I'm new to Vala and so far I think it's pretty cool but I'm having trouble understanding inheritance. I read here that I should use base() to call the parents constructor. Alright, cool, seems understandable but It din't work for me. I kept getting the error on the title. Here is my snippet to show: public class MyBox : Gtk.Box { public MyBox(Gtk.Orientation orientation, int spacing) { // I have to this this.set_orientation(orientation); this.set_spacing(spacing); // I want to do this: base

Vala different type of constructors

雨燕双飞 提交于 2019-12-22 11:03:33
问题 Why, and what does the three vala constructors ? class construct construct method with class name and more specific, why the 3rd construct is never called when using it from a Gtk.Builder file? 回答1: Short answer: because that's how GObject works. The long answer is just a smidge longer: C doesn't have objects or constructors, it has structs and functions. Structs are very simple; they contain fields, and that's it. No methods, constructors, destructors, etc. They look like this: typedef

Vala: reducing the size of dependencies

余生颓废 提交于 2019-12-21 10:56:09
问题 I am developing small command line utilities using Vala on win32. Programs compiled using vala depend on the following DLLs libgobject-2.0-0.dll libgthread-2.0-0.dll libglib-2.0-0.dll They are taking up 1500 kbyes of space. Is there a way to reduce the size of these dependencies (besides compressing them with UPX and the like)? I can't imagine a simple helloworld like app using all the features provided by glib. Thanks! 回答1: If your vala source is fairly simple, you may be able to compile it

Mysterious byte after TLS-Package

*爱你&永不变心* 提交于 2019-12-21 06:42:11
问题 I am trying to create a SSL TCP Connection from Java to a Vala Server. Everything works fine until I send a second package to the server. (also the first package sends fine). The server only receives the first byte (in this case the "1") of the second package, nothing else, but if I connect to the server without SSL everything works fine. I think that the server isn't the problem, because every other connection from another Vala client works pretty well. I'm using an unstrusted Certificate,

Mysterious byte after TLS-Package

寵の児 提交于 2019-12-21 06:41:19
问题 I am trying to create a SSL TCP Connection from Java to a Vala Server. Everything works fine until I send a second package to the server. (also the first package sends fine). The server only receives the first byte (in this case the "1") of the second package, nothing else, but if I connect to the server without SSL everything works fine. I think that the server isn't the problem, because every other connection from another Vala client works pretty well. I'm using an unstrusted Certificate,

How to generate GIR files from the Vala compiler?

瘦欲@ 提交于 2019-12-21 04:27:19
问题 I am trying to create python bindings to a vala library using pygi with gobject introspection. However, I am having trouble generating the GIR files (that I am planning to compile to typelib files subsequently). According to the documentation valac should support generating GIR files. Compiling the following helloworld.vala public struct Point { public double x; public double y; } public class Person { public int age = 32; public Person(int age) { this.age = age; } } public int main() { var p