Commit a3bfaed3 authored by Adrien Plazas's avatar Adrien Plazas

Add the GTK+ section

parent 03bca527
.. _gtk+:
.. _GTK+ website : https://www.gtk.org/
.. _GTK+ Inspector : https://wiki.gnome.org/Projects/GTK+/Inspector
.. _application menu design : https://gitlab.gnome.org/Community/Design/os-mockups/tree/master/app-menu
.. _application menu example application : https://source.puri.sm/Librem5/purism-gtk-3-examples/tree/app-menu
.. _adaptive labels example application : https://source.puri.sm/Librem5/purism-gtk-3-examples/tree/adaptive-labels
.. _GtkLabel : https://developer.gnome.org/gtk3/stable/GtkLabel.html
.. _GtkLabel ellipize property : https://developer.gnome.org/gtk3/stable/GtkLabel.html#GtkLabel--ellipsize
.. _GtkLabel wrap property : https://developer.gnome.org/gtk3/stable/GtkLabel.html#GtkLabel--wrap
.. _GtkLabel wrap-mode property : https://developer.gnome.org/gtk3/stable/GtkLabel.html#GtkLabel--wrap-mode
GTK+
====
`GTK+ <GTK+ website_>`_ is the graphical application framework used to develop all GNOME applications. This section presents tips and tricks with GTK+ to help you develop great adaptive applications for GNOME, for general GTK+ and GNOME development resources please check the :ref:`resources` page.
.. note:: From now on, this section assumes you are familiar with the basics of GTK+ application development.
The GTK+ Inspector
------------------
The `GTK+ Inspector`_ is a tool giving you direct and dynamic access to the internal state of the user interface of your GTK+ application at runtime. It is similar in concept to a web inspector.
The GTK+ Inspector is extremely convenient to debug your GTK+ application. To use it you first need to enable it via GSettings::
$ gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true
To trigger the inspector simply press `Control-Shift-I` or `Control-Shift-D` when running the application.
Alternatively you can set the ``GTK_DEBUG`` environment variable to ``interactive``::
$ GTK_DEBUG=interactive your-application
.. note:: For the GTK+ Inspector to work in your flatpaked application, you need to add ``--env=DCONF_USER_CONFIG_DIR=.config/dconf`` to the ``finish-args`` list.
Application Menu
----------------
GNOME applications are expected to have an application menu following the designs listed here: `application menu design`_.
To help you implement these, we created an `example application <application menu example application_>`_, just clone it in :ref:`gbuilder` and check the ``app-menu`` branch out.
Adaptive Labels
---------------
A GtkLabel_ can prevent your application's UI from reaching really small sizes, but there are simple tricks to make them do so. Consider using one of the following tricks on each of your labels!
Allowing your label to ellipsize will cut a part of your string when there isn't enough space for it, you can enable it and choose which part will be cut with the `GtkLabel ellipize property`_. Use it if you really need your label to be on a single line.
Letting your label wrap will preserve the integrity of the text at the expense of more height, you can enable it with the `GtkLabel wrap property`_ and choose how to wrap with the `GtkLabel wrap-mode property`_.
.. note:: By allowing the label to wrap, it will always request enough height when fully wrapped. Consider putting your label or a widget containing it into a scrollable window to avoid height becoming a problem.
To help you implement these, we created an `example application <adaptive labels example application_>`_, just clone it in :ref:`gbuilder` and check the ``adaptive-labels`` branch out.
......@@ -8,5 +8,6 @@ GNOME
GNOME/Flatpak_setup
GNOME/GBuilder
GNOME/Gtk+
GNOME/Glade
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment