Vala

run part of code as root

Deadly 提交于 2019-11-28 10:52:48
问题 I have a package which runs uses Gtk and written in vala.A dialog box or a gui opens after selecting a file.I want this dialog box or gui to run as root so as to open and read the files which don't open with normal users.I have this code static void open_file(string filename) { selected_file = filename; stdout.printf(selected_file); new ProgressWindow(selected_file, {}); } I want to run ProgressWindow to run as root.Is it possible? 回答1: No. To run as root, it must be in a separate process and

understanding vala compilation warnings

风流意气都作罢 提交于 2019-11-28 08:10:59
问题 The compilation warnings below are not so clear to me, appart from the deprecation warhing, but the signature of the method in the valadoc : http://valadoc.org/#!api=gstreamer-1.0/Gst shows no other method signature. the other warning are more obscure. max@max-ubuntu:~/mdev/cr valac --pkg gstreamer-0.10 gstpipe.vala /home/max/dev/main-sandbox/cr/gstpipe.vala.c: In function ‘application_message’: /home/max/dev/main-sandbox/cr/gstpipe.vala.c:64:2: warning: passing argument 1 of ‘_gst_structure

Vala GUI and logic in C++

前提是你 提交于 2019-11-27 15:14:21
问题 I have a drawing program that uses SDL, written in C++. I would like to create a graphical interface only in Vala and use it to call functions from a program (functions are ready to use and I only want to call them from the GUI). I was looking for solutions as VAPI, and I was thinking of using GObject, but I can not embrace both. Has anyone done similar things and can you suggest me a solution to my problem? 回答1: If you want to use the C++ code in Vala we prepare them properly. Here's an

How to repair warning: missing braces around initializer?

浪子不回头ぞ 提交于 2019-11-27 12:56:02
问题 The warning is produced by the c code generated by vala. warning: missing braces around initializer The code works but the warning is annoying. The vala code referenced by the warning is struct Position {uint x; uint y;} private static Position positions[8]; The generated C code is static Position det_positions[8] = {0}; I've tried initializing positions half a dozen different ways but can't seem to get the syntax to satisfy the warning. Is this GCC bug 53119 or is there a way to fix it? 回答1:

选用 Vala 的十个理由,用 Vala 开发了170个模块后的感悟

谁说我不能喝 提交于 2019-11-26 20:13:19
选用 Vala 作为工作语言开发新工具,开发了170个模块,应该对Vala稍微有一点发言权了,所以有了就有了这个系列分享。 首先想说说Vala语言的优点,通过实践总结了选用Vala的十个理由: 1、语法学习兼容C#和Java,表达能力强,生产力高。 2、内存所有权和使用引用计数管理,内存使用无烦恼。 3、接口支持抽象接口,也支持类似PHP traits 的接口实现。 4、点分名字空间支持大型应用开发。 5、语言级别的强大的正则表达式支持。 6、有C的速度和良好的互操作性支持(可以生成C头文件和C代码并获得全平台支持)。 7、强大且成熟的类库支持 基于Glib的强大类库体系,有工业级成熟度的各种库和GUI框架。默认基于GObject 的对象系统,也支持构建自己的单根对象体系。 8、有丰富且完善的文档支持(valadoc.org)也有大量开源项目可供参考学习。 9、有多种语言服务器【LSP】实现,支持各种编辑器和IDE; 10、Gnome 和 Elementary OS官方钦定语言,并获得IBM公司研究机构支持。 来源: https://my.oschina.net/u/3158969/blog/3086084