I've got a problem with using the io_add_watch monitor in python (via gobject). I want to do a nonblocking read of the whole buffer after every notification. Here's the code (shortened a bit):
class SomeApp(object):
def __init__(self):
# some other init that does a lot of stderr debug writes
fl = fcntl.fcntl(0, fcntl.F_G...
I am using GLib's doubly linked list structure, GList. I would like to know if there is any standard macro for iterating over a GList. I couldn't find any such thing in the GLib documentation. As a result I have made my own macro, but I'd rather use something standard if it exists.
To Illustrate the the issue: Usually I write a lot of c...
I have a string that I want to convert to an int. I am aware that there are other methods for doing this such as atoi; however, I'd really like to use a glib function if one exists. Does such a function exist?
Thanks!
...
The following code does not work correctly on Windows (but does on Linux):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setblocking(True)
sock.connect(address)
gobject.io_add_watch(
sock.fileno(),
gobject.IO_OUT | gobject.IO_ERR | gobject.IO_HUP,
callback)
Snippets o...
I have a config file in which I have keys and values, like this:
key1=value1
key2=value2
key3=value3
So is there any utility functions in Gtk/Glib that can read this file and retrieve the value corresponds to key?
...
What is the reasoning behind types to be redefined in glib? Why do they turn char into gchar, int into gint etc. ?
...
It looks like g_strncasecmp is deprecated, so I am looking for another function to do the same thing.
...
I am new to GTK+ programming. I came across an API called g_main_loop(). I have used it in my code but I am still unaware that how exactly it works. Can somebody explain g_main_loop() with small code snippet?
...
typedef struct {
char name[10];
} A;
A * inst = get_instance_of_A();
char *str = g_strdup ( inst->name );
The last line doesn't compile. I also tried &(inst->name) with no luck.
The error I get is:
Error: char is not a structure type.
I understand that char[] and char * are different types altogether. But shouldn't g_strdup be able ...
When using glib to dispatch signals through emit, are all the "listeners"/handlers called back-to-back or is control relinquished to the event loop after each listener/handler?
...
I can't seem to compile this basic program using glib.h...
#include glib.h
#include stdio.h
int main ()
{
return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ;
return 0;
}
glib.h is located in /usr/local/include/glib-2.0
So I compiled with
$ gcc -v -c -mcpu=v9 -I/usr/local/include/glib-2.0 testme2.c ...
I am using glib in my application, and I see there are convenience wrappers in glib for C's remove, unlink and rmdir. But these only work on a single file or directory at a time.
As far as I can see, neither the C standard nor glib include any sort of recursive directory walk functionality. Nor do I see any specific way to delete an ent...
I have been looking through the source of GLib and GObject and writing programs to use certain features of each. But now I'd like to debug though something in the GLib source code without installing anything on my system.
I have a built version of the source code somewhere and I'd like to use those .so files rather than the system inst...
Hi,
I would like to develop an iPhone App based on an existing open-source Objective-C framework, however that framework makes extensive use of the glib library and I cannot find a way to build and include the glib library for an iPhone app (non jailbreak).
Is there any way this can be done, or is there any recommended approach to port...
Let's say I get a glib gpointer to a glib gslist and would like to iterate over the latter, how would I do it?
I don't even know how to get to the gslist with the gpointer for starters!
Update: I found a workaround - the python bindings in this instance wasn't complete so I had to find another solution.
...
what are differences in the strength and features in gnulib glib and glibc
Thanks!
...
Hello,
While programming in C and GTK+, Why is it "better" to use g_strdup_printf, g_free, g_strcmp0 etc... and fellow glib functions?
Merci!
...
I have a psychological tic which makes me reluctant to use large libraries (like GLib or Boost) in lower-level languages like C and C++. In my mind, I think:
Well, this library has thousands of
man hours put into it, and it's been
created by people who know a lot more
about the language than I ever will.
Their authors and fan...
Is there a way to schedule the execution of a callable until the glib main loop is entered?
Alternatively, is there a signal I can subscribe to that will indicate that the main loop is entered?
...
I'm using GLib Hash Table. I'm trying to get the current value of the key that I found and then increment its value. I'm not quite sure how can I replace the existing value.
typedef struct {
gchar *key;
guint my_int;
} my_struct;
char *v;
v = g_hash_table_lookup(table, my_struct.key);
if (v == NULL)
g_hash_table_insert(tab...