docs: More syntax fixes

[`func@Foo`] is not the right link syntax either.
This commit is contained in:
Matthias Clasen 2021-05-22 21:20:10 -04:00
parent 8bcc6b1d96
commit 71aac48042
4 changed files with 15 additions and 15 deletions

View File

@ -28,8 +28,8 @@ At the lowest level, physical keys on the keyboard are represented by
numeric keycodes, and GDK knows how to translate these keycodes into numeric keycodes, and GDK knows how to translate these keycodes into
key values according to the configured keyboard layout and the current key values according to the configured keyboard layout and the current
state of the keyboard. In the GDK api, the mapping from keycodes to key state of the keyboard. In the GDK api, the mapping from keycodes to key
values is available via [`method@Gdk.Display.map_keycode`], and the reverse values is available via [method@Gdk.Display.map_keycode], and the reverse
mapping is available via [`method@Gdk.Display.map_keyval`]. The results of mapping is available via [method@Gdk.Display.map_keyval]. The results of
these functions are returned in [struct@Gdk.KeymapKey] structures. these functions are returned in [struct@Gdk.KeymapKey] structures.
You can think of a [struct@Gdk.KeymapKey] as a representation of a symbol You can think of a [struct@Gdk.KeymapKey] as a representation of a symbol

View File

@ -106,7 +106,7 @@ The call to [ctor@Gtk.ApplicationWindow.new] will create a new
window will have a frame, a title bar, and window controls depending on the window will have a frame, a title bar, and window controls depending on the
platform. platform.
A window title is set using [`method@Gtk.Window.set_title`]. This function A window title is set using [method@Gtk.Window.set_title]. This function
takes a `GtkWindow` pointer and a string as input. As our `window` pointer takes a `GtkWindow` pointer and a string as input. As our `window` pointer
is a `GtkWidget` pointer, we need to cast it to `GtkWindow`; instead of is a `GtkWidget` pointer, we need to cast it to `GtkWindow`; instead of
casting `window` via a typical C cast like `(GtkWindow*)`, `window` can be casting `window` via a typical C cast like `(GtkWindow*)`, `window` can be
@ -115,7 +115,7 @@ pointer is an instance of the `GtkWindow` class, before casting, and emit a
warning if the check fails. More information about this convention can be warning if the check fails. More information about this convention can be
found [here](https://developer.gnome.org/gobject/stable/gtype-conventions.html). found [here](https://developer.gnome.org/gobject/stable/gtype-conventions.html).
Finally the window size is set using [`method@Gtk.Window.set_default_size`] Finally the window size is set using [method@Gtk.Window.set_default_size]
and the window is then shown by GTK via [method@Gtk.Widget.show]. and the window is then shown by GTK via [method@Gtk.Widget.show].
When you close the window, by (for example) pressing the X button, the When you close the window, by (for example) pressing the X button, the
@ -212,10 +212,10 @@ The `GtkBox` widget is created with [ctor@Gtk.Box.new], which takes a
this box will contain can either be laid out horizontally or vertically. this box will contain can either be laid out horizontally or vertically.
This does not matter in this particular case, as we are dealing with only This does not matter in this particular case, as we are dealing with only
one button. After initializing box with the newly created `GtkBox`, the code one button. After initializing box with the newly created `GtkBox`, the code
adds the box widget to the window widget using [`method@Gtk.Window.set_child`]. adds the box widget to the window widget using [method@Gtk.Window.set_child].
Next the `button` variable is initialized in similar manner. Next the `button` variable is initialized in similar manner.
[`ctor@Gtk.Button.new_with_label`] is called which returns a [ctor@Gtk.Button.new_with_label] is called which returns a
[class@Gtk.Button] to be stored in `button`. Afterwards `button` is added to [class@Gtk.Button] to be stored in `button`. Afterwards `button` is added to
our `box`. our `box`.
@ -353,7 +353,7 @@ draw function.
The contents of a widget often need to be partially or fully redrawn, e.g. The contents of a widget often need to be partially or fully redrawn, e.g.
when another window is moved and uncovers part of the widget, or when the when another window is moved and uncovers part of the widget, or when the
window containing it is resized. It is also possible to explicitly cause a window containing it is resized. It is also possible to explicitly cause a
widget to be redrawn, by calling [`method@Gtk.Widget.queue_draw`]. GTK takes widget to be redrawn, by calling [method@Gtk.Widget.queue_draw]. GTK takes
care of most of the details by providing a ready-to-use cairo context to the care of most of the details by providing a ready-to-use cairo context to the
draw function. draw function.
@ -690,16 +690,16 @@ gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs
Note that `GtkBuilder` can also be used to construct objects that are Note that `GtkBuilder` can also be used to construct objects that are
not widgets, such as tree models, adjustments, etc. That is the reason not widgets, such as tree models, adjustments, etc. That is the reason
the method we use here is called [`method@Gtk.Builder.get_object`] and returns the method we use here is called [method@Gtk.Builder.get_object] and returns
a `GObject` instead of a `GtkWidget`. a `GObject` instead of a `GtkWidget`.
Normally, you would pass a full path to [`method@Gtk.Builder.add_from_file`] to Normally, you would pass a full path to [method@Gtk.Builder.add_from_file] to
make the execution of your program independent of the current directory. make the execution of your program independent of the current directory.
A common location to install UI descriptions and similar data is A common location to install UI descriptions and similar data is
`/usr/share/appname`. `/usr/share/appname`.
It is also possible to embed the UI description in the source code as a It is also possible to embed the UI description in the source code as a
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the string and use [method@Gtk.Builder.add_from_string] to load it. But keeping the
UI description in a separate file has several advantages: It is then possible UI description in a separate file has several advantages: It is then possible
to make minor adjustments to the UI without recompiling your program, and, to make minor adjustments to the UI without recompiling your program, and,
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org) more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
@ -985,7 +985,7 @@ glib-compile-resources exampleapp.gresource.xml --target=resources.c --generate-
``` ```
The gnome module of the [Meson build system](https://mesonbuild.com) The gnome module of the [Meson build system](https://mesonbuild.com)
provides the [`gnome.compile_resources()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources) provides the [gnome.compile_resources()](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
method for this task. method for this task.
Our application now looks like this: Our application now looks like this:
@ -1081,7 +1081,7 @@ tell it to display information about our stack.
The stack switcher gets all its information it needs to display tabs from The stack switcher gets all its information it needs to display tabs from
the stack that it belongs to. Here, we are passing the label to show for the stack that it belongs to. Here, we are passing the label to show for
each file as the last argument to the [`method@Gtk.Stack.add_titled`] each file as the last argument to the [method@Gtk.Stack.add_titled]
function. function.
Our application is beginning to take shape: Our application is beginning to take shape:
@ -1221,7 +1221,7 @@ Before we can make use of this schema in our application, we need to compile
it into the binary form that GSettings expects. GIO provides it into the binary form that GSettings expects. GIO provides
[macros](https://developer.gnome.org/gio/2.36/ch31s06.html) to do this in [macros](https://developer.gnome.org/gio/2.36/ch31s06.html) to do this in
autotools-based projects, and the gnome module of the Meson build system autotools-based projects, and the gnome module of the Meson build system
provides the [`gnome.compile_schemas()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas) provides the [gnome.compile_schemas()](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
method for this task. method for this task.
Next, we need to connect our settings to the widgets that they are supposed Next, we need to connect our settings to the widgets that they are supposed

View File

@ -7,7 +7,7 @@ Title: Initialization
Before using GTK, you need to initialize it using [func@Gtk.init]; this Before using GTK, you need to initialize it using [func@Gtk.init]; this
connects to the windowing system, sets up the locale and performs other connects to the windowing system, sets up the locale and performs other
initialization tasks. [func@Gtk.init] exits the application if errors occur; initialization tasks. [func@Gtk.init] exits the application if errors occur;
to avoid this, you can use [`func@Gtk.init_check`], which allows you to recover to avoid this, you can use [func@Gtk.init_check], which allows you to recover
from a failed GTK initialization; for instance, you might start up your from a failed GTK initialization; for instance, you might start up your
application in text mode instead. application in text mode instead.

View File

@ -48,7 +48,7 @@
* *
* `GdkContentFormats` is an immutable struct. After creation, you cannot change * `GdkContentFormats` is an immutable struct. After creation, you cannot change
* the types it represents. Instead, new `GdkContentFormats` have to be created. * the types it represents. Instead, new `GdkContentFormats` have to be created.
* The [struct@Gdk.ContentFormatsBuilder]` structure is meant to help in this * The [struct@Gdk.ContentFormatsBuilder] structure is meant to help in this
* endeavor. * endeavor.
*/ */