Vala

How to use valadoc?

我的梦境 提交于 2019-12-20 04:53:24
问题 I am currently writing a library in Vala. I have come to a point where I would like to generate some documentation from my sources. valadoc seems to be the right tool to do this, but there is not much information on how to use it, the manpage is very short. I tried to run it with valadoc -o doc src/*.{vala,vapi} which gives me these error messages: unixodbc.vala:21.7-21.9: error: The namespace name `Gee' could not be found unixodbc.vala:40.9-40.27: error: The type name `Map' could not be

How do I connect a custom function to the clicked action of a GTK Button?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 02:49:10
问题 I am working my way through the Vala GTK+3 tutorial provided by Elementary OS. I understand that this code: var button_hello = new Gtk.Button.with_label ("Click me!"); button_hello.clicked.connect (() => { button_hello.label = "Hello World!"; button_hello.set_sensitive (false); }); uses a Lambda function to change the button's label when it's clicked. What I want to do is call this function instead: void clicked_button(Gtk.Button sender) { sender.label = "Clicked. Yippee!"; sender.set

Redirecting output of an external application started with glib

丶灬走出姿态 提交于 2019-12-14 02:36:11
问题 I'm trying to use vala to start an external application using GLib with spawn_command_line_sync(). According to the documentation (http://valadoc.org/#!api=glib-2.0/GLib.Process.spawn_sync) you can pass a string to store the output of the external application. While this works fine when starting a script which prints a couple of lines, I need to call a program which will print the content of a binary file. (for example "cat /usr/bin/apt-get") Is there any way how I can receive the output of

GTK+ application specific skin possible?

非 Y 不嫁゛ 提交于 2019-12-13 06:44:12
问题 I've started working with GTK+ and Vala and am having a hard time finding documentation on creating custom buttons (totally new looking buttons). In fact now that I think about it, every GTK+ application has that distinct look that gives away that it's a GTK+ app. Is it difficult to create a totally new look for my application if I decide to use GTK+? 回答1: You can use the GTK2_RC_FILES environment variable to assign a special theme to (only) your application. For example, you can create a

Revealing and hiding search entry - Gtk

心不动则不痛 提交于 2019-12-13 01:24:38
问题 Background This is part of an exercise, in which I am creating a small text editor in genie. The app so far is working very well. Aim I got stuck in creating a search entry box that is revealed upon clicking in a search button at the headerbar. Code init Gtk.init (ref args) var app = new Application () app.show_all () Gtk.main () // This class holds all the elements from the GUI class Application : Gtk.Window _view:Gtk.TextView _filename:string _search_button:Gtk.Button _search_entry:Gtk

How to do OptionContext parsing on an instance?

Deadly 提交于 2019-12-13 01:05:31
问题 I'm trying to get options parsing using OptionContext to work. My code so far: public class Options : GLib.Object { public string option_output = ""; public Options () { } public void parse (string args[]) throws OptionError { // string option_output; const OptionEntry[] options = { { "output", 'o', 0, OptionArg.FILENAME, ref option_output, "file name for encoded output (required);", "FILE" }, {null} }; var opt_context = new OptionContext ("- vpng2theora"); opt_context.set_help_enabled (true)

How would I mix up C++ with VALA

时光毁灭记忆、已成空白 提交于 2019-12-12 19:19:33
问题 I need to write GUI applications for cross platform in C++ but since most of GUI libraries for C++ are bit tedious and I am quite familiar with C#/.NET I found out code Vala codes with GTK is quite interesting and bit easy compare with other ways.so how would I mix up VAlA with C++. I meant use VALA for front end and code rest of parts in C++. 回答1: You can use QT if it's meeting your requirements. Qt is a cross-platform application and UI framework with APIs for C++ programming as well. http:

Vala: Passing a generic array corrupts values

血红的双手。 提交于 2019-12-12 19:05:26
问题 How can I pass an array to a generic function? The following code does compile, but the output gets somewhat corrupted: void foo<T> (T[] arr) { foreach (T element in arr) { var element2 = (int) element; stdout.printf (element2.to_string() + "\n"); } } void main () { int[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; foo<int> (array); } Output: 0 2 4 6 8 113 0 -1521013800 0 0 What am I doing wrong? 回答1: You discovered a compiler bug. The array is treated as an array of pointers and then things go

Setting up Taglist plugin to work with vala

喜欢而已 提交于 2019-12-12 17:17:02
问题 Like the title says,I would like to develop vala with vim.My productivity is badly affected due to the lack Taglist plugin support for vala. I found a ctags implementation in valide, http://bazaar.launchpad.net/~valide/valide/trunk/files/head:/ctags-vala/ Can anyone guide me how to make this ctag implemention work with Taglist or some other vim plugin which works for vala 回答1: Found the answer, set this is .vimrc let tlist_vala_settings='c#;d:macro;t:typedef;n:namespace;c:class;'. \ 'E:event

How can one update GTK+ UI in Vala from a long operation without blocking the UI

余生颓废 提交于 2019-12-12 10:25:23
问题 When I use any of the codes in this page without modifying anything: https://wiki.gnome.org/Projects/Vala/AsyncSamples I always get: warning: ‘g_simple_async_result_new’ is deprecated: Use 'g_task_new' instead. So I proceed with the recommendation of using GTask. However, when I try to use GLib.Task in Vala, I get stuck just declaring a task. So instead of using async from GIO in my own code, since it is deprecated, I try to use GLib.Task to simply update the label of a Gtk Button with