glib

c realloc struct - g_hash_table

I'm doing something similar to the following code. I have already gone through AddtoStructFunction() filling mystruct once. Now, what I would like to do is to append every new entry directly to the mystruct without having to free mystruct and iterate over again the whole g_hash_table containing the new key(s) to insert them into mystruct...

Prevent propagation of GSignal to further registered GCallbacks

How to prevent further signal handlers to be called from the first signal handler callback in GSignal? For example, i register three functions - func1, func2 and func3 for the same signal "mysignal". If func1 is called first, how can i prevent func2 and func3 to be called from func1? This should not be made permanent. It should be runt...

Why doesn't GLib's GValue system include string to number transformations?

The GValue system in GLib includes standard type transformations using GType descriptors (in fact the GValue reference page includes some sample code that transforms a value from int to string). However, as one can also see from the gvaluetransform source code, transformations from string to numeric values are not included by default. I...

C - Glib GINT_TO_POINTER portability

I'm dealing with large numbers coming from the hash table. I'm wondering what would be a good way of adding them to a constant (100) taking into account portability. Glib's documentation highlights that using GINT_TO_POINTER is not portable in any way. Any ideas would be appreciated! gpointer v, old_key; gint value; // ? if(g_hash_tab...

D-Bus GLib bindings—unable to get code off the ground

I've been playing with GLib's D-Bus bindings, trying to get something (anything) working, with very limited success. I've been trying to get Ross Burton's example code to compile and run, but keep hitting new and exciting difficulties. Can you help debug this code, or failing that, point me at some example of D-Bus GLib code that does w...

Please, help to find source with examples by glib

Hi everybody! I've looked for a lot of sites but didn't find any examples by glib. I've seen only discription types and functions... Perhaps do you know a good source? PS. Thanks for your answers! =) ...

Why does GLib abort under recursed logs?

Hi, Most of time my GLib program runs well. However, when logs like ** (process:pid): Message (recursed): blah lah blah appear, the program will abort. GLib manual says G_LOG_FLAG_RECURSION is considered fatal by default. But I just can't understand what does "recursive messages" mean? When will recursed message occur? Thanks ...

Acquiring thread id (tid) in glib

I am using glib for creating threads: g_thread_create() How can I acquire thread id (number)? ...

How to attach X11 app to Dbus.

Hello, How to make X11 application to listen to DBus signal. That to listen to Dbus signal gmainloop should be launched, and for X11 app XEvent loop. So is there an elegant way to do this ? Or do I have to run gmainloop in another thread. Regards, Levon ...

GLib - main event loop in C++

Hello, I need to implement my own main event loop in C++ which will be based on GLib library. I don't know where to begin. I studied some materials about GLib, but it doesn't help me to know, how implement event loop. Could somebody give me some advise about it or give me some source code? I basically need to implement GSource and GSourc...

possible to retrieve time left on a glib 'event?'

I am creating an event with g_timeout_add or g_timeout_add_seconds which returns an event id; I can cancel the event by calling g_source_remove. However, at some point what I would like to do is see how much time is remaining until the event is fired. Is there a simple way to do this with the glib api, or do I need to manually store an...

glib memory allocation VS std *alloc and free

I tend to use std *alloc/free functions to allocate/free dynamic memory in my C programs. I wonder if there are any good reasons to use the GLIB Memory Allocation functions instead of the std ones. I'd be grateful if the comunity could point out situations where either of these solutions is a winner/looser. I am also interested in perf...

embedding python ImportError: libpyglib PyExc_ImportError linking

I am running 64 bit ubuntu 10.10 in case there are know issues with this setup, basically i am embedding python inside a c application i managed to get this to work i can call functions from the original c program and the scripts run until i import gtk in the python script this causes the error below. I am using the waf build system to ...

g_mount_get volume() returns always NULL

Hello! I have a problem when calling g_mount_get_volume() on an embedded platform running a Fedora-based fs. Called inside Tracker (libtracker-miner/tracker-storage.c) it returns always NULL. Any suggestions of what happens? Regards, George! ...