Questions tagged [glib]

GLib is a general-purpose and cross-platform utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on.

GLib is a general-purpose and cross-platform utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on.

For many applications, C with GLib and GObject is an alternative to C++ with STL. It works on many UNIX-like platforms, Windows, OS/2 and BeOS. GLib is released under the GNU Library General Public License (GNU LGPL).

The GLib reference manual can be found at the GNOME developer site.

1529 questions
9
votes
1 answer

glib.GError: Error interpreting JPEG image file (Unsupported marker type 0x05)

I am using gtk.gdk.PixbufLoader since several years. Today, I try to load a jpg file from a new android device and get this exception: Traceback (most recent call last): File "myscript.py", line 118, in next loader.write(buf) glib.GError:…
guettli
  • 25,042
  • 81
  • 346
  • 663
9
votes
8 answers

compile glib 2.48 does not recognize pcre with utf support

I have compiled pcre 8.38 from source with --enable-utf8 --enable-unicode-properties and a pcretest -C utf retuns 1. a which pcretest returns /home/mybin/bin/pcretest However when compiling glib 2.48 using PCRE_LIBS="/home/mybin/lib"…
art vanderlay
  • 2,341
  • 4
  • 35
  • 64
9
votes
1 answer

How can I find the length of a given GArray?

I have a GArray of GValue (all non-zero) which has been allocated at runtime with g_array_append_val. I wonder how can I find out what's the index of the last element, or more precisely how many elements does the array hold. Code like for…
Reimundo Heluani
  • 918
  • 9
  • 18
9
votes
5 answers

What non-GUI programs use glib?

What non-GUI programs (daemons) use glib?
Marko Kevac
  • 2,902
  • 30
  • 47
9
votes
4 answers

printing utf8 in glib

Why utf8 symbols cannot be printed via glib functions? Source code: #include "glib.h" #include int main() { g_print("марко\n"); fprintf(stdout, "марко\n"); } Build it like this: gcc main.c -o main $(pkg-config glib-2.0 --cflags…
Marko Kevac
  • 2,902
  • 30
  • 47
9
votes
1 answer

detect/remove unpaired surrogate character in Python 2 + GTK

In Python 2.7 I can successfully convert the Unicode string "abc\udc34xyz" to UTF-8 (result is "abc\xed\xb0\xb4xyz"). But when I pass the UTF-8 string to eg. pango_parse_markup() or g_convert_with_fallback(), I get errors like "Invalid byte sequence…
oliver
  • 6,204
  • 9
  • 46
  • 50
9
votes
3 answers

Is glib usable in an unobtrusive way?

I was looking for a good general-purpose library for C on top of the standard C library, and have seen several suggestions to use glib. How 'obtrusive' is it in your code? To explain what I mean by obtrusiveness, the first thing I noticed in the…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
9
votes
3 answers

How can I remove the warning in GCC 4.6: "missing initializer [-Wmissing-field-initializers]"?

The code GValue value = { 0 }; gives the following warning: missing initializer [-Wmissing-field-initializers] I know that's a GCC bug, but is there some trick to remove it? It is really not nice see such unreal warnings. But I don't want power…
Jack
  • 16,276
  • 55
  • 159
  • 284
8
votes
2 answers

How can I fix this error? Gtk-WARNING **: GModule ... initialization check failed: GLib version too old (micro mismatch)

I'm writing a python program with matplotlib, and I'm getting this error: GLib-GIO-Message: Using the 'memory' GSettings backend. Your settings will not be saved or shared with other applications. (python:6304): Gtk-WARNING **: GModule…
James
  • 81
  • 1
  • 3
8
votes
1 answer

Error Importing Glib

When trying to import glib in python 3 using from gi.repository import glib, I get an error saying: Traceback (most recent call last): File "", line 2135, in _find_spec AttributeError: 'DynamicImporter' object has no…
Kookerus
  • 506
  • 2
  • 7
  • 18
8
votes
1 answer

add callback for separate g_main_loop

I have some misunderstanding about how GMainLoop work. Main thing - API which add some callbacks into g_main_loop (like g_timeout_add_seconds()) don't take pointer to which loop you want to add that callback. It looks like you add callback's for…
Stepan Loginov
  • 1,667
  • 4
  • 22
  • 49
8
votes
5 answers

How to walk a directory in 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…
mlibby
  • 6,567
  • 1
  • 32
  • 41
8
votes
3 answers

Updated Bluez DBUS-API document?

I just tried to run a vala bluez example (found in the DbusClientSamples page) and I got this error: GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: Method "DiscoverDevices" with signature "" on interface "org.bluez.Adapter" doesn't exist Is…
knocte
  • 16,941
  • 11
  • 79
  • 125
8
votes
3 answers

What is the correct way of casting const char* to char* without changing the API and not getting a warning

In my plain C99 project, I have an external C library that defines an interface (via GObject interfaces) that I need to implement: void interface_function (const char *address, [...]); Now, within the implementation (that I need to write) I need to…
Dynalon
  • 6,577
  • 10
  • 54
  • 84
8
votes
1 answer

How to print a guint64 value when using glib?

Problem I am making use of the GLib 2.0 library, and declared a gunit64 variable. I wish to print its value to screen, but its not working properly. Code Consider the following code snippet as an example. I declare a guint64 variable, and try to…
Goaler444
  • 2,591
  • 6
  • 35
  • 53