Gtkmm/c++ examples in Gnome tutorials

Recently I found the Gnome Developer Documentation and realized there are no examples in C++ bindings, but C, Vala, Python, JS…
https://developer.gnome.org/documentation/tutorials.html

Can I make a PR to include them?

You’re more than welcome to port the examples to C++!

My recommendation is to update the repository with the full code; then you can add the C++ code fragments in the documentation.

If you have questions about Sphinx and the format for the documentation, feel free to ask here or in the Docs channel on Matrix.

OK.

A few questions then:

  1. Gnome Builder does not have Gnome Application template for C++ language. Should I create a project as if it would be C and adapt the generated (project/meson/source) files to C++? Or should I create the tutorial instructions by starting with an empty meson project?
  2. How should the folder be named? C++, cpp or CC? There are C and python for now.

You should submit a template for GNOME Builder, first. The idea of the Getting Started tutorial is that people will follow the same steps regardless of language, and the first step is “create a new template with GNOME Builder”.

Use cpp.

1 Like

I’ll name the C++ template files with .hh and .cc extensions to differentiate from C files ank keep the basenames like other languages do, ok?
Generated C++ source files will be .h and .cpp.

Tutorial tells reader to use “Gnome Application”, that implies use of libadwaita, but there is no official c++ language binding yet (I only found this project: GitHub - rofirrim/libadwaitamm: UNOFFICIAL libadwaita bindings for C++).
What should I do here:

static const GbpMesonTemplateInfo templates[] = {
  {
    -1000,
    "adwaita",
    N_("GNOME Application"),
    N_("A Meson-based project for GNOME using GTK 4 and libadwaita"),
    IDE_STRV_INIT ("C", "JavaScript", "Python", "Rust", "Vala"),
    gtk4_expansions, G_N_ELEMENTS (gtk4_expansions),
    gtk4_language_scope, G_N_ELEMENTS (gtk4_language_scope),
    IDE_STRV_INIT ("is_adwaita=true",
                   "is_gtk4=true",
                   "enable_i18n=true",
                   "enable_gnome=true",
                   "ui_file=window.ui",
                   "exec_name={{name}}"),
  },

Should I just add just “C++” in the language list or should I create a new entry, only for C++ and disabling adwaita:

  {
    -950,
    "gnome",
    N_("GNOME Application"),
    N_("A Meson-based project for GNOME using GTK 4"),
    IDE_STRV_INIT ("C++"),
    gtk4_expansions, G_N_ELEMENTS (gtk4_expansions),
    gtk4_language_scope, G_N_ELEMENTS (gtk4_language_scope),
    IDE_STRV_INIT ("is_adwaita=false,
                   "is_gtk4=true",
                   "enable_i18n=true",
                   "enable_gnome=true",
                   "ui_file=window.ui",
                   "exec_name={{name}}"),
  },

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