A suggestion to perhaps rethink a sentence in the gtk.org reference -- GLib.idle_add

hi,

After spending minutes trying to figure, I thought it’d be doubly good to ask it* here :slight_smile:
// ask it: what’s the meaning of the first sentence in that reference page.

Doubly, cause it may get corrected eventually.

It’s about Gtk.idle_add

https://docs.gtk.org/glib/func.idle_add.html

the sentence is this:

Adds a function to be called whenever there are no higher priority events pending to the default main loop.

It has three parts:

  • Adds a function
  • to be called whenever there are no higher priority events pending
  • to the default main loop.

I know that the sentence is correct :slight_smile:
I am also aware that the Gtk reference is not a tutorial, and must be concise.
But it takes a careful reading, which means it could be more straightforward,
especially because this is the first line in that text.

I think it means this:

(excuse my boldness to interpret it without knowing it in depth)

default main loop
			|
			|
			|_______
			|  	a thread
			|		|
			|		|
  fn() will |		|requesting a call to fn()
  be called |		|-- here
	here  --|
or later    |

I could imagine improving the sentence like this:

(Pardon my boldness! :slight_smile: )

  1. “Adds a function to the default main loop , (🡨 comma)
    to be called whenever there are no higher priority events pending.”
    (Problem: what it adds is actually a function call – if I imagine it well.
    Therefore the comma is wrong.)

  2. “Adds a function to the default main loop to be called whenever there are no higher priority events pending.”

  3. “Adds a function to the default main loop to be called as soon as there are no higher priority events pending.”

  4. Adds a function call to the main loop to be performed as soon as there are no higher priority events pending.

  5. Places a function call in the main loop to be performed as soon as there are no higher priority events pending.


I would “vote” for 2. But since my knowledge is very shallow, this is irrelevant :slight_smile:

Note: I’m just trying to leave an ant-path behind, as I’m moving ahead, for others giving Gtk a go for the first time.

Peter

I have to admit your communication style makes interacting with whatever you write excruciatingly hard. Having to decrypt what looks like a stream of consciousness is not easy to do in a timely way, especially for volunteers. You should be brief, and to the point, not leave breadcrumbs to the reader so that they can divine what your intentions are.

As for the issue: g_idle_add() is a low level function, and the reference documentation tries to be exhaustive since it is the reference documentation.

What you’re looking for is an overview, like the Main Event Loop overview, or a tutorial.

Your suggestions are just tweaks that do not really change the sentence structure, but seem to make sense to you. The existing wording is shared across multiple functions as well, for consistency, so just just changing it in one place isn’t going to be enough.

If you have a better set of suggestions, feel free to open an issue, or—better yet—open a merge request with a change to improve the wording.