home.social

#glib — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #glib, aggregated by home.social.

fetched live
  1. Heads up: folks using #lgi with #glib might run into this issue. #Lua #Linux

    lgi crashes with error "bad argument #1 to 'fromarray' (lgi.record expected, got table)"

    This is the fix:

    ffi: Adapt load_enum to glib 2.87 changes


    --- lgi/ffi.lua.orig	2026-07-08 08:32:43.919979810 -0700
    +++ lgi/ffi.lua	2026-07-08 08:48:20.173243433 -0700
    @@ -76,16 +76,22 @@
     
     -- Creates new enum/flags table with all values from specified gtype.
     function ffi.load_enum(gtype, name)
    -   local GObject = core.repo.GObject
    +   local GLib, GObject = core.repo.GLib, core.repo.GObject
        local is_flags = GObject.Type.is_a(gtype, GObject.Type.FLAGS)
        local enum_component = component.create(
           gtype, is_flags and enum.bitflags_mt or enum.enum_mt, name)
        local type_class = GObject.TypeClass.ref(gtype)
        local enum_class = core.record.cast(
           type_class, is_flags and GObject.FlagsClass or GObject.EnumClass)
    -   for i = 0, enum_class.n_values - 1 do
    -      local val = core.record.fromarray(enum_class.values, i)
    -      enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
    +   if GLib.check_version(2, 87, 0) then
    +      for i = 0, enum_class.n_values - 1 do
    +         local val = core.record.fromarray(enum_class.values, i)
    +         enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
    +      end
    +   else
    +      for _, val in ipairs(enum_class.values) do
    +         enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
    +      end
        end
        type_class:unref()
        return enum_component
  2. Replacing the WebSocket with a unix socket, then using blocking Json-rpc instead of Vite's tangle of promise chains resolved the issue. If any #gnome / #gjs / #glib people know exactly what was going wrong I'd be delighted to hear!

  3. My adventures of writing GTK programs in Rust took a turn this this time.
    gitlab.com/guystreeter/rgdbus-
    is a server and client example of using glib's D-Bus interface in Rust. I discovered a few things that haven't been implemented, but was generally successful.

  4. Looks like it's a problem with the XDG Template directory being set to the home directory, and it now just recurses and recurses and recurses and gets FAR too busy.

    bugs.debian.org/cgi-bin/bugrep

    Specifically, it's about `$HOME/` not being recognised as the home directory because of the trailing slash.

    gitlab.gnome.org/GNOME/glib/-/

    So either edit your config as per the Debian comment, or wait for your distro to release the fix.

    #Gnome #Nautilus #GLib

  5. #DailyBird 🤖
    Glossy Ibis (Plegadis falcinellus), 8th May 2024
    es: Morito Común, fr: Ibis Falcinelle
    Cape Henlopen State Park, The Glade, Delaware
    Lenapehoking (Lenni-Lenape) & Pocomoke-Assateague traditional territory
    Canon EOS R5, Canon RF 200-800mm f/6.3-9 + 1.4x teleconverter @ 1120mm, 20% crop, 1/400s, f/14, ISO 1250
    #Birds #GlossyIbis #GLIB #BirdOfTheDay #HopeIsTheThingWithFeathers #DescribeYourImages

  6. First a bit of context for the GLib project, which is comprised of three main parts: GLib, GObject and GIO. #GLib contains things you'd generally get from a standard library, #GObject defines the OOP semantics (methods/properties/signals, inheritance, etc), and #GIO provides reasonably high-level APIs for everything from sockets and files to D-Bus and Gio.DesktopAppInfo.

    andyholmes.ca/posts/best-inten

  7. iunno why, but programming with #glib / #gobject just feels a lot more fun than wrestling with c++

    which is kinda weird, you'd think that a language specifically built for OOP would be better at it than trying to replicate it with a C library

  8. Well that's something new. Must be a circular dependency between glib-2.82.4,2 and gobject-introspection@bootstrap, but I'm not entirely sure which port to file a bug against; I suspect gobject-introspection.

    #FreeBSD #glib #portmaster

  9. okay, i think i don't entirely understand when i should claim a reference using g_object_ref and when i shouldn't #GLib #GObject

    question 1: should a function that returns a pointer to an object g_object_ref it for the caller's sake?

  10. I have not blogged or talked about the follow-up work to my "GType Next" blog post that I've been doing in my spare time, mainly because it is happening *in my spare time*, and I don't want to give false impressions to people; the other reason is that the time consuming bit is not writing a bunch of code, but it's planning ahead, because the goal is to avoid breaking stuff at all costs…

    #glib #gobject #gtk

  11. Ciekawostka: jeżeli różne programy sypią się z błędami typu:

    (…): GLib-GIO-ERROR **: 20:46:27.286: Settings schema '…' does not contain a key named '…'

    a macie pewność, że schematy skompilowane, i definitywnie zawierają taki klucz, to może okazać się, że z jakiegoś powodu w waszym katalogu domowym siedzi dodatkowy plik ze skompilowanymi schematami, i jest używany zamiast systemowego.

    Czyli:

    rm ~/.local/share/glib-2.0/schemas/gschemas.compiled

    #Gentoo #GNOME #glib

  12. Fun fact: if random applications are crashing with errors like:

    (…): GLib-GIO-ERROR **: 20:46:27.286: Settings schema '…' does not contain a key named '…'

    and you've already verified that you've compiled the schemas, and that the schema contains the listed key, then it may mean that for some reason you have another compiled schema file in your home directory, and it's taking precedence.

    In other words:

    rm ~/.local/share/glib-2.0/schemas/gschemas.compiled

    #Gentoo #GNOME #glib

  13. Play FlappyBird, but written in #vala !
    gitlab.com/nda-cunh/flappyvala
    Using only #SFML and #glib as dependencies.
    The code is object oriented and a very good example for a non-gtk Vala app. Check it out!

    #gamedev #gaming #FlappyBird #OOP

  14. CW: old cat yells about packaging and cross-compiling

    Feels like I got into shaving a whole herd of yaks when I just wanted to access NetworkManager over D-Bus from Python on a certain embedded system. ​:neocat_laugh_sweat:​

    * The only non-deprecated, non-systemd way to do that (short of handwriting a client library) seems to be python-gobject and introspection.
    * The
    #Buildroot packages for python-gobject and gobject introspection are marked as glibc-only, but I'm using musl. And I know they work on Alpine just fine.
    * The GLib, gobject-introspection, and python-object versions in Buildroot are very old. And Alpine actually dropped a musl-compatibility patch with the most recent gobject-introspection version. So… update time.
    * The
    #GLib build process changed and now requires a bootstrap step to support introspection.
    * Turns out… Bootstrap or not, introspection isn't supported when cross-compiling.
    ​:neocat_scream_stare:​

    We'll see where it goes from here, the gobject-introspection package in Buildroot does some wild things with Qemu to work around a similar limitation. And there are some somewhat recent changes related to cross-compiling upstream.
    ​:neocat_think:​

  15. @eniko C is a very incomplete language. The C std lib is nothing compred to a "proper" one from modern languages like C++ or rust. That is why for example #glib exists, an additional library to provide more functions and utilities, also for working with strings. (It is used heavily in the #GNOME desktop environment)

  16. any #GLib coders out there? i would like to know what's the best way to keep track of async operations, like mounting/unmounting drives, copying files, etc.

    i'm using #vala, but i'm pretty sure any C advice would also apply with slight changes

  17. Important security update for GLib and D-Bus, thanks to @pwithnall

    discourse.gnome.org/t/security

    If you are a downstream distributor of GLib, GTK, or GNOME-related projects, remember to follow the distributor tag on Discourse.

    #glib #security

  18. When I was dealing with gtk-rs, I thought was a mess in .

    Now I know it's not just Rust. It's also a pain in C. Sigh.

  19. Does anyone happen to know why GUnixInputStream doesn't implement GSeekable? #glib