summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-06-30 16:13:17 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-06-30 16:13:55 -0400
commit3200efcbde73d3236188413bca3c91af94a39c39 (patch)
tree978507be6f3103e5eee5603dd85712f8e63f8f56
parent092fe2f712bb0d2e99f87b0e451e6021bffdfdb9 (diff)
downloadgtk+-builder-cscope-add.tar.gz
Add gtk_builder_cscope_add_callbackbuilder-cscope-add
This is a convenience method for the common case that symbols are used under their own name.
-rw-r--r--gtk/gtkbuilderscope.c13
-rw-r--r--gtk/gtkbuilderscope.h8
2 files changed, 19 insertions, 2 deletions
diff --git a/gtk/gtkbuilderscope.c b/gtk/gtkbuilderscope.c
index f5503c8b11..e9da61827a 100644
--- a/gtk/gtkbuilderscope.c
+++ b/gtk/gtkbuilderscope.c
@@ -429,6 +429,19 @@ gtk_builder_cscope_new (void)
}
/**
+ * 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.BuilderCSope.add_callback_symbol].
+ *
+ * Since: 4.8
+ */
+
+/**
* gtk_builder_cscope_add_callback_symbol:
* @self: a `GtkBuilderCScope`
* @callback_name: The name of the callback, as expected in the XML
diff --git a/gtk/gtkbuilderscope.h b/gtk/gtkbuilderscope.h
index 7fc2ccbc0b..5ab602fc06 100644
--- a/gtk/gtkbuilderscope.h
+++ b/gtk/gtkbuilderscope.h
@@ -114,10 +114,14 @@ GDK_AVAILABLE_IN_ALL
void gtk_builder_cscope_add_callback_symbols (GtkBuilderCScope *self,
const char *first_callback_name,
GCallback first_callback_symbol,
- ...) G_GNUC_NULL_TERMINATED;
+ ...) 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);
+ const char *callback_name);
G_END_DECLS