GNOME Developer Documentation c++ tutorial Loading Content From A File

I am doing this tutorial, Beginners Tutorials, Loading Content From A File, found here:

About half way down the function names stop following name syntac.

‘The on_open_response function handles the response of the user once they have selected the file and closed the dialog, or simply closed the dialog without selecting a file:’

All other functions start with the .c file name i.e. text_viewer_window__open_…
And there is no mention where this function should be placed.
When I add this function, and all the rest in the tutorial, to the file and tried running it did not compile.

My real question is, has anyone followed this tutorial?
I am not unwilling to learn and adjust, just really want to know what I am missing, which happens too often.

Thanks for any and all comments!!!

Hi; I wrote the tutorial in question.

Yes, the names of the functions don’t always follow a strict naming policy—mainly for signal handlers or async callback, because they’d get too long. Mainly, it’s a crutch because C does not have lambdas or anonymous functions; in other languages, we’d inline the callback.

I’m happy to update the name, though.

In the specific case of on_open_response, it should be defined before call to gtk_file_dialog_open(); that’s pretty much always the case with C: functions get defined (or at least declared) first, and then used.

The tutorial assumes you already know the language you’re following along; if you’re also learning C, it’s going to be a pretty steep learning curve to add GTK to the mix.

Additionally, the tutorial is meant to be followed as a way to get started with the GNOME platform; it’s not a programming tutorial.

Hello ebassi,
Well, the names were getting a little long, lol.
I did add them as per the tutorial before the reference calls.
It is those assumes that all ways get me.
I will redo and if I may, can I past what I am getting here for yall to look at?

Thanks for helping!!

If you want to read the complete code example, and follow along with the tutorial, you can check them out here: Teams / Documentation / Getting Started Tutorial · GitLab

A word of advice: the tutorial code isn’t completely up to date, but it’ll be soon.

Well thats a good way for me to learn as I go!!

Thanks

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