• 3 Posts
  • 170 Comments
Joined 4 months ago
cake
Cake day: March 22nd, 2025

help-circle



  • Of course linting and formatting is not part of the language. Of course you can install extensions in some IDE that will handle it. Conan looks great but I never saw a project using it and when I was asking C devs about dependency management no one mentioned it. I checked dozens of GTK projects looking for some decent template to copy and didn’t find anything remotely “modern”. All projects I see simply use meson/ninja, install deps on system level, don’t provide any code formatting or linting guidelines. Most don’t bother with any modules and just dump all source code into 100 files in src. And I’m talking about actively developed tools for Gnome, not some long forgotten ones. For me the big difference between languages like C and Rust is that every Rust project uses the same formatting, linting tools, uses modules and proper dependency management while most C projects don’t. Because it’s old. Because a lot of C devs learned programming when it wasn’t a thing. Because a lot of C project started when those tools didn’t exist. You can probably start a new C project in ‘modern’ way but when I was trying to do it there were no examples, no documentation and when I asked C devs I was told that “you just do it like always”. In modern languages the default way is the “modern” way.

    This is how you declare a new component in gtk-rs:

    glib::wrapper! {
        pub struct MainMenu(ObjectSubclass<imp::MainMenu>)
            @extends gtk::PopoverMenu, gtk::Popover, gtk::Window, gtk::Widget,
            @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::ShortcutManager;
    }
    
    impl MainMenu {
        pub fn new() -> Self {
            Object::new(&[]).expect("Failed to create `MainMenu`.")
        }
    }
    
    
    #[glib::object_subclass]
    impl ObjectSubclass for MainMenu {
        const NAME: &'static str = "MainMenu";
        type Type = super::MainMenu;
        type ParentType = gtk::PopoverMenu;
    
        fn class_init(klass: &mut Self::Class) {
            klass.bind_template();
        }
    
        fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
            obj.init_template();
        }
    }
    

    This is how you declare a new component in Leptos:

    #[component]
    fn App() -> impl IntoView {
    
        view! {
       <div>test</div>
        }
    }
    

    That’s what I mean by “it’s not ergonomic”.


  • Interesting, I didn’t realize Vala was designed specifically to help with GTK. It could be a skill issue but I found the entire ecosystem really hard to understand. It’s like all documentation is written assuming you already know half of it. “Vala uses the GObject system”. Yeah but I’m just deciding which language to use to learn GTK, I don’t know what GObject is… Now that I understand it all better I would probably just use Vala and stick to GTK. Instead I switched to Tauri+Leptos+Thaw and it was a joy in comparison. Documentation was clear and I was just able to link my app to local framework code and debug whatever part I wanted. I was able to fix bugs in Tauri in first weeks of learning and I contributed quite a lot along the way.






  • By “C is so old” I mean it lacks a lot of features modern languages have. Proper linting, code formatting, dependency management, version management, virtual environments, modules. Yes, you can solve some of it with docker but it’s terrible compared with Rust for example.

    By “it doesn’t translate well to Rust” I mean that GObject doesn’t translate well to Rust structs so you end up with weird structures split into multiple modules and terrible code overhead. Compared with modern UI frameworks it’s just not ergonomic to work with.

    Yes, I know GTK supports multiple platforms but if I want to develop for desktop and mobile I had way better experience using Tauri+Leptos. It’s not just about having some bindings and some docs for it. It’s about how much effort does it take to set it up and figure out how to implement specific functionality. Good docs, good tools good compiler and readable code for the framework help a lot.




  • Yeah, because shooting at police detailing people is legal…

    Look, I 100% agree police is in the wrong here but the way the legal system is set up you can argue that in court. They detain you, put you in front of a judge and if you can demonstrate that your detention wasn’t legal you will be freed. The law in no way allows you to shoot cops because you think they don’t have the right to do something. Telling people to shoot cops is advocating for breaking the law, pure and simple. It’s not for me to tell if US is at the stage when civil was is the only way out and you shoot just start killing each other but don’t pretend it would somehow be legal.




  • I tried using GTK with C, JavaScript and Rust and the experience was always terrible. The tools, the documentation… C is just sooooo old and GTK doesn’t translate well to Rust. For me GTK is great for Window Manger level tools that need to be small, super fast and are fairly static (you don’t add new features do settings app or clock widget that often). I definitely wouldn’t do cross platform apps in it.