Vala

Compiling a Vala source On Windows

南笙酒味 提交于 2019-12-08 17:34:05
问题 I compiled a vala program by using following command: valac test.vala Of course am I able to run the program on my computer, but when I am trying to run the .exe file on a different one I get following error: libglib-***.dll is missing on this computer This is how my source code looks like: using GLib; int main(string[] args) { bool running = true; while(running) { print("Hello World\n"); } return 0; } The error is pretty clear, but what can I do against it? Thanks in advance. 回答1: Along your

Sometimes GTK modal dialogs are not modal — bug or feature?

心已入冬 提交于 2019-12-08 14:26:07
问题 When I create a custom dialog in GTK ( both, GTK2 or GTK3 ) and set it to be modal, all input to other windows of my application is ignored. This works nearly always, but it fails under certain conditions. When I add a ScrolledWindow containing a TreeView to my dialog, it still works as supposed. But if I fill the TreeView with entries until the ScrolledWindow starts to display its scroll bars --- the modality is suddenly lost and I can click on my other windows! Here is the most basic

How to load a widget as a different thread in gtk? (vala)

半腔热情 提交于 2019-12-08 09:40:16
问题 I created this class, And I want to load thumbnails into the iconview as a different thread for efficiency reasons, because the gui load very slow if I do it in the same thread. But when I create the thread, it doesn't works, it draw some thumbnails and then they dissapear. When I use join, it works. This is my code: public class FotoThumbnailPane : Gtk.ScrolledWindow{ private FotoThumbnailPane_i pane; private string namet; public FotoThumbnailPane(string name){ this.namet = name; } public

How to concatenate two arrays?

泪湿孤枕 提交于 2019-12-08 05:13:17
问题 [indent=4] init x: array of int = {1, 2, 3} y: array of int = {4, 5, 6} z: array of int = x + y The above code produces this error message: concat_arrays.gs:6.23-6.27: error: Incompatible operand z: array of int = x + y The Vala translation doesn't work any better: int main () { int[] x = {1, 2, 3}; int[] y = {4, 5, 6}; int[] z = x + y; return 0; } The error message is: concat_arrays_v.vala:4.15-4.19: error: Incompatible operand int[] z = x + y; What is the correct way to do this? 回答1: Using

How to sort a dict in genie

一个人想着一个人 提交于 2019-12-08 03:54:33
问题 Update Solved the compiling error, now the only problem with the code is how to sort the dict alphabetically for pretty printing. I am refactoring an argument parser from python into Genie, however I found myself stuck in how to sort the items form a dict before appending them to a list. In python it is as simple as: lines.append("Options:") if len(self.options): for name, option in sorted(self.options.items()): lines.append(" %s: %s" % (name, option.values)) else: lines.append(" [none]")

Filling a custom-shaped Clutter Actor with a Cairo-drawn canvas

扶醉桌前 提交于 2019-12-08 02:15:39
问题 Clutter 1.12 Cogl 1.10 Vala or C or Python. I might have a fundamental misunderstanding here — I think of "Actors" as 3D polygon things. I think of their colours as either vertex colors or as texture-mapping. In this light, I have been trying to draw a custom Actor and fill it with stuff drawn via Cairo. I'm not getting anywhere. Code is included below (in Vala). Can anyone set me right about Clutter's basics (the docs just don't cut it) or, if I'm close, help me get that code working. I

How to include resources file in anjuta project

余生颓废 提交于 2019-12-07 13:48:14
问题 I'm trying to update a graphical project in vala, moving lot of code lines into an ui file. I want to use template (available with glib-2.38 and GTK+3.8, something like that). My project is managed with Anjuta and autoconf. In the src directory there are application.ui : <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.8 --> <template class="SpiWindow" parent="GtkApplicationWindow"> <property name="title" translatable="yes">Example Application</property>

Vala and PolicyKit

不问归期 提交于 2019-12-07 13:38:24
问题 I'm creating a simple GTK+ based application in Vala, which should be able to write into system directories, so it needs root access. I realize that giving full root access is a bad idea, so I need a way to gain temporary privileges. In theory, the PolicyKit D-Bus service is the tool for the job, but I have no idea how to use it, let alone in Vala code. Any insight would be appreciated. update: I have done some further digging. My starting point was this. So basically what I need is finding

Inserting uris into Gtk.Clipboard with vala

走远了吗. 提交于 2019-12-07 12:18:25
问题 I am currently trying to implement copy and paste for my application, the problem is that i can only plaintext or images to the clipboard according to the documentation of Gtk.Clipboard : https://valadoc.org/gtk+-3.0/Gtk.Clipboard.html set_text / set_image . But then there is also this method https://valadoc.org/gtk+-3.0/Gtk.Clipboard.set_with_data.html set_with_data , which i think i can use for adding a uri or an array of uris. But i can't figure out how and didn't find any good examples

How to handle errors while using Glib.Settings in Vala?

帅比萌擦擦* 提交于 2019-12-07 09:44:23
问题 I am using Glib.Settings in my Vala application. And I want to make sure that my program will work okay even when the schema or key is not available. So I've added a try/catch block, but if I'm using the key that doesn't exist, the program segfaults. As I understood, it doesn't even reach the catch statement. Here is the function that uses settings: GLib.Settings settings; string token = ""; try { settings = new GLib.Settings (my_scheme); token = settings.get_string("token1"); } catch (Error