Add gtk_builder_cscope_add_callback

This is a convenience method for the common case
that symbols are used under their own name.
This commit is contained in:
Matthias Clasen 2022-06-30 16:13:17 -04:00
parent 21b9667f08
commit faa9ef2dc0
2 changed files with 19 additions and 2 deletions

View File

@ -428,6 +428,19 @@ gtk_builder_cscope_new (void)
return g_object_new (GTK_TYPE_BUILDER_CSCOPE, NULL);
}
/**
* gtk_builder_cscope_add_callback:
* @self: a `GtkBuilderCScope`
* @callback_symbols: (scope async): The callback pointer
*
* Adds the @callback_symbol to the scope of @builder under its
* own name.
*
* This is a convenience wrapper of [method@Gtk.BuilderCScope.add_callback_symbol].
*
* Since: 4.8
*/
/**
* gtk_builder_cscope_add_callback_symbol:
* @self: a `GtkBuilderCScope`

View File

@ -115,6 +115,10 @@ void gtk_builder_cscope_add_callback_symbols (GtkBuilderCScop
const char *first_callback_name,
GCallback first_callback_symbol,
...) G_GNUC_NULL_TERMINATED;
#define gtk_builder_cscope_add_callback(scope, callback) \
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), #callback, G_CALLBACK (callback))
GDK_AVAILABLE_IN_ALL
GCallback gtk_builder_cscope_lookup_callback_symbol(GtkBuilderCScope *self,
const char *callback_name);