Commit Graph

266 Commits

Author SHA1 Message Date
Matthias Clasen
fecb31b706 builder: Stop using pixbufutils
We can just use gdk_pixbuf_new_from_resource here.
2021-09-17 02:02:51 +02:00
Matthias Clasen
dcd873a6d8 builder: create textures without pixbufs
Load textures using the GdkTexture apis, without
going through a pixbuf first.
2021-09-17 02:02:51 +02:00
Benjamin Otte
0781429dc5 builder: Add support for GdkContentFormats 2021-07-27 04:28:04 +02:00
Maximiliano Sandoval R
aa6a9de6ba
gtk/builder: Port example to GTK 4 2021-07-20 13:22:08 +02:00
Matthias Clasen
938bfff3dd Add type annotations for filename arguments
Add missing "(type filename)" annotations for string
arguments that are filenames.

Fixes: #633
2021-06-12 11:12:06 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Chris Mayo
7216f71825 docs: Escape tags in GtkBuilder description
Fixes the tags and the rest of the gi-docgen created HTML page not being
visible in a browser.
2021-04-01 19:21:57 +01:00
Matthias Clasen
0c6da97147 builder: Add an assertion
This case is clearly not meant to happen.
Assert that it doesn't.
2021-03-27 19:11:56 -04:00
Matthias Clasen
0776f645fd builder: Convert docs 2021-03-11 16:37:34 +00:00
Emmanuele Bassi
e8b6e6cad0 docs: Clean up the first paragraph for various symbols
The documentation engine will use the first paragraph as the summary for
a type or constant.
2021-03-11 16:37:30 +00:00
Timm Bäder
de6cd4f0d2 builder: Use a GPtrArray when parsing signals 2021-01-17 04:39:26 +01:00
Timm Bäder
aec2fb939f builderparser: Keep properties in a GPtrArray 2021-01-17 04:39:26 +01:00
Michael Catanzaro
afaa275dc8 gtkbuilder: fix recommendations that no longer make sense in GTK 4
In GTK 3, it was pretty much always better to use
gtk_builder_new_from_whatever() rather than
gtk_builder_add_from_whatever(). But in GTK 4, this is no longer
generally true. Let's add some context on when you want to use one or
the other.
2021-01-07 11:34:42 -06:00
Arnaud Bonatti
db6d7dccd8 Drop “gtk+” plus sign in GtkBuilder <requires>. 2020-11-07 16:16:55 +01:00
Matthias Clasen
e050a2661c builder: Expot _gtk_builder_boolean_from_string privately
When specifying accessible properties in ui files, it
is better to accept the same syntax for booleans as
elsewhere, so lets reuse this function.
2020-10-25 12:19:21 -04:00
Timm Bäder
c5909d4dc4 gtkbuilder: Remove pointless function prototype 2020-10-14 15:06:12 -04:00
Florian Müllner
2715b3ec31 buildable: Make vfunc accessor functions private
With the exception of gtk_buildable_get_id(), those are only used
to construct objects from XML descriptions, which is functionality
internal to GTK.

The API is therefore unlikely to be missed, and keeping it internal
means they can no longer unintentionally shadow object methods in
bindings with less namespacing; for example it's currently ambiguous
whether `infoBar.add_child()` refers to gtk_info_bar_add_child() or
gtk_buildable_add_child().

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191
2020-09-26 02:16:57 +02:00
Florian Müllner
12189bc10f buildable: Rename set_name() to set_buildable_id()
GtkBuildable's get_name()/set_name() methods may shadow
GtkWidget's methods. Avoid that by renaming the API to
get_buildable_id()/set_buildable_id(), which also reflects
the name of the XML attribute the API refers to.

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191
2020-09-26 02:16:05 +02:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
f561000124 docs: Clean up many dangling links
In many cases, these were references to no longer
existing api, so some rewording was necessary.
2020-08-04 22:11:34 -04:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
65902367c6 builder: Documentation tweaks
Don't use no-longer-existing enums as examples,
and drop the +.
2020-06-27 17:28:15 -04:00
Matthias Clasen
4fb495d0fe builder: Warn about dropped objects
Use GTK_DEBUG=builder-objects to make GtkBuilder warn
if a named object from a ui files doesn't get claimed
by gtk_builder_get_object(). This is useful for finding
dead wood in .ui files.
2020-06-27 09:47:00 -04:00
Timm Bäder
c6921cdc9d builder: Use default size of 8 for the ObjectProperty arrays 2020-06-19 05:26:25 +02:00
Timm Bäder
7c9f2949ce builder: Avoid allocating things we don't use
We pretty often have no parameters at all, so avoid allocating
ObjectProperties+GArray+GPtrArray in that case.
2020-06-19 05:26:25 +02:00
Emmanuele Bassi
0a55d4c981 docs: Clean up the GtkBuilder description
Drop the reference to a long since removed RNC schema file and to
GtkUIManager; clean up the typography for code elements.
2020-06-18 17:21:09 +01:00
Emmanuele Bassi
ebaa96c0fa Turn GtkExpression into a GTypeInstance
Since it's a type with sub-classes, we need to use GTypeInstance (at the
very least), otherwise we won't be able to address each sub-class as
such.

This is similar to how GskRenderNode and GdkEvent are handled, with the
added difficulty that GtkExpression is meant to be used in properties,
in order to be deserialised by GtkBuilder. This requires adding a
GParamSpec sub-class that we can match on from within GtkBuilder,
alongside some convenience API for storing a GtkExpression inside a
GValue.
2020-06-01 21:07:53 +01:00
Benjamin Otte
b43c8ae646 expression: Allow passing a this object to bind()
This gives a bit more control over the arguments passed to expressions.
2020-05-30 19:26:46 -04:00
Benjamin Otte
db3e225f09 builder: Make gtk_builder_extend_with_template() work with objects
This will be relevant later when we introduce GtkListItem which is not a
GtkWidget.
2020-05-30 19:26:46 -04:00
Benjamin Otte
aad9adf8c3 builder: Autofill scope property of listitemfactory
I couldn't come up with a better way to automatically inherit the scope
in the builder list item factory that didn't involve a magic
incantation in the XML file. And I do not want developers to know magic
incantations to do a thing that should pretty much always be done.
2020-05-30 19:26:45 -04:00
Benjamin Otte
934bfc8887 builder: Add <binding> tag
The tag contains an expression that it then gtk_expression_bind()s to
the object it is contained in.
2020-05-30 19:26:44 -04:00
Benjamin Otte
fde75aa9f6 builder: Add support for parsing expressions 2020-05-30 17:47:47 -04:00
Benjamin Otte
1ef805328f builder: Allow <property bind /> for objects
Previously, object properties had to always be set to a value.
This now works without it.
2020-05-30 10:46:27 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
6d969d1026 Update the docs
Remove various references to gtk_widget_destroy in the docs.
2020-05-11 12:20:59 -04:00
Matthias Clasen
ace183f38f shortcutcontroller: Fix builder support
The GtkBuilder support was not working anymore after
triggers and actions have been turned into objects.

Fix this.
2020-03-30 19:02:35 -04:00
Emmanuele Bassi
6e8c78714d Turn GtkShortcutAction into a GObject
Just like we did for GtkShortcutTrigger.

This allows language bindings to properly deal with all the actions.
2020-03-25 23:14:45 -04:00
Emmanuele Bassi
457b6657bb Turn GtkShortcutTrigger into an object
The lightweight inheritance mechanism used for GtkShortcutTrigger is not
going to be usable by bindings, because boxed types cannot have derived
types.

We could use GTypeInstance and derive everything from that, like
GParamSpec, but in the end shortcuts are not really a performance
critical paths, unlike CSS values or render nodes.
2020-03-25 23:14:45 -04:00
Benjamin Otte
78e3e42042 shortcutcontroller: Implement GtkBuildable
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-25 23:14:28 -04:00
Benjamin Otte
33045c3e0b shortcutaction: Integrate with GtkBuilder property parsing
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-25 23:14:28 -04:00
Benjamin Otte
7974751e24 shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
And hook it up into the GtkBuilder infrastructure.
2020-03-25 23:14:28 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Benjamin Otte
29ced09dc4 shortcutcontroller: Implement GtkBuildable
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-18 23:00:51 -04:00
Benjamin Otte
458fcba457 shortcutaction: INtegrate with GtkBuilder property parsing
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-18 23:00:51 -04:00
Benjamin Otte
5218dd6a34 shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
And hook it up into the GtkBuilder infrastructure.
2020-03-18 23:00:51 -04:00