AccelLabel: Add get_accel_closure() accessor

Fixes #875
This commit is contained in:
Daniel Boles 2017-08-07 10:38:37 +01:00 committed by Timm Bäder
parent 6f1cade817
commit 3242174f81
3 changed files with 29 additions and 5 deletions

View File

@ -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

View File

@ -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,

View File

@ -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