Commit d5e6bfda authored by Heather Ellsworth's avatar Heather Ellsworth
Browse files

Merge branch 'gtk' into 'master'

Add the GTK+ section

See merge request Librem5/!18
parents 986a636a a3bfaed3
.. _gtk+:
.. _GTK+ website :
.. _GTK+ Inspector :
.. _application menu design :
.. _application menu example application :
.. _adaptive labels example application :
.. _GtkLabel :
.. _GtkLabel ellipize property :
.. _GtkLabel wrap property :
.. _GtkLabel wrap-mode property :
`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
Supports Markdown
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