glib

tkinter integration with glib mainloop

Is it possible to integrate tkinter with glib mainloop ? ...

Find the position of a string in an array of string with the GLib

Hello, I have an array of string, like: char **strings = {"str1", "str2"}; And i would like to know if there is a function in the glib to find the position of a string in this array. I guess i could just do g_strcmp0 in a for() loop, but there may be a better way to do it. Thanks ...

Problem with GFile

I have a: GFile* gf = g_file_new_for_path(file_path); in my code. But when i try to compile it, I see error: Undefined reference to: 'g_file_new_for_path' In include section I have #include <gio/gio.h> What's wrong in this code? ...

can't increment Glib::ustring::iterator (getting "invalid lvalue in increment" compiler error)

in the following code: int utf8len(char* s, int len) { Glib::ustring::iterator p( string::iterator(s) ); Glib::ustring::iterator e ( string::iterator(s+len) ); int i=0; for (; p != e; p++) // ERROR HERE! i++; return i; } I get the compiler error on the for line, which is sometimes "invalid lvalue in increment", and sometimes...

Variable timeouts in GLib

I need to modify a GLib's time-out interval while it is in execution. Is that possible? I took a look to the source code and it seems possible to me, but is required use some non-public functions from GLib internals. Should I reimplement GTimeoutSource or there are a way to do it? ...

Memory leak / GLib issue.

1: /* 2: * File: xyn-playlist.c 3: * Author: Andrei Ciobanu 4: * 5: * Created on June 4, 2010, 12:47 PM 6: */ 7:   8: #include <dirent.h> 9: #include <glib.h> 10: #include <stdio.h> 11: #include <stdlib.h> 12: #include <sys/stat.h> 13: #include <unistd.h> 14:   15: /** 16: ...

C++ UTF-8 lightweight & permissive code?

Anyone know of a more permissive license (MIT / public domain) version of this: http://library.gnome.org/devel/glibmm/unstable/classGlib_1_1ustring.html ('drop-in' replacement for std::string thats UTF-8 aware) Lightweight, does everything I need and even more (doubt I'll use the UTF-XX conversions even) I really don't want to be car...

How do I get the executing program's directory in C using a plataform independent method?

I develop my app in linux for both unix and win32(cross compile at each build) plataforms, so a ready to use function would be nice :). I'm using glib that has the 'gchar* g_get_current_dir(void)' function and it returns the current directory, but what I really need is the executable's dir. I'm inexperienced in C programming so any suge...

Monitoring UDP socket in glib(mm) eats up CPU time

Hi, I have a GTKmm Windows application (built with MinGW) that receives UDP packets (no sending). The socket is native winsock and I use glibmm IOChannel to connect it to the application main loop. The socket is read with recvfrom. My problem is: this setup eats 25% percent CPU time on a 3GHz workstation. Can somebody tell me why? The...

printing utf8 in glib

Hi. Why utf8 symbols cannot be printed via glib functions? Source code: #include "glib.h" #include <stdio.h> int main() { g_print("марко\n"); fprintf(stdout, "марко\n"); } Build it like this: gcc main.c -o main $(pkg-config glib-2.0 --cflags --libs) You could see that glib can't print utf8 and fprintf can: [marko@marko-...

Manual of glib and multithreading

Is anywhere book or good manual, but better book about GTK+/glib, and multithreading in C/GTK+? I need to run a function in another thread than main window, and make it cancellable. ...

Is it possible to use glib event loops for IPC?

Hello Is it possible to use glib event loops and glib io channels for IPC in one parent - many child process model? Parent and children must be able to send each other 'commands'. Can you point me to some tutorials or examples? ...

What non-GUI programs use glib?

What non-GUI programs (daemons) use glib? ...

Glib: Can I reuse a pointer queued to be freed with g_test_queue_free?

Using Glib Testing framework, I would like to know if I can reuse a pointer queued to be freed with g_test_queue_free? Here's a code sample of what I'm trying to do: static void some_test() { gchar* tmp; tmp = func_returning_gchar_ptr (...params...); g_assert(tmp); g_test_queue_free(tmp); tmp = func_returning_gchar_ptr (......

including different versions of glib headers

If there are two source files a.c and b.c: a.c includes the glib.h of glib-2.6.6 and b.c includes glib.h of glib-2.12 Then I compile them and link them together and generate target program. Assume that a.c is not using any new feature introduced in after v2.6, will including different version of headers cause any problem? If so, ...

Analog of Glib quarks on Mac OS.

Maybe you know any analogs of g_quark_from_string() and g_quark_to_string() in CoreFoundation or other frameworks? ...

Error building GLib

Im trying to build GLib-2.4.0 using the makefile. I get this error: gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthreads -g -O2 -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c -fno-common -DPIC -o .libs/gatomic.o /var/tmp//cctTs...

Japanese half/full width conversion

Hi all, I'm facing a character width problem in Japanese using glib::ustring. I have this string: ウェッジパンプス I want to convert it to: ウエッシパンプス Using ustring::normalize, i get this string: ウェッジパンプス (in fact, here, each character with accent fills two characters width) Is there a standard method to do this kind of processing? Is ICU b...

What has to be Glib::init()'ed in order to use Glib::wrap?

So I'm trying to make use of a GtkSourceView in C++ using GtkSourceViewmm, whose documentation and level of support give me the impression that it hasn't been very carefully looked at in a long time. But I'm always an optimist :) I'm trying to add a SourceView using some code similar to the following: Glib::RefPtr<gtksourceview::Sourc...

Can I use glib to make some portable http GET request and how ?

Hi there, Was just wondering if any of you already coded a http get request using glib? Is it possible and how ? I just want to call an simple urls with parameters, and the code must be working on gnu/linux, windows and mac. If it is not possible with glib, have you any suggestion about what to use for that purpose (in a portable pers...