API: sizegroup: Remove gtk_size_group_set_ignore_hidden()

This commit is contained in:
Benjamin Otte 2016-10-09 15:53:22 +02:00
parent 1d4f23da8e
commit cda617df4d
8 changed files with 2 additions and 151 deletions

View File

@ -3086,8 +3086,6 @@ GtkSizeGroupMode
gtk_size_group_new
gtk_size_group_set_mode
gtk_size_group_get_mode
gtk_size_group_set_ignore_hidden
gtk_size_group_get_ignore_hidden
gtk_size_group_add_widget
gtk_size_group_remove_widget
gtk_size_group_get_widgets

View File

@ -650,15 +650,9 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
gtk_widget_show (column);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_size_group_set_ignore_hidden (group, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_set_data_full (G_OBJECT (column), "accel-size-group", group, g_object_unref);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_size_group_set_ignore_hidden (group, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_set_data_full (G_OBJECT (column), "title-size-group", group, g_object_unref);
if (n_columns % 2 == 0)
@ -703,14 +697,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_show (column);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_size_group_set_ignore_hidden (group, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_set_data_full (G_OBJECT (column), "accel-size-group", group, g_object_unref);
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_size_group_set_ignore_hidden (group, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_set_data_full (G_OBJECT (column), "title-size-group", group, g_object_unref);
gtk_container_add (GTK_CONTAINER (current_page), column);

View File

@ -108,14 +108,11 @@ struct _GtkSizeGroupPrivate
GSList *widgets;
guint8 mode;
guint ignore_hidden : 1;
};
enum {
PROP_0,
PROP_MODE,
PROP_IGNORE_HIDDEN
PROP_MODE
};
static void gtk_size_group_set_property (GObject *object,
@ -157,13 +154,11 @@ add_widget_to_closure (GHashTable *widgets,
gint orientation)
{
GSList *tmp_groups, *tmp_widgets;
gboolean hidden;
if (g_hash_table_lookup (widgets, widget))
return;
g_hash_table_add (widgets, widget);
hidden = !gtk_widget_is_visible (widget);
for (tmp_groups = _gtk_widget_get_sizegroups (widget); tmp_groups; tmp_groups = tmp_groups->next)
{
@ -173,9 +168,6 @@ add_widget_to_closure (GHashTable *widgets,
if (g_hash_table_lookup (groups, tmp_group))
continue;
if (tmp_priv->ignore_hidden && hidden)
continue;
if (orientation >= 0 && !(tmp_priv->mode & (1 << orientation)))
continue;
@ -231,30 +223,6 @@ gtk_size_group_class_init (GtkSizeGroupClass *klass)
GTK_TYPE_SIZE_GROUP_MODE,
GTK_SIZE_GROUP_HORIZONTAL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkSizeGroup:ignore-hidden:
*
* If %TRUE, unmapped widgets are ignored when determining
* the size of the group.
*
* Since: 2.8
*
* Deprecated: 3.22: Measuring the size of hidden widgets has not worked
* reliably for a long time. In most cases, they will report a size
* of 0 nowadays, and thus, their size will not affect the other
* size group members. In effect, size groups will always operate
* as if this property was %TRUE. Use a #GtkStack instead to hide
* widgets while still having their size taken into account.
*/
g_object_class_install_property (gobject_class,
PROP_IGNORE_HIDDEN,
g_param_spec_boolean ("ignore-hidden",
P_("Ignore hidden"),
P_("If TRUE, unmapped widgets are ignored "
"when determining the size of the group"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED));
}
static void
@ -267,7 +235,6 @@ gtk_size_group_init (GtkSizeGroup *size_group)
priv->widgets = NULL;
priv->mode = GTK_SIZE_GROUP_HORIZONTAL;
priv->ignore_hidden = FALSE;
}
static void
@ -290,11 +257,6 @@ gtk_size_group_set_property (GObject *object,
case PROP_MODE:
gtk_size_group_set_mode (size_group, g_value_get_enum (value));
break;
case PROP_IGNORE_HIDDEN:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_size_group_set_ignore_hidden (size_group, g_value_get_boolean (value));
G_GNUC_END_IGNORE_DEPRECATIONS
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -315,9 +277,6 @@ gtk_size_group_get_property (GObject *object,
case PROP_MODE:
g_value_set_enum (value, priv->mode);
break;
case PROP_IGNORE_HIDDEN:
g_value_set_boolean (value, priv->ignore_hidden);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -393,69 +352,6 @@ gtk_size_group_get_mode (GtkSizeGroup *size_group)
return size_group->priv->mode;
}
/**
* gtk_size_group_set_ignore_hidden:
* @size_group: a #GtkSizeGroup
* @ignore_hidden: whether unmapped widgets should be ignored
* when calculating the size
*
* Sets whether unmapped widgets should be ignored when
* calculating the size.
*
* Since: 2.8
*
* Deprecated: 3.22: Measuring the size of hidden widgets has not worked
* reliably for a long time. In most cases, they will report a size
* of 0 nowadays, and thus, their size will not affect the other
* size group members. In effect, size groups will always operate
* as if this property was %TRUE. Use a #GtkStack instead to hide
* widgets while still having their size taken into account.
*/
void
gtk_size_group_set_ignore_hidden (GtkSizeGroup *size_group,
gboolean ignore_hidden)
{
GtkSizeGroupPrivate *priv;
g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
priv = size_group->priv;
ignore_hidden = ignore_hidden != FALSE;
if (priv->ignore_hidden != ignore_hidden)
{
priv->ignore_hidden = ignore_hidden;
g_object_notify (G_OBJECT (size_group), "ignore-hidden");
}
}
/**
* gtk_size_group_get_ignore_hidden:
* @size_group: a #GtkSizeGroup
*
* Returns if invisible widgets are ignored when calculating the size.
*
* Returns: %TRUE if invisible widgets are ignored.
*
* Since: 2.8
*
* Deprecated: 3.22: Measuring the size of hidden widgets has not worked
* reliably for a long time. In most cases, they will report a size
* of 0 nowadays, and thus, their size will not affect the other
* size group members. In effect, size groups will always operate
* as if this property was %TRUE. Use a #GtkStack instead to hide
* widgets while still having their size taken into account.
*/
gboolean
gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group)
{
g_return_val_if_fail (GTK_IS_SIZE_GROUP (size_group), FALSE);
return size_group->priv->ignore_hidden;
}
/**
* gtk_size_group_add_widget:
* @size_group: a #GtkSizeGroup

View File

@ -68,11 +68,6 @@ void gtk_size_group_set_mode (GtkSizeGroup *size_group,
GtkSizeGroupMode mode);
GDK_AVAILABLE_IN_ALL
GtkSizeGroupMode gtk_size_group_get_mode (GtkSizeGroup *size_group);
GDK_DEPRECATED_IN_3_22
void gtk_size_group_set_ignore_hidden (GtkSizeGroup *size_group,
gboolean ignore_hidden);
GDK_DEPRECATED_IN_3_22
gboolean gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group);
GDK_AVAILABLE_IN_ALL
void gtk_size_group_add_widget (GtkSizeGroup *size_group,
GtkWidget *widget);

View File

@ -5260,12 +5260,6 @@ gtk_widget_queue_resize_internal (GtkWidget *widget)
for (l = groups; l; l = l->next)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (gtk_size_group_get_ignore_hidden (l->data) && !gtk_widget_is_visible (widget))
continue;
G_GNUC_END_IGNORE_DEPRECATIONS
for (widgets = gtk_size_group_get_widgets (l->data); widgets; widgets = widgets->next)
{
gtk_widget_queue_resize_internal (widgets->data);

View File

@ -208,7 +208,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
GtkSizeGroup *group)
{
GtkWidget *frame, *box, *box2;
GtkWidget *label, *sw, *combo;
GtkWidget *label, *combo;
GSList *widgets, *l;
GtkWidget *listbox;
@ -221,24 +221,6 @@ add_size_group (GtkInspectorSizeGroups *sl,
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (box), box2);
label = gtk_label_new (_("Ignore hidden"));
g_object_set (label, "margin", 10, NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (box2), label, TRUE, TRUE);
sw = gtk_switch_new ();
g_object_set (sw, "margin", 10, NULL);
gtk_widget_set_halign (sw, GTK_ALIGN_END);
gtk_widget_set_valign (sw, GTK_ALIGN_BASELINE);
g_object_bind_property (group, "ignore-hidden",
sw, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_box_pack_start (GTK_BOX (box2), sw, FALSE, FALSE);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (box), box2);
label = gtk_label_new (_("Mode"));
g_object_set (label, "margin", 10, NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START);

View File

@ -51,7 +51,6 @@
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<property name="mode">both</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="label1" />
<widget name="label2" />

View File

@ -281,7 +281,6 @@ For example, "Work" or "Personal".</property>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<property name="mode">horizontal</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="label4" />
<widget name="label6" />