[gtk/default-handling: 4/18] popover: Add a default-widget property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/default-handling: 4/18] popover: Add a default-widget property
- Date: Sun, 28 Apr 2019 19:32:09 +0000 (UTC)
commit ba14c9cda6e9e99a1cc55321d103f13bfc0a9842
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Apr 28 16:54:02 2019 +0000
popover: Add a default-widget property
This is part of redoing default widget handling.
gtk/gtkpopover.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 43321fc734..c32aace6d9 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -155,6 +155,7 @@ enum {
PROP_POSITION,
PROP_MODAL,
PROP_CONSTRAIN_TO,
+ PROP_DEFAULT_WIDGET,
NUM_PROPERTIES
};
@@ -419,6 +420,10 @@ gtk_popover_set_property (GObject *object,
gtk_popover_set_constrain_to (GTK_POPOVER (object),
g_value_get_enum (value));
break;
+ case PROP_DEFAULT_WIDGET:
+ gtk_popover_set_default_widget (GTK_POPOVER (object),
+ g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -449,6 +454,9 @@ gtk_popover_get_property (GObject *object,
case PROP_CONSTRAIN_TO:
g_value_set_enum (value, priv->constraint);
break;
+ case PROP_DEFAULT_WIDGET:
+ g_value_set_object (value, priv->default_widget);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -1645,6 +1653,13 @@ gtk_popover_class_init (GtkPopoverClass *klass)
GTK_TYPE_POPOVER_CONSTRAINT, GTK_POPOVER_CONSTRAINT_WINDOW,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+ properties[PROP_DEFAULT_WIDGET] =
+ g_param_spec_object ("default-widget",
+ P_("Default widget"),
+ P_("The default widget"),
+ GTK_TYPE_WIDGET,
+ GTK_PARAM_READWRITE|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
+
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
/**
@@ -2393,6 +2408,8 @@ gtk_popover_set_default_widget (GtkPopover *popover,
if (gtk_widget_get_mapped (GTK_WIDGET (popover)))
gtk_window_set_default_widget (priv->window, priv->default_widget);
+
+ g_object_notify_by_pspec (G_OBJECT (popover), properties[PROP_DEFAULT_WIDGET]);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]