Working on a Gtk3 demo application

See GitHub - gummybears/shadertoy for details, WIP.

At the moment I am working on loading text files into a Gtk::TextView and to compile shader code to display either into a separate window (OpenGL) or a Gtk::Window.


When you get far enough, please include a screenshot in the


Now I am trying to enable/disable a menu item (Gio::SimpleAction) by setting enabled is false
when the text view is empty but must be doing something wrong. I think I have to “deactivate” the signal for the specific action.

Perhaps you know the answer?

 def setup_menu_actions(builder : Gtk::Builder, window)

    # .... code truncated ....

    action ="new_file", nil)
    action.activate_signal.connect do

      compile_action ="compile", nil)

      # next line of code does not disable the menu action
      compile_action.enabled = false


Crystal 1.6.2 [879691b2e] (2022-11-03)

LLVM: 13.0.1
Default target: x86_64-unknown-linux-gnu

Found the answer, needed to remove the action via @app.remove_action(“compile”)

1 Like