[gtk: 20/23] AccelLabel: Add get_accel_closure() accessor
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 20/23] AccelLabel: Add get_accel_closure() accessor
- Date: Sun, 11 Aug 2019 08:44:49 +0000 (UTC)
commit 3242174f813cf2b13f5e78233431ceef0d726347
Author: Daniel Boles <dboles src gnome org>
Date: Mon Aug 7 10:38:37 2017 +0100
AccelLabel: Add get_accel_closure() accessor
Fixes #875
docs/reference/gtk/gtk4-sections.txt | 1 +
gtk/gtkaccellabel.c | 23 ++++++++++++++++++++++-
gtk/gtkaccellabel.h | 10 ++++++----
3 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 1159248bff..b72906d7ab 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -136,6 +136,7 @@ gtk_accel_map_get_type
GtkAccelLabel
gtk_accel_label_new
gtk_accel_label_set_accel_closure
+gtk_accel_label_get_accel_closure
gtk_accel_label_get_accel_widget
gtk_accel_label_set_accel_widget
gtk_accel_label_get_accel_width
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 938602c840..0906d7e76f 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -373,7 +373,8 @@ gtk_accel_label_finalize (GObject *object)
* Fetches the widget monitored by this accelerator label. See
* gtk_accel_label_set_accel_widget().
*
- * Returns: (nullable) (transfer none): the object monitored by the accelerator label, or %NULL.
+ * Returns: (nullable) (transfer none): the widget monitored by @accel_label,
+ * or %NULL if it is not monitoring a widget.
**/
GtkWidget *
gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label)
@@ -561,6 +562,26 @@ gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label,
}
}
+/**
+ * gtk_accel_label_get_accel_closure:
+ * @accel_label: a #GtkAccelLabel
+ *
+ * Fetches the closure monitored by this accelerator label. See
+ * gtk_accel_label_set_accel_closure().
+ *
+ * Returns: (nullable) (transfer none): the closure monitored by @accel_label,
+ * or %NULL if it is not monitoring a closure.
+ */
+GClosure *
+gtk_accel_label_get_accel_closure (GtkAccelLabel *accel_label)
+{
+ GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label);
+
+ g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), NULL);
+
+ return priv->accel_closure;
+}
+
static gboolean
find_accel (GtkAccelKey *key,
GClosure *closure,
diff --git a/gtk/gtkaccellabel.h b/gtk/gtkaccellabel.h
index 3c5c67e90f..a5e63559f1 100644
--- a/gtk/gtkaccellabel.h
+++ b/gtk/gtkaccellabel.h
@@ -44,17 +44,19 @@ typedef struct _GtkAccelLabel GtkAccelLabel;
GDK_AVAILABLE_IN_ALL
GType gtk_accel_label_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_accel_label_new (const gchar *string);
+GtkWidget *gtk_accel_label_new (const gchar *string);
GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label);
+GtkWidget *gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label);
GDK_AVAILABLE_IN_ALL
guint gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label);
GDK_AVAILABLE_IN_ALL
void gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label,
GtkWidget *accel_widget);
GDK_AVAILABLE_IN_ALL
-void gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label,
- GClosure *accel_closure);
+void gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label,
+ GClosure *accel_closure);
+GDK_AVAILABLE_IN_ALL
+GClosure * gtk_accel_label_get_accel_closure (GtkAccelLabel *accel_label);
GDK_AVAILABLE_IN_ALL
gboolean gtk_accel_label_refetch (GtkAccelLabel *accel_label);
GDK_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]