mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
Make widget property setters behave
We want to allow setting a property to its current value, while still having a precondition for widget->parent being NULL otherwise.
This commit is contained in:
parent
2650c4e974
commit
577195a243
@ -3033,7 +3033,7 @@ gtk_combo_box_set_child (GtkComboBox *combo_box,
|
|||||||
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
|
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (priv->child)
|
if (priv->child)
|
||||||
gtk_combo_box_remove (combo_box, priv->child);
|
gtk_combo_box_remove (combo_box, priv->child);
|
||||||
|
@ -640,7 +640,7 @@ gtk_aspect_frame_set_child (GtkAspectFrame *self,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_ASPECT_FRAME (self));
|
g_return_if_fail (GTK_IS_ASPECT_FRAME (self));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || self->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (self->child == child)
|
if (self->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -1034,7 +1034,10 @@ gtk_button_set_child (GtkButton *button,
|
|||||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BUTTON (button));
|
g_return_if_fail (GTK_IS_BUTTON (button));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (priv->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||||
|
|
||||||
|
@ -332,6 +332,12 @@ gtk_center_box_set_start_widget (GtkCenterBox *self,
|
|||||||
{
|
{
|
||||||
GtkLayoutManager *layout_manager;
|
GtkLayoutManager *layout_manager;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_CENTER_BOX (self));
|
||||||
|
g_return_if_fail (child == NULL || self->start_widget == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (self->start_widget == child)
|
||||||
|
return;
|
||||||
|
|
||||||
if (self->start_widget)
|
if (self->start_widget)
|
||||||
gtk_widget_unparent (self->start_widget);
|
gtk_widget_unparent (self->start_widget);
|
||||||
|
|
||||||
@ -360,6 +366,12 @@ gtk_center_box_set_center_widget (GtkCenterBox *self,
|
|||||||
{
|
{
|
||||||
GtkLayoutManager *layout_manager;
|
GtkLayoutManager *layout_manager;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_CENTER_BOX (self));
|
||||||
|
g_return_if_fail (child == NULL || self->center_widget == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (self->center_widget == child)
|
||||||
|
return;
|
||||||
|
|
||||||
if (self->center_widget)
|
if (self->center_widget)
|
||||||
gtk_widget_unparent (self->center_widget);
|
gtk_widget_unparent (self->center_widget);
|
||||||
|
|
||||||
@ -388,6 +400,12 @@ gtk_center_box_set_end_widget (GtkCenterBox *self,
|
|||||||
{
|
{
|
||||||
GtkLayoutManager *layout_manager;
|
GtkLayoutManager *layout_manager;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_CENTER_BOX (self));
|
||||||
|
g_return_if_fail (child == NULL || self->end_widget == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (self->end_widget == child)
|
||||||
|
return;
|
||||||
|
|
||||||
if (self->end_widget)
|
if (self->end_widget)
|
||||||
gtk_widget_unparent (self->end_widget);
|
gtk_widget_unparent (self->end_widget);
|
||||||
|
|
||||||
|
@ -1129,8 +1129,13 @@ void
|
|||||||
gtk_check_button_set_child (GtkCheckButton *button,
|
gtk_check_button_set_child (GtkCheckButton *button,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
|
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (button);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
|
g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (priv->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (button));
|
g_object_freeze_notify (G_OBJECT (button));
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ gtk_drag_icon_set_child (GtkDragIcon *self,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_DRAG_ICON (self));
|
g_return_if_fail (GTK_IS_DRAG_ICON (self));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (self->child == child)
|
if (self->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -361,7 +361,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
|||||||
PROP_LABEL_WIDGET,
|
PROP_LABEL_WIDGET,
|
||||||
g_param_spec_object ("label-widget", NULL, NULL,
|
g_param_spec_object ("label-widget", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkExpander:resize-toplevel: (attributes org.gtk.Property.get=gtk_expander_get_resize_toplevel org.gtk.Property.set=gtk_expander_set_resize_toplevel)
|
* GtkExpander:resize-toplevel: (attributes org.gtk.Property.get=gtk_expander_get_resize_toplevel org.gtk.Property.set=gtk_expander_set_resize_toplevel)
|
||||||
@ -384,7 +384,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
|||||||
PROP_CHILD,
|
PROP_CHILD,
|
||||||
g_param_spec_object ("child", NULL, NULL,
|
g_param_spec_object ("child", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkExpander::activate:
|
* GtkExpander::activate:
|
||||||
@ -1091,8 +1091,7 @@ gtk_expander_set_label_widget (GtkExpander *expander,
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||||
g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget));
|
g_return_if_fail (label_widget == NULL || expander->label_widget == label_widget || gtk_widget_get_parent (label_widget) == NULL);
|
||||||
g_return_if_fail (label_widget == NULL || gtk_widget_get_parent (label_widget) == NULL);
|
|
||||||
|
|
||||||
if (expander->label_widget == label_widget)
|
if (expander->label_widget == label_widget)
|
||||||
return;
|
return;
|
||||||
@ -1185,7 +1184,7 @@ gtk_expander_set_child (GtkExpander *expander,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || expander->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (expander->child == child)
|
if (expander->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -597,6 +597,12 @@ gtk_flow_box_child_set_child (GtkFlowBoxChild *self,
|
|||||||
{
|
{
|
||||||
GtkFlowBoxChildPrivate *priv = CHILD_PRIV (self);
|
GtkFlowBoxChildPrivate *priv = CHILD_PRIV (self);
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_FLOW_BOX_CHILD (self));
|
||||||
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (priv->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||||
|
|
||||||
priv->child = child;
|
priv->child = child;
|
||||||
|
@ -188,7 +188,7 @@ gtk_frame_class_init (GtkFrameClass *class)
|
|||||||
frame_props[PROP_LABEL_WIDGET] =
|
frame_props[PROP_LABEL_WIDGET] =
|
||||||
g_param_spec_object ("label-widget", NULL, NULL,
|
g_param_spec_object ("label-widget", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE);
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkFrame:child: (attributes org.gtk.Property.get=gtk_frame_get_child org.gtk.Property.set=gtk_frame_set_child)
|
* GtkFrame:child: (attributes org.gtk.Property.get=gtk_frame_get_child org.gtk.Property.set=gtk_frame_set_child)
|
||||||
@ -198,7 +198,7 @@ gtk_frame_class_init (GtkFrameClass *class)
|
|||||||
frame_props[PROP_CHILD] =
|
frame_props[PROP_CHILD] =
|
||||||
g_param_spec_object ("child", NULL, NULL,
|
g_param_spec_object ("child", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE);
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class, LAST_PROP, frame_props);
|
g_object_class_install_properties (gobject_class, LAST_PROP, frame_props);
|
||||||
|
|
||||||
@ -408,8 +408,7 @@ gtk_frame_set_label_widget (GtkFrame *frame,
|
|||||||
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_FRAME (frame));
|
g_return_if_fail (GTK_IS_FRAME (frame));
|
||||||
g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget));
|
g_return_if_fail (label_widget == NULL || priv->label_widget == label_widget || gtk_widget_get_parent (label_widget) == NULL);
|
||||||
g_return_if_fail (label_widget == NULL || gtk_widget_get_parent (label_widget) == NULL);
|
|
||||||
|
|
||||||
if (priv->label_widget == label_widget)
|
if (priv->label_widget == label_widget)
|
||||||
return;
|
return;
|
||||||
@ -669,7 +668,7 @@ gtk_frame_set_child (GtkFrame *frame,
|
|||||||
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_FRAME (frame));
|
g_return_if_fail (GTK_IS_FRAME (frame));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (priv->child == child)
|
if (priv->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -300,8 +300,7 @@ gtk_header_bar_set_title_widget (GtkHeaderBar *bar,
|
|||||||
GtkWidget *title_widget)
|
GtkWidget *title_widget)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_HEADER_BAR (bar));
|
g_return_if_fail (GTK_IS_HEADER_BAR (bar));
|
||||||
if (title_widget)
|
g_return_if_fail (title_widget == NULL || bar->title_widget == title_widget || gtk_widget_get_parent (title_widget) == NULL);
|
||||||
g_return_if_fail (GTK_IS_WIDGET (title_widget));
|
|
||||||
|
|
||||||
/* No need to do anything if the title widget stays the same */
|
/* No need to do anything if the title widget stays the same */
|
||||||
if (bar->title_widget == title_widget)
|
if (bar->title_widget == title_widget)
|
||||||
@ -564,7 +563,7 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
|
|||||||
header_bar_props[PROP_TITLE_WIDGET] =
|
header_bar_props[PROP_TITLE_WIDGET] =
|
||||||
g_param_spec_object ("title-widget", NULL, NULL,
|
g_param_spec_object ("title-widget", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkHeaderBar:show-title-buttons: (attributes org.gtk.Property.get=gtk_header_bar_get_show_title_buttons org.gtk.Property.set=gtk_header_bar_set_show_title_buttons)
|
* GtkHeaderBar:show-title-buttons: (attributes org.gtk.Property.get=gtk_header_bar_get_show_title_buttons org.gtk.Property.set=gtk_header_bar_set_show_title_buttons)
|
||||||
|
@ -2489,7 +2489,7 @@ gtk_label_class_init (GtkLabelClass *class)
|
|||||||
label_props[PROP_MNEMONIC_WIDGET] =
|
label_props[PROP_MNEMONIC_WIDGET] =
|
||||||
g_param_spec_object ("mnemonic-widget", NULL, NULL,
|
g_param_spec_object ("mnemonic-widget", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE);
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkLabel:ellipsize: (attributes org.gtk.Property.get=gtk_label_get_ellipsize org.gtk.Property.set=gtk_label_set_ellipsize)
|
* GtkLabel:ellipsize: (attributes org.gtk.Property.get=gtk_label_get_ellipsize org.gtk.Property.set=gtk_label_set_ellipsize)
|
||||||
@ -2980,9 +2980,10 @@ gtk_label_set_mnemonic_widget (GtkLabel *self,
|
|||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_LABEL (self));
|
g_return_if_fail (GTK_IS_LABEL (self));
|
||||||
|
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (widget)
|
if (self->mnemonic_widget == widget)
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
return;
|
||||||
|
|
||||||
if (self->mnemonic_widget)
|
if (self->mnemonic_widget)
|
||||||
{
|
{
|
||||||
|
@ -2956,6 +2956,12 @@ gtk_list_box_row_set_child (GtkListBoxRow *row,
|
|||||||
{
|
{
|
||||||
GtkListBoxRowPrivate *priv = ROW_PRIV (row);
|
GtkListBoxRowPrivate *priv = ROW_PRIV (row);
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
|
||||||
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (priv->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||||
|
|
||||||
priv->child = child;
|
priv->child = child;
|
||||||
|
@ -304,7 +304,7 @@ gtk_list_item_set_child (GtkListItem *self,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_LIST_ITEM (self));
|
g_return_if_fail (GTK_IS_LIST_ITEM (self));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (self->child == child)
|
if (self->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -1472,7 +1472,10 @@ gtk_menu_button_set_child (GtkMenuButton *menu_button,
|
|||||||
GtkWidget *box, *arrow;
|
GtkWidget *box, *arrow;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || menu_button->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (menu_button->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (menu_button));
|
g_object_freeze_notify (G_OBJECT (menu_button));
|
||||||
|
|
||||||
@ -1487,7 +1490,8 @@ gtk_menu_button_set_child (GtkMenuButton *menu_button,
|
|||||||
arrow = gtk_builtin_icon_new ("arrow");
|
arrow = gtk_builtin_icon_new ("arrow");
|
||||||
menu_button->arrow_widget = arrow;
|
menu_button->arrow_widget = arrow;
|
||||||
|
|
||||||
gtk_box_append (GTK_BOX (box), child);
|
if (child)
|
||||||
|
gtk_box_append (GTK_BOX (box), child);
|
||||||
gtk_box_append (GTK_BOX (box), arrow);
|
gtk_box_append (GTK_BOX (box), arrow);
|
||||||
gtk_button_set_child (GTK_BUTTON (menu_button->button), box);
|
gtk_button_set_child (GTK_BUTTON (menu_button->button), box);
|
||||||
|
|
||||||
|
@ -570,7 +570,10 @@ gtk_overlay_set_child (GtkOverlay *overlay,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_OVERLAY (overlay));
|
g_return_if_fail (GTK_IS_OVERLAY (overlay));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || overlay->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (overlay->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&overlay->child, gtk_widget_unparent);
|
g_clear_pointer (&overlay->child, gtk_widget_unparent);
|
||||||
|
|
||||||
|
@ -1574,11 +1574,14 @@ gtk_paned_new (GtkOrientation orientation)
|
|||||||
* If @child is `NULL`, the existing child will be removed.
|
* If @child is `NULL`, the existing child will be removed.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_paned_set_start_child (GtkPaned *paned,
|
gtk_paned_set_start_child (GtkPaned *paned,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_PANED (paned));
|
g_return_if_fail (GTK_IS_PANED (paned));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || paned->start_child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (paned->start_child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&paned->start_child, gtk_widget_unparent);
|
g_clear_pointer (&paned->start_child, gtk_widget_unparent);
|
||||||
|
|
||||||
@ -1691,11 +1694,14 @@ gtk_paned_get_shrink_start_child (GtkPaned *paned)
|
|||||||
* If @child is `NULL`, the existing child will be removed.
|
* If @child is `NULL`, the existing child will be removed.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_paned_set_end_child (GtkPaned *paned,
|
gtk_paned_set_end_child (GtkPaned *paned,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_PANED (paned));
|
g_return_if_fail (GTK_IS_PANED (paned));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || paned->end_child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (paned->end_child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&paned->end_child, gtk_widget_unparent);
|
g_clear_pointer (&paned->end_child, gtk_widget_unparent);
|
||||||
|
|
||||||
|
@ -2009,7 +2009,7 @@ gtk_popover_set_child (GtkPopover *popover,
|
|||||||
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_POPOVER (popover));
|
g_return_if_fail (GTK_IS_POPOVER (popover));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (priv->child == child)
|
if (priv->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -864,7 +864,10 @@ gtk_revealer_set_child (GtkRevealer *revealer,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_REVEALER (revealer));
|
g_return_if_fail (GTK_IS_REVEALER (revealer));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || revealer->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (revealer->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&revealer->child, gtk_widget_unparent);
|
g_clear_pointer (&revealer->child, gtk_widget_unparent);
|
||||||
|
|
||||||
|
@ -4190,6 +4190,14 @@ gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window,
|
|||||||
GtkWidget *scrollable_child;
|
GtkWidget *scrollable_child;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||||
|
g_return_if_fail (child == NULL ||
|
||||||
|
priv->child == child ||
|
||||||
|
(priv->auto_added_viewport && gtk_viewport_get_child (GTK_VIEWPORT (priv->child)) == child) ||
|
||||||
|
gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (priv->child == child ||
|
||||||
|
(priv->auto_added_viewport && gtk_viewport_get_child (GTK_VIEWPORT (priv->child)) == child))
|
||||||
|
return;
|
||||||
|
|
||||||
if (priv->child)
|
if (priv->child)
|
||||||
{
|
{
|
||||||
|
@ -675,6 +675,12 @@ void
|
|||||||
gtk_search_bar_set_child (GtkSearchBar *bar,
|
gtk_search_bar_set_child (GtkSearchBar *bar,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (GTK_IS_SEARCH_BAR (bar));
|
||||||
|
g_return_if_fail (child == NULL || bar->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (bar->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
if (bar->child)
|
if (bar->child)
|
||||||
{
|
{
|
||||||
if (GTK_IS_EDITABLE (bar->child))
|
if (GTK_IS_EDITABLE (bar->child))
|
||||||
|
@ -782,7 +782,7 @@ gtk_tree_expander_set_child (GtkTreeExpander *self,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_TREE_EXPANDER (self));
|
g_return_if_fail (GTK_IS_TREE_EXPANDER (self));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || self->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (self->child == child)
|
if (self->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -331,7 +331,7 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
|||||||
PROP_CHILD,
|
PROP_CHILD,
|
||||||
g_param_spec_object ("child", NULL, NULL,
|
g_param_spec_object ("child", NULL, NULL,
|
||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
gtk_widget_class_set_css_name (widget_class, I_("viewport"));
|
gtk_widget_class_set_css_name (widget_class, I_("viewport"));
|
||||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
|
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
|
||||||
@ -686,7 +686,7 @@ gtk_viewport_set_child (GtkViewport *viewport,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || viewport->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (viewport->child == child)
|
if (viewport->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -6628,7 +6628,10 @@ gtk_window_set_child (GtkWindow *window,
|
|||||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || priv->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
|
if (priv->child == child)
|
||||||
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ gtk_window_handle_set_child (GtkWindowHandle *self,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_WINDOW_HANDLE (self));
|
g_return_if_fail (GTK_IS_WINDOW_HANDLE (self));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || self->child == child || gtk_widget_get_parent (child) == NULL);
|
||||||
|
|
||||||
if (self->child == child)
|
if (self->child == child)
|
||||||
return;
|
return;
|
||||||
|
@ -357,6 +357,12 @@ check_property (GObject *instance, GParamSpec *pspec)
|
|||||||
g_object_set (instance, pspec->name, value, NULL);
|
g_object_set (instance, pspec->name, value, NULL);
|
||||||
assert_notifies (instance, pspec->name, data.count, 1);
|
assert_notifies (instance, pspec->name, data.count, 1);
|
||||||
|
|
||||||
|
g_object_set (instance, pspec->name, value, NULL);
|
||||||
|
assert_notifies (instance, pspec->name, data.count, 1);
|
||||||
|
|
||||||
|
g_object_set (instance, pspec->name, NULL, NULL);
|
||||||
|
assert_notifies (instance, pspec->name, data.count, 2);
|
||||||
|
|
||||||
g_signal_handler_disconnect (instance, id);
|
g_signal_handler_disconnect (instance, id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -659,25 +665,29 @@ test_type (gconstpointer data)
|
|||||||
g_str_equal (pspec->name, "expanded"))
|
g_str_equal (pspec->name, "expanded"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* can't select items without an underlying, populated model */
|
/* can't select items without an underlying, populated model */
|
||||||
if (g_type_is_a (type, GTK_TYPE_SINGLE_SELECTION) &&
|
if (g_type_is_a (type, GTK_TYPE_SINGLE_SELECTION) &&
|
||||||
(g_str_equal (pspec->name, "selected") ||
|
(g_str_equal (pspec->name, "selected") ||
|
||||||
g_str_equal (pspec->name, "selected-item")))
|
g_str_equal (pspec->name, "selected-item")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* can't select items without an underlying, populated model */
|
/* can't select items without an underlying, populated model */
|
||||||
if (g_type_is_a (type, GTK_TYPE_DROP_DOWN) &&
|
if (g_type_is_a (type, GTK_TYPE_DROP_DOWN) &&
|
||||||
g_str_equal (pspec->name, "selected"))
|
g_str_equal (pspec->name, "selected"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* can't set position without a notebook */
|
/* can't set position without a notebook */
|
||||||
if (g_type_is_a (type, GTK_TYPE_NOTEBOOK_PAGE) &&
|
if (g_type_is_a (type, GTK_TYPE_NOTEBOOK_PAGE) &&
|
||||||
g_str_equal (pspec->name, "position"))
|
g_str_equal (pspec->name, "position"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* This one is special */
|
/* This one is special */
|
||||||
if (g_str_equal (pspec->name, "focus-widget"))
|
if (g_str_equal (pspec->name, "focus-widget"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (pspec->owner_type == GTK_TYPE_TREE_VIEW_COLUMN &&
|
||||||
|
g_str_equal (pspec->name, "widget"))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (g_test_verbose ())
|
if (g_test_verbose ())
|
||||||
g_print ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
|
g_print ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user