1,601 questions
2
votes
2
answers
75
views
Can you construct a NULL-terminated GPtrArray that doesn't have an element_free_func?
I'm writing some C code where I want to have a NULL-terminated GPtrArray containing static strings. Typically, I would use g_ptr_array_new_null_terminated () to construct a NULL-terminated GPtrArray, ...
3
votes
0
answers
56
views
in windows/C# how to open pipe and get an IOChannel from them?
I'd like to build a fake Gimp host in C# to query/run windows gimp plug-in.
For reference, at the end of this message, you'll find what I understood of the protocol to talk to a Gimp plug-in.
To do ...
2
votes
3
answers
270
views
Is glib part of the implementation said in the C standard?
Is glib part of the implementation said in the C standard? Why?
I find glib has this:
static inline GList *_g_list_remove_link (GList *list,GList *link){...}
If glib is not part of the implementation,...
1
vote
2
answers
110
views
How do I assert that two pointers are equal with GLib's testing framework?
I'm writing a unit test with GLib's testing framework where I want to check if two pointers point to the same place in memory. I do NOT want to compare the actual memory which they point to, so ...
0
votes
1
answer
56
views
GDB not detecting GLib auto-load python scripts
Following this article, GDB is installed in the same prefix as glib (I'm using official distro packages. However, when I run info auto-load python-scripts, I get No auto-load scripts. I have enable ...
0
votes
1
answer
38
views
Gtkmm: Drag-n-Drop DropTarget with Bytes Type
I am trying to implement drag-n-drop with Gtkmm4. Inside DragSource's prepare signal callback I return a ContentProvider:
// ...
char* buffer;
gsize length;
file->load_contents(buffer, length);
...
0
votes
0
answers
47
views
No call to "_finalize" function in GtkTreeListModel
I create an test_object which contains a function _finalize.
G_DECLARE_FINAL_TYPE(TestObject, test_object, TEST, OBJECT, GObject)
....
void test_object_finalize(GObject* object)
{
GObjectClass *...
0
votes
2
answers
90
views
How do I use g_assert_cmpfloat () to check if two floats are equal without generating a safety warning?
I'm writing some testcases for a program using the GLib testing facilities. I want to assert that two floats have the same value, and g_assert_cmpfloat () seemed like an appropriate function for that. ...
0
votes
1
answer
41
views
g_slist_last does not retrieve last record in list
After adding 10 structures to a GSList, using g_slist_last to retrieve the last structure does not produce the same result as using g_slist_foreach to view the last structure.
Code sample:
#include &...
1
vote
1
answer
80
views
How do I define a derivable type that also implements an interface and has a private struct in GObject C?
I'm writing some GObject code, and so far all my types have implemented an interface but been final types. Now I'm trying to make a new type that implements the same interface but also is a derivable ...
4
votes
5
answers
1k
views
Upgrade glib to 2.82.5 through homebrew failed, python dependency not found
I want to upgrade glib to 2.82.5 through homebrew on mac running sequoia, but it failed with this python dependency not found error
==> Upgrading glib
2.82.4 -> 2.82.5
==> Patching
==> ...
0
votes
1
answer
73
views
Different Julian dates in SQLite and GLib, which is correct?
I get different Julian dates for the same Gregorian date depending on the API. For the Gregorian date 2025-02-05:
According to longpela, the Julian date is 25036.
According to GLib, the Julian date ...
1
vote
2
answers
85
views
How can I get the first key that matches a given value in a GHashTable in C?
I'm writing some C code using GLib and using GHashTable to store some data. However, sometimes I need to do a "reverse lookup" where I need to find the first key that matches a given value. ...
1
vote
1
answer
52
views
GLib: Detecting output from a Python script
Objective: Spawn a Python script from C/GLib, and detect when Python outputs a string.
The following Python script slow_output.py repeatedly prints a string to STDOUT.
import time
for x in range(10):
...
1
vote
0
answers
64
views
How can I make GHashTable work with 64-bit hash?
I approached a problem when I tried to use XXH3_64bit from <xxhash.h> module over the wrapper with __fastcall for GHashTable initialization, but the type definition for GHashFunc requires the ...
1
vote
0
answers
81
views
Why array fails on assertion using g_array_append_vals?
Trying to create a function to check available Vulkan extensions, however my executable runs and closes within a second with an error in terminal that I've barely managed to copy. It's a CMake project....
3
votes
2
answers
386
views
Is there any reason to use g_strdup from GLib over strdup from the C standard library?
I've been working on an application written in C that uses GLib and exclusively targets Linux. Generally my experience has been that GLib's utilities are useful and generally make writing C easier ...
0
votes
1
answer
101
views
How do I convert a GList into a GListModel in C?
I'm working on a GTK program written in C. In a specific function, adw_combo_row_set_model (), I need to provide a GListModel. I have a GList. How can I either convert the GList into a GListModel or ...
0
votes
1
answer
190
views
How can I load Gio Resources in Gtk4?
I am trying to load a theme from a resource file
style.css
The following is a basic style that I need to apply
window {
background-color: orchid;
}
main.c
I then write a basic gtk application and ...
1
vote
1
answer
750
views
Why does nix-shell with glib not provide proper .h files?
I am trying to use nixOS to build a gtk4 application that requires glib. When running a nix-shell with the following shell.nix:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
...
1
vote
1
answer
92
views
Using GCancellable with the GtkAlertDialog
For testing purposes, I wrote a small program calling a GtkAlertDialog and showing the results of the user selection.
I noticed the topic of GCancellable.
Despite studying the documentation, I did not ...
1
vote
2
answers
1k
views
The system library `gobject-2.0` required by crate `glib-sys` was not found
When trying to use GTK4 with Rust compiling and running the Hello World example of the GUI development with Rust and GTK 4 fails with the following error:
$ PKG_CONFIG_PATH="/opt/homebrew/lib/...
0
votes
1
answer
352
views
VSCode can't open source file "glibconfig.h" (dependency of glib.c) ---Windows
My glib.h file is located inside of this folder: "C:\msys64\mingw64\include\glib-2.0"
This is my settings.json file:
{
"explorer.confirmDelete": false,
"includePath": ...
2
votes
2
answers
128
views
How to decrease the width of a GtkEntry in Gtk3.0?
I have a GTK program with 2 GtkButtons and one GtkEntry. I would like to dynamically resize the width of the entry by clicking a button to increase/decrease it. The program I have so far is able to ...
0
votes
1
answer
44
views
Integrating libpulse's pa_threaded_mainloop in a Qt application (hacking pavucontrol-qt)
I'm trying to get pavucontrol-qt (pvcq) to work properly on Mac (yes, PulseAudio works there).
The hurdle here is that the Qt/Mac event dispatcher is not based on GLib, so qvcq's current ...