Google recently found

to help me understanding how toggle_action can be used.

Most seems to make sense, but I still wonder why

g_application_hold (application);

is used there. Can it really happen that

static void activate_toggle_action () is interrupted? Generally GTK main loop is regarded as single-threaded?

May that be only for future GTK version, which may use treads and parallel processing?

Well, I think glib and gio supports threads, so maybe activate_toggle_action () can be indeed called by threads, so I will also use g_application_hold for the Nim example. Works fine already:


proc activateToggleAction(action: SimpleAction; parameter: Variant; app: Application) =  
    echo format("action $1 activated", action.name)
    let state: Variant = action.state
    let b = state.boolean
    action.state = newVariantBoolean(not b)  
    echo format("state change $1 -> $2", b, not b)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.