Questions tagged [vala]

Vala is an object-oriented programming language that allows modern programming techniques to be used to write applications that run on the GNOME runtime libraries, particularly GLib and GObject. Vala is syntactically similar to C#, and is compiled to C which is then compiled to a native binary using the C compiler of the platform.

vala
Filter by
Sorted by
Tagged with
1 vote
0 answers
91 views

Why an array of structs containing a pointer member has to be const?

This question actually arose when I was using the OptionEntry struct which happens to have a void* field. So the example below is not too hypothetical. struct Item { public string name; public ...
semicolon's user avatar
0 votes
1 answer
372 views

Setting Test Environment Variables With Vala and Meson

Hello Stackoverflow Community, So I am trying to set environment vars for a database test in a vala project, but I can't find evidence of the variable anywhere. I also tried setting command line args ...
BQPIncomplete's user avatar
0 votes
1 answer
143 views

How to use GCrypt AES128 in Vala?

I tried with this code but the result is not as expected, maybe I am wrong somewhere, please help. gcrypt.vapi from: https://gitlab.gnome.org/GNOME/vala-extra-vapis using GCrypt; using Posix; void ...
ThinhBuzz's user avatar
2 votes
2 answers
1k views

Vala - How to set color of Gtk4.Label programatically?

I have a Gtk4 Gtk.Label. I want to change it's color & size attribute programatically. The markup way <span foreground='red' size='large'> is easy to use. But after some time, I want to ...
eminfedar's user avatar
  • 680
2 votes
1 answer
404 views

Vala - Bytes convert to string?

I have a GLib.Bytes object. I want to print it and use it as a string like this: Bytes bytes = new Bytes({65, 66, 67}); print(bytes); // <-- ERROR How can I convert it to string?
eminfedar's user avatar
  • 680
1 vote
1 answer
221 views

Vala - How to join string[] to string?

I have a string array: string[] arr = {"Hello", "World"}; I want to print it or convert it to a string like: print(arr.join(",")); > "Hello,World" How can ...
eminfedar's user avatar
  • 680
0 votes
1 answer
111 views

How to pass widget and data from one file to another file in different class?

Beginner-level questions. I’m creating a counter application (first application from The 7 Tasks). I created this application in one file and it is working fine. Following is the code. class ...
Kiran's user avatar
  • 448
1 vote
1 answer
76 views

Postgresql is not being found within my vala project

So I have a project but it is using Vala, it has been so hard finding much within the community but making it through. I have this one project, may be simple but I am find it to be dragging for a long ...
NJAS's user avatar
  • 63
0 votes
0 answers
263 views

Is there a way to automatically set the theme of a Gtk3 GUI according to system theme in Python?

I'm making a GUI for an Elementary OS app in Python, using Gtk3 for the GUI. I want to set the theme (light/dark/whichever theme is being used in Gnome) automatically according to the theme on the ...
Dhruv Joshi's user avatar
0 votes
1 answer
290 views

Obscene amount of conflicting errors when using GTK4 and webkit2gtk together in Vala

Using the GNOME Documentation, I wanted to write a demo of using webkit and GTK4 together in Vala by porting GTK3 code. However, when changing the library from gtk3 to gtk4, a crazy amount of errors ...
1ctinus's user avatar
  • 75
0 votes
0 answers
79 views

Vala networking packets in DataInputStream

I've been playing around with networking in Vala but I can't find any documentation on how to read a signal packet or tell when one packet ends and another one starts in the incoming data stream. Here ...
Thomas's user avatar
  • 38
2 votes
1 answer
234 views

Determine number of visible Gtk.FlowBox children

I'm using a Gtk.FlowBox with a number of Gtk.FlowBoxChild children. Based on buttons selected by a user I'm applying different Gtk.FlowBoxFilterFunc functions. I would like to determine at any point ...
avojak's user avatar
  • 2,372
0 votes
1 answer
183 views

How to get user's password?

How to get user password with Vala? Secret.prompt.perform_sync() seems doesn't work. I really don't know how use secret.prompt. Main.vala: class SecretServ : Secret.Service { } class SecPrompt : ...
urandom0's user avatar
0 votes
1 answer
68 views

Declaring a new enum in VAPI binding

I'd like to declare an entirely new enum (instead of binding to C one) in VAPI file. However, when I write [CCode (has_type_id = false)] public enum EventKeyState { UP = 0, DOWN = 1, ...
val - disappointed in SE's user avatar
1 vote
1 answer
74 views

Vala `load_contents` error with large files

I'm trying to read the content of a file (should be easy...) and I have no problems until I try to read huge files (more than 2 GB). I get an error that i don't know how to solve and I have not found ...
Eduard Berloso Clara's user avatar
1 vote
1 answer
54 views

What is difference between method hiding and without "new" keyword?

This is the method hiding: class SuperClass : GLib.Object { public void method1() { stdout.printf("SuperClass.method1()\n"); } } class SubClass : SuperClass { public new ...
urandom0's user avatar
0 votes
1 answer
192 views

Why do I got this error: error: too few type arguments

I am learning Vala programming and I got this error message. inter.vala:9.55-9.65: error: too few type arguments public class Totumfaktum : GLib.Object, ITotumfaktum, Traversable { ...
urandom0's user avatar
0 votes
1 answer
61 views

Accessing a string out of bounds does not trigger any valgrind/ASAN/UBSAN warnings

I have this code: static int main(string[] args) { info(escape_latex(args[1])); return 0; } string escape_latex(string input) { var builder = new StringBuilder.sized(input....
JCWasmx86's user avatar
  • 3,513
2 votes
1 answer
188 views

GLib.Notification fails to activate action with a non-null VariantType

I'm trying to send a GLib.Notification from my application and pass a string parameter. The name of the action is action-show-chat-view, and it is registered in the activate () method of my main ...
avojak's user avatar
  • 2,372
0 votes
1 answer
58 views

GLib.NetworkMonitor incorrect initial network availability in Flatpak app

I'm packaging a Flatpak application that checks the network availability on startup. Since switching to Flatpak packaging I've noticed that the GLib.NetworkMonitor is initially reporting no network ...
avojak's user avatar
  • 2,372
0 votes
1 answer
917 views

expected ';' before 'static' error, occurs only on ubuntu and not windows when compiling with gcc

When compiling with ninja on Ubuntu 18.04 with gcc11, I get multiple instances of the error: expected ‘;’ before ‘static’ Here is an example of one part of the code which is causing the issue, ...
DEFAULT's user avatar
  • 37
0 votes
0 answers
156 views

insert_text signal connect in Vala for Gtk.Entry

I'm learning Vala and trying to build the simple application where if user enter something in Gtk.Entry(), it'll going to be printed into terminal. This is the code that I wrote to create the Entry in ...
Kiran's user avatar
  • 448
1 vote
3 answers
328 views

How to round double / float in vala?

How can I round var x = 0.10000000000000001 to 0.10?
pether's user avatar
  • 11
0 votes
1 answer
102 views

Vala: Can't get enter_notify_event to work correctly

I'm not sure if I'm just misunderstanding something or what. I've been working on a podcast manager app, and one of the widgets is a EpisodeListItem, essentially it's intended to be a subclass of Gtk....
Christopher Leggett's user avatar
2 votes
2 answers
296 views

How can I make a TLS connection using Vala?

I'm trying to figure out how can I make a proper TLS connection using Gio. The Gio documentation says you can create a TLS connection just by setting the tls flag on the SocketClient. Below is a Gio ...
semicolon's user avatar
0 votes
2 answers
384 views

Wait for bool to change

The core of the issue is waiting for a condition without stopping that condition from happening. Just adding a while loop at the "Need to wait here for done to be true" comment stops ...
ChildishGiant's user avatar
2 votes
1 answer
60 views

Cannot create an array of SinkInputInfo

I cannot make an array of SinkInputInfo objects. I've posted this to the appropriate repo but got no response. Minimal reproduction: using PulseAudio; public void main () { SinkInputInfo[] ...
ChildishGiant's user avatar
1 vote
1 answer
305 views

Vala, string to enum

Is there a way to convert a string to an enum in vala: string foo = "Enum1"; MY_ENUM theEnum = MY_ENUM.get_value_by_name(foo); enum MY_ENUM { Enum1, Enum2, Enum3 } So in this ...
Thomas's user avatar
  • 38
1 vote
0 answers
23 views

How do I handle [Del] key as an action in a Vala application?

I have a Vala Gtk3 app in which exists a treeview widget displaying a tree of data on each tab of a notebook widget. To handle deleting the selected node from the "working" tree, there's a ...
Barry's user avatar
  • 61
1 vote
1 answer
247 views

WebsocketConnection using libsoup-2.4 is sometimes blocking GTK ui thread and prevents opening the main window

I have a simple GTK app written in Vala with a websocket connection (using libsoup-2.4). Problem: my app sometimes freezes at startup (each ~10th startups) and doesn't show the gui window at all ...
sergej.dobryak's user avatar
0 votes
0 answers
312 views

system theme won't apply to program

I'm training in Vala and everything was going ok until I applied a pkexec executable, now my system theme(dark) won't apply to the app Here's my code: public class Thinkfan : Gtk.Application { ...
Azure's user avatar
  • 1
0 votes
1 answer
213 views

How do I obtain the complete serialized text from a Gtk.Textview in Vala?

I have a Vala/Gtk3 app that incorporates a Textview widget as well as the following bit of code... Gtk.TextIter start_iter; Gtk.TextIter end_iter; var format = textview.buffer....
Barry's user avatar
  • 61
1 vote
1 answer
81 views

Vala doesn't free global data?

Have a simple code: class Global { ~Global() { stdout.printf("~Global"); } } class Local { ~Local() { stdout.printf("~Local"); } } Global global; static int main() { ...
НЕВСКИЙ БЛЯДИНА's user avatar
0 votes
2 answers
355 views

GTK4 Problem setting image from pixbuf with a GtkDropTarget

I am testing a gtk4 widget which is GtkDropTarget. I plan on setting an image which is dragged to the window as the image of the window itself. But errors come up as soon as I drag an image file. To ...
Owen David's user avatar
0 votes
2 answers
201 views

Update Gtk.Label dynamicall when time changes

I'm using this code to write the current time as a Gtk.Label in an app. public bool update_time () { var now = new GLib.DateTime.now_local (); var settings = new GLib.Settings ("...
Rajdeep Singha's user avatar
0 votes
1 answer
111 views

Listen to a background process in vala

I have a command I want to listen to in the background Process.spawn_command_line_async is what I want but I can't work out how to then listen to the response. The command will output lines when ...
ChildishGiant's user avatar
2 votes
1 answer
155 views

How to capture an int value in a closure?

I have an app with an arbitrary number of elements that all call a function that needs to take an argument, defined on creation. This is a simplified example but here I'd be hoping to make 3 buttons ...
ChildishGiant's user avatar
0 votes
1 answer
163 views

Check if a multi-dimensional array is empty (Vala)

If I have an array like string[,] empty = {{}}; and check its length I get an int[]. If I try to apps.length.length it seems to work until I compare or print it when I then get unsupported use of ...
ChildishGiant's user avatar
2 votes
0 answers
355 views

GTK3+ How to handle touchpad zoom gesture?

I want to get TOUCHPAD pinch zoom gesture from GTK. (I'm using Gnome 3.38 on Wayland, and gestures work well) GTK Version: 3.24.29 I have this Vala code but it doesn't work: using Gtk; using Gdk; ...
eminfedar's user avatar
  • 680
1 vote
1 answer
212 views

How to make placeholder text of a Gtk.SearchEntry visible even if the entry is focused?

The search entry appears when a menu button is clicked. But the problem is that, it gets automatically focused and as a result, the placeholder text is not visible. I want the placeholder text to be ...
Rajdeep Singha's user avatar
1 vote
0 answers
140 views

The namespace name `GL' could not be found while compiling Vala code with Ninja

context: Mid 2011 iMac, MacOS High Sierra 10.13.6, fish terminal So, i'm trying to build an application, and i've followed the checklist that the developper gave so far. All dependencies are met ...
FishyThinkPad's user avatar
4 votes
0 answers
98 views

How to add vala language into some existing c/c++ project?

Vala has c# like syntax and compiles to c code for performance, I would like to try it with some of my existing projects. But my existing projects are all c/c++ (mainly c++ with cmake build system) ...
user avatar
0 votes
1 answer
387 views

Vala Gtk css provider load_from_path

I don't know why load_from_path does not work during sudo ninja install. It returns: warning: unhandled error `GLib.Error' css_provider.load_from_path ("com.github.saidbakr.quick-...
SaidbakR's user avatar
  • 13.4k
0 votes
2 answers
118 views

How to add files to a list in vala?

I want to add files to a list and then access them in a for loop. This is how I try to do it: private get_app_list () { var file = new File.new_for_path (/usr/share/applications); List&...
Rajdeep Singha's user avatar
1 vote
1 answer
207 views

Styling Gtk.Label object

I have a vala app, that I want to style the label window object, I tried the following: public Object createConfirm(){ var window = new Gtk.Window (); var grid = new Gtk.Grid () { ...
SaidbakR's user avatar
  • 13.4k
0 votes
1 answer
49 views

Posix does not work in Flatpak package while it works in the ordinary compiled one

I have simple vala app, one of its functionalities ends with shutting down the computer using Posix.system("shutdown now"); In the ordinary ninja compiled version, the app works fine. ...
SaidbakR's user avatar
  • 13.4k
2 votes
1 answer
2k views

Gstreamer restart EOS element

I'd like to loop a file using GStreamer. Gst.Element playbin = Gst.ElementFactory.make ("uridecodebin", null); I do this by adding a probe to the playbin's src pad, and listen for EOS ...
Albert Tomanek's user avatar
0 votes
1 answer
147 views

How to access Gtk.Window in another class?

This is how the window is constructed: namespace App { public class Window : Gtk.ApplicationWindow { private Granite.ModeSwitch stick_switch; public Window (Gtk....
Rajdeep Singha's user avatar
0 votes
1 answer
40 views

event.key.keyval signal not connecting

public class Epoch.CitiesChooser : Gtk.MenuButton { private Epoch.CitiesSearch cities_search; construct { var button_grid = new Gtk.Grid (); button_grid.column_spacing = 6;...
Rajdeep Singha's user avatar
3 votes
2 answers
2k views

vala Package 'xxxx' not found

system information. ⭕ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS" ⭕ valac --version Vala 0.48.6 compile ...
eexpress's user avatar
  • 416

1
2
3 4 5
21