Benjamin Otte
bfe4255807
builder: Allow objects in gtk_builder_value_from_string_type()
...
Instead of throwing an error, lookup objects with
gtk_builder_get_object().
2019-12-03 18:12:25 +01:00
Robert Ancell
0df45f0de0
builder: Fix broken annotation
...
Missing a ':', was introduced in 0627bba5a0
.
2019-11-27 16:06:36 +13:00
Benjamin Otte
4fbb0d7ce4
builder: Make the struct private
...
We don't want anyone to subclass it - if we want to allow bindings to
extend GtkBuilder, we will be using delegate objects/functions for it.
2019-11-22 17:42:32 +01:00
Benjamin Otte
245fdc8b38
builder: Remove get_type_from_name() vfunc
2019-11-22 17:42:32 +01:00
Benjamin Otte
420169d5cd
builder: Improve signal connecting
...
- Propagate the error back to the parser, so we get a proper GError
instead of a g_warning().
- Connect closures by id, don't construct a name from the ids so that
glib can take it apart again.
2019-11-22 17:42:31 +01:00
Benjamin Otte
b025ee428c
builder: Connect signals automatically
...
gtk_builder_connect_signals() is no longer necessary, because all the
setup that made it necessary to have this extra step is now done
automatically via the closure functions.
2019-11-22 17:42:31 +01:00
Benjamin Otte
0627bba5a0
builder: Add gtk_builder_set_closure_func()
...
This allows bindings and templates to setup a way to create closures.
2019-11-22 08:13:16 +01:00
Benjamin Otte
094c537001
builder: Add gtk_builder_create_closure()
...
This will be the future way to connect signals automatically (and be
used for other things, too).
For now, gtk_builder_connect_signals_default() is ported to use it.
2019-11-22 07:46:18 +01:00
Benjamin Otte
27d05102ab
builder: Remove user_data argument from gtk_builder_connect_signals()
...
This is pretty unused and gets in the way of the next steps.
A potential side effect is that for templates the widget was passed as
the user data argument. If that turns out to be important, we have to
special case that situation.
2019-11-22 07:46:18 +01:00
Benjamin Otte
f5e4dc824c
builder: Remove application setter/getter
...
It's unused and doesn't belong to GtkBuilder.
2019-11-22 07:46:18 +01:00
Benjamin Otte
80acc8f296
builder: Carry the module as part of the GtkBuilder object
...
This way, we don't open the module in every place we want to look up
functions.
2019-11-22 07:46:18 +01:00
Benjamin Otte
e3860d25e9
builder: Fix typo in docs
2019-11-22 07:35:03 +01:00
Benjamin Otte
4cca27a7af
builder: Allow parsing G_TYPE_BYTES from strings
...
Just create a bytes containing the literal string.
2019-10-29 04:56:19 +01:00
Daniel Boles
98f0d85c4a
Builder: Fix a couple of typos in documentation
2019-10-06 20:48:10 +01:00
Alexander Larsson
96b37f4eb8
Use the new GtkBuildableParser type in GtkBuildable interfaces
2019-09-10 12:08:20 -04:00
Timm Bäder
f3099afcc5
icontheme: Return textures from load_icon{,_for_scale}
2019-09-09 17:36:26 +02:00
Mohammed Sadiq
c1bb699151
builderparser: Allow bind-source without bind-property
...
This allow users to bind same property of two objects with only
specifing “name” and “bind-source” in UI file.
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2080
2019-08-10 19:01:36 +05:30
Timm Bäder
38f4a7708e
Remove some dead assignments
2019-07-14 10:08:04 +02:00
Benjamin Otte
836635d1ae
builder: Allow values of type GType
...
In particular this allows setting the item-type property of GListStore.
2019-06-04 06:11:44 +02:00
Benjamin Otte
6a0e0031b1
builder: Make GListStore buildable
...
Treats GListStore like any other object and allows <child> to add items
to it.
2019-06-04 06:11:44 +02:00
Matthias Clasen
54e7a94d70
builder: Fix signedness issues in apis
...
Whenever we take a length argument that can
be -1 for 'nul-terminated', it should be
gssize, not gsize.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1555
2019-05-01 03:21:29 +00:00
Benjamin Otte
f310609a66
builder: Parse GskTransform properties
...
In particular, this allows parsing the GtkFixed position properties.
2019-04-12 19:34:29 +02:00
Matthias Clasen
ed3b9669b3
builder: Allow specifying objects inline
...
In addition to <property name="foo">bar</property> referring
to an object with ID bar, we now also parse
<property name="foo"><object>...
to specify a property 'inline'.
2019-02-08 00:09:44 -05:00
Emmanuele Bassi
1668496359
docs: Fix GTK links and locations
2019-02-06 10:39:27 +01:00
Timm Bäder
131e8d8905
Remove some unnecessary gtkwindow.h includes
2019-02-05 08:11:43 -05:00
Matthias Clasen
5120748981
Drop GtkButtonBox
...
This widget does not seem worth keeping,
and we want to get rid of child properties.
2019-02-04 12:44:55 -05:00
Timm Bäder
3be2cb8f63
builder: Fix g-i annotations of _get_translation_domain
...
The return value can be null and is (transfer none).
2018-06-18 17:35:02 +02:00
Timm Bäder
8267605ba2
builder: Use TRUE/FALSE for error return values
...
Instead of guint and 0/1.
2018-06-18 17:35:02 +02:00
Timm Bäder
da4d8b7d94
builder: Remove priv pointer
2018-06-18 17:35:02 +02:00
Timm Bäder
5b453ecd19
Always use #ifdef for G_ENABLE_DEBUG
...
Release builds don't define it to 0, they just don't define it. Avoid
the compilation warning we get otherwise.
2018-04-21 19:18:20 +02:00
Benjamin Otte
ea0290c50e
builder: Allow named objects to be used in paintable/pixbuf properties
...
Instead of erroring if an object by a name already exists, use that
object.
2018-03-29 05:02:15 +02:00
Benjamin Otte
cbe40f5f46
image: Remove gtk_image_set_texture()
...
gtk_image_get_paintable() is a perfect replacement, so use that one.
2018-03-16 06:04:45 +01:00
Matthias Clasen
4c150d8eb5
The big versioning cleanup
...
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Benjamin Otte
b12a53406d
builder: Mirror GdkPixbuf abilities for GdkTexture
...
In particular, allow specifying a filename for a GDK_TYPE_TEXTURE
property. This makes it easy to transition properties from Pixbuf type
to Texture type without having to touch resource files.
2017-11-05 00:07:17 +01:00
Timm Bäder
e2e91bf9bc
Fix a few documentation issues
2017-07-19 21:27:15 -04:00
Emmanuele Bassi
c9a5d51539
Use the newly added g_object_new_with_properties()
...
Instead of the deprecated g_object_newv().
This requires some internal surgery to create our own vector of names
and values, but it does not functionally change anything.
2017-04-02 17:29:38 +01:00
Emmanuele Bassi
4471f274b9
Ignore deprecation warnings for g_object_newv()
...
GLib has deprecated GParameter and g_object_newv(); until we switch to
the new g_object_new_with_properties() API, and bump GLib required
version, we should simply ignore the compiler warnings.
2017-04-02 17:29:38 +01:00
Timm Bäder
e0738b1e43
builder: avoid an uninitialized value
...
When g_module_supported() returns FALSE, args.module is garbage
otherwise.
2017-02-17 18:22:49 +01:00
Timm Bäder
9679c4f0e0
gtkbuilder: Improve error messages
2017-01-20 21:33:37 +01:00
Timm Bäder
2437e97da1
builder: Stop parsing GdkColor values
2016-10-20 20:12:04 +02:00
Timm Bäder
bc7206d70f
Remove GtkStock
2016-10-18 00:29:20 +02:00
Emmanuele Bassi
44885bcfed
Remove redundant declarations
2016-10-17 11:10:14 +01:00
Benjamin Otte
4df6ddad54
API: container: Remove gtk_container_set_border_width()
2016-10-16 18:18:58 +02:00
Matthias Clasen
7552b7fca8
GtkBuilder: Mention how GVariant properties are parsed
2016-04-14 15:30:59 -04:00
Matthias Clasen
9c0e4c174a
builder: Allow 'primary' as a modifier value
...
Support aliases for flags values in GtkBuilder, and use this
to support the special value 'primary' for GdkModifierType
values.
https://bugzilla.gnome.org/show_bug.cgi?id=699891
2016-03-05 23:44:03 -05:00
Matthias Clasen
2ee7fb1818
Don't use g_print for debug output
...
The g_print documentation explicitly says not to do this, since
g_print is meant to be redirected by applications. Instead use
g_message for logging that can be triggered via GTK_DEBUG.
2016-02-28 21:40:23 -05:00
Matthias Clasen
2cabfcc801
Avoid an a crash with GTK_DEBUG=builder
...
We might cast objects to GtkBuildable even if they aren't,
to print their names. Don't do that.
Found by gcc's address sanitizer.
2016-02-26 15:52:19 -05:00
Alberto Ruiz
496f0892fc
introspection: This patch fixes nullable return values fixes for the following symbols in gtk
...
gtk_accel_group_query
gtk_accel_group_from_accel_closure
gtk_accel_label_get_accel_widget
gtk_accessible_get_widget
gtk_actionable_get_action_name
gtk_app_chooser_get_app_info
gtk_app_chooser_button_get_heading
gtk_app_chooser_dialog_get_heading
gtk_application_get_window_by_id
gtk_assistant_get_nth_page
gtk_binding_set_find
gtk_builder_get_object
gtk_builder_lookup_callback_symbol
gtk_builder_get_application
gtk_button_get_image
gtk_cell_area_get_focus_from_sibling
gtk_cell_renderer_start_editing
gtk_cell_view_get_model
gtk_cell_view_get_displayed_row
gtk_clipboard_get_owner
gtk_container_get_focus_child
gtk_container_get_focus_vadjustment
gtk_container_get_focus_hadjustment
gtk_dialog_get_widget_for_response
gtk_drag_get_source_widget
gtk_drag_dest_get_target_list
gtk_drag_source_get_target_list
gtk_entry_completion_get_model
gtk_entry_completion_compute_prefix
gtk_expander_get_label_widget
gtk_file_chooser_get_filename
gtk_file_chooser_get_current_folder
gtk_file_chooser_get_uri
gtk_file_chooser_get_current_folder_uri
gtk_file_chooser_get_preview_widget
gtk_file_chooser_get_preview_file
gtk_file_chooser_get_preview_filename
gtk_file_chooser_get_preview_uri
gtk_file_chooser_get_extra_widget
gtk_file_chooser_get_filter
gtk_file_chooser_native_get_accept_label
gtk_file_chooser_native_get_cancel_label
gtk_file_filter_get_name
gtk_font_chooser_get_font_family
gtk_font_chooser_get_font_face
gtk_font_chooser_get_font
gtk_font_chooser_get_font_desc
gtk_font_chooser_get_font_map
gtk_frame_get_label
gtk_gesture_get_device
gtk_gesture_get_window
gtk_gl_area_get_error
gtk_header_bar_get_title
gtk_header_bar_get_subtitle
gtk_header_bar_get_custom_title
gtk_icon_info_get_filename
gtk_icon_view_get_path_at_pos
gtk_icon_view_get_model
gtk_image_get_pixbuf
gtk_image_get_animation
gtk_label_get_mnemonic_widget
gtk_label_get_attributes
gtk_check_version
gtk_menu_button_get_popup
gtk_menu_button_get_menu_model
gtk_menu_button_get_align_widget
gtk_menu_button_get_popover
gtk_menu_item_get_submenu
gtk_menu_item_get_accel_path
gtk_native_dialog_get_title
gtk_native_dialog_get_transient_for
gtk_notebook_get_nth_page
gtk_notebook_get_tab_label_text
gtk_notebook_get_menu_label
gtk_notebook_get_menu_label_text
gtk_notebook_get_group_name
gtk_notebook_get_action_widget
gtk_offscreen_window_get_surface
gtk_offscreen_window_get_pixbuf
gtk_paned_get_child1
gtk_paned_get_child2
gtk_places_sidebar_get_location
gtk_places_sidebar_get_nth_bookmark
gtk_plug_get_socket_window
gtk_popover_get_default_widget
gtk_progress_bar_get_text
gtk_recent_filter_get_name
gtk_recent_manager_lookup_item
gtk_settings_get_default
gtk_socket_get_plug_window
gtk_stack_sidebar_get_stack
gtk_stack_switcher_get_stack
gtk_style_context_get_section
gtk_style_context_get_parent
gtk_style_context_get_frame_clock
gtk_test_find_widget
gtk_text_buffer_get_mark
gtk_text_tag_table_lookup
gtk_text_view_get_tabs
gtk_text_view_toggle_cursor_visible
gtk_text_view_get_window
gtk_toolbar_get_nth_item
gtk_tool_button_get_label
gtk_tool_button_get_icon_name
gtk_tool_button_get_label_widget
gtk_tool_button_get_icon_widget
gtk_tool_palette_get_drop_item
gtk_tool_palette_get_drop_group
gtk_tree_model_filter_convert_child_path_to_path
gtk_tree_model_filter_convert_path_to_child_path
gtk_tree_model_sort_convert_child_path_to_path
gtk_tree_model_sort_convert_path_to_child_path
gtk_tree_view_get_column
gtk_tree_view_get_bin_window
gtk_tree_view_column_get_widget
gtk_tree_view_column_get_tree_view
gtk_widget_get_frame_clock
gtk_window_group_get_current_device_grab
GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Matthias Clasen
f0a74bc302
Document gtk_builder_extend_wth_template
2015-11-08 19:21:39 -05:00
Matthias Clasen
f254a4b67f
builder: Support creating GFile objects
...
This is useful, e.g. when creating GFileIcon objects.
2015-10-21 13:42:15 -04:00
Matthias Clasen
d0e30994d0
builder: Don't use g_slist_next
...
We just use direct access to list->next all over the place.
2015-10-20 06:14:57 -04:00
Matthias Clasen
45fa145034
builder: Cosmetic changes
...
Use an iter instead of g_hash_table_forall.
2015-10-20 06:14:57 -04:00
Matthias Clasen
3c54fbd3ac
Use stupid quotes instead of dumb quotes
...
Following a similar change in GLib a while ago.
'bla' may by stupid, but it looks less dumb than `bla'.
2015-09-23 07:01:16 -04:00
Matthias Clasen
4b92f0895a
builder: Minor tweak
2015-09-12 11:24:36 -04:00
Matthias Clasen
3526b08e01
Clean up debug features
...
Introduce a GTK_DEBUG_CHECK() macro and use it to check for
GTK_DEBUG flags everywhere. Also guard all such places by
2015-09-09 06:32:46 -04:00
Matthias Clasen
96d66a11cf
builder: Avoid some type-checking overhead
2015-09-09 06:32:45 -04:00
Matthias Clasen
97a29ab8c4
builder: Simplify _gtk_builder_boolean_from_string
...
We can do this without calling strlen() or allocating memory.
2015-09-07 12:54:16 -04:00
Matthias Clasen
3d01f29bd9
builder: Move a function
...
Move _gtk_builder_boolean_from_string in the same source file
as the other _from_functions.
2015-09-07 12:43:19 -04:00
Matthias Clasen
20079a9960
builder: Minor refactoring
...
Keep the GString in PropertyInfo around, instead of throwing it
away and just keeping the char*.
2015-09-07 12:25:29 -04:00
Matthias Clasen
14c0ed8bae
builder: Convert to g_object_notify_by_pspec
...
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:13:25 -04:00
Matthias Clasen
3eb0eaffe2
Remove an unused function
2015-08-09 23:39:00 +02:00
Matthias Clasen
9f24b54786
Code cleanup
...
Use g_slist_free_full more consistently. This commit just converts
the obvious cases where g_slist_forall is directly followed by
g_slist_free.
2015-07-31 22:23:35 -04:00
Emmanuele Bassi
b2cbe7ba79
builder: Skip introspecting lookup_callback_symbol()
...
Opaque function pointers as return values are not really usable in high
level languages, even via introspection.
2015-06-11 11:45:03 +01:00
Matthias Clasen
569d5ad763
GtkBuilder: Export the template parsing entry point
...
This will let gtk-builder-tool validate templates.
2015-04-30 06:19:10 -04:00
Matthias Clasen
10860d229e
Formatting fixes
2015-04-30 06:19:10 -04:00
Matthias Clasen
d58500b318
GtkBuilder: Report more lookup failures as GError
...
Report failures to lookup objects for property values
and bindings via GError too, and provide location information
while doing so.
https://bugzilla.gnome.org/show_bug.cgi?id=748234
2015-04-29 15:19:31 -04:00
Matthias Clasen
fc83c8ac76
GtkBuilder: Add new convenience API
...
Add a convenience function that is like gtk_builder_get_object()
but stashes away a GError if a lookup fails. To make the error
message informative, the function takes a line/column pair.
Doing things this way is necessary because the custom_tag_end,
custom_finished, and parser_finished vfuncs don't take a
GError parameter, despite being called from a place where
we can report a GError back.
2015-04-27 22:54:25 -04:00
Matthias Clasen
1525d4ab89
GtkBuilder: Document private convenience API
2015-04-27 22:53:42 -04:00
Matthias Clasen
c8446f43fd
GtkBuilder: Introduce some private helpers
...
Add functions that help reporting errors from builder
subparsers consistently.
2015-04-27 01:15:21 -04:00
Matthias Clasen
cd8b19dcb0
docs: Add an cross-reference to template docs
2015-04-26 10:19:26 -04:00
Maks Naumov
87d36885ac
Properly check result of g_utf8_get_char_validated()
...
g_utf8_get_char_validated() may return -1 or -2
return type is gunichar(guint32)
Therefore such checks like 'gunichar < 0' or 'gunichar > 0'
are always 'false' or 'true'(except when gunichar == 0).
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
https://bugzilla.gnome.org/show_bug.cgi?id=742774
2015-01-11 15:46:06 -05:00
Matthias Clasen
40049581bc
Trivial documentation tweaks
2014-10-04 15:48:07 -04:00
Matthias Clasen
2e83e7d335
GtkBuilder: Don't use deprecated types in examples
2014-10-03 09:33:35 -04:00
Matthias Clasen
80226ca926
GtkBuilder: Undo the type name heuristic changes
...
These turned out to break existing ui files, concretely
GWeatherLocationEntry was no longer guessed correctly.
Update the testcases to reflect this, and add a testcase
for GWeather.
2014-10-03 09:29:45 -04:00
Matthias Clasen
d5531da7f8
Trivial typography improvement
...
Use an em dash instead of -- in documentation.
2014-10-02 22:37:37 -04:00
Matthias Clasen
f35dff334f
Factor out a function
...
Factor out the typename-to-get-type mangling as a separate
function, for easier testing.
Also fix some cases where it doesn't, currently, like
GString -> g_string_get_type and
GdkRGB -> gdk_rgb_get_type
2014-09-26 23:30:29 -04:00
Matthias Clasen
0c2f3402c3
GtkBuilder: Mention more error domains
...
This has been requested in
https://bugzilla.gnome.org/show_bug.cgi?id=708206
2014-09-26 22:37:21 -04:00
Matthias Clasen
23fcc5e373
GtkBuilder: Support parsing int64/uin64 values
...
This was missing; the code to parse these numbers was there,
but the switch didn't have cases for these types.
https://bugzilla.gnome.org/show_bug.cgi?id=602443
2014-08-21 14:22:13 -04:00
Benjamin Otte
3df52ae6d5
builder: Cleanup
...
Use the usual way of providing user data to vfuncs:
- Don't allocate it, use the stack
- Use CamelCase for naming the struct
2014-05-31 05:19:40 +02:00
Evan Nemerson
54ec42f035
gtk: port many nullability annotation fixes from Vala bindings
...
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-30 13:24:20 -07:00
Matthias Clasen
6de6656d1f
GtkBuilder: Ensure types are fully initialized
...
Just calling get_type() does not ensure that the signals, properties
and everything else gets set up properly. Ensure it is, by calling
g_type_class_ref() before using the type. This fixes the testcase
added in the previous commit.
2014-05-30 12:39:07 -04:00
Matthias Clasen
49cf5142ba
Deprecate GdkColor
...
It has been replaced by GdkRGBA. Time to make it official.
http://bugzilla.gnome.org/show_bug.cgi?id=636695
2014-05-22 09:09:55 -04:00
Juan Pablo Ugarte
49fa04212b
GtkBuilder: improved parsing error report for invalid properties and signals.
...
Added GTK_BUILDER_ERROR_INVALID_PROPERTY and GTK_BUILDER_ERROR_INVALID_SIGNAL
error codes
ObjectInfo: Use a GType instead of a char * for the class name.
PropertyInfo: Use a GParamSpec instead of a char * for the property name.
SignalInfo: Use signal id and detail quark instead of a detailed signal name string.
This not only save us a few malloc in each case but lets us simplify the code
and report unknown properties and signals as a parsing error instead of just
printing a warning.
2014-05-01 17:59:53 -03:00
Juan Pablo Ugarte
887fc60cce
Added bindings support to GtkBuilder by introducing 3 new <property> attributes "bind-source" to specify the source object of the binding "bind-property" to specify the source property and "bind-flags" to specify the binding flags (optional)
...
Binding an object sensitive property with a check button active property will look like this:
<object class="GtkButton" id="button">
<property name="sensitive" bind-source="checkbutton" bind-property="active"/>
</object>
This is based on the original work done by Denis Washington for his GSoC project
This closes Bug 654417 "[GSoC] Add <binding> element to GtkBuilder syntax"
2014-04-18 18:59:14 -03:00
William Jon McCann
469d333aa2
docs: use Returns: consistently
...
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
7f6a964c47
Docs: Remove all entities and turn off sgml mode
...
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
e34bd4137d
docs: use apostrophes in *n't
2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3
docs: use proper apostrophe
...
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
0ce016650b
docs: Use markup for links
2014-02-07 09:42:12 -05:00
William Jon McCann
2a45418b67
docs: use proper quotes
2014-02-05 15:08:42 -05:00
William Jon McCann
c3dfb17031
docs: fix missing quotation mark
2014-02-05 15:08:42 -05:00
William Jon McCann
fd7adf3b51
docs: add back id for section heading
...
It was lost during the markdown conversion.
2014-02-05 12:33:39 -05:00
William Jon McCann
b4d4ffcf38
docs: Don't use <xi:include>
2014-02-05 12:32:20 -05:00
William Jon McCann
3b3d8ca456
docs: Use "#" for refsect2 instead of ##
2014-02-04 21:00:58 -05:00
William Jon McCann
76447c3512
docs: use quotes instead of <firstterm>
2014-02-04 18:10:11 -05:00
William Jon McCann
50e06e11ee
docs: use markdown instead of <filename> tags
2014-02-04 16:58:53 -05:00
Matthias Clasen
245c385ae7
Docs: Don't use note elements
...
In most cases, the text itself makes the message clear enough.
2014-02-02 01:22:14 -05:00
Matthias Clasen
09d1b28249
docs: Convert to markdown
...
Specifically, switch to using markdown syntax for sections.
2014-02-02 00:30:27 -05:00
William Jon McCann
768bc44081
docs: use |[ ]| instead of <programlisting></programlisting>
...
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
bf35c77f14
docs: use () instead of <function> tags
2014-01-27 23:08:08 -05:00