[libadwaita/wip/cdavis/remove-leaflet-homogeneous-props] leaflet: Remove {v, h}homogeneous-* properties
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/cdavis/remove-leaflet-homogeneous-props] leaflet: Remove {v, h}homogeneous-* properties
- Date: Wed, 8 Sep 2021 02:46:23 +0000 (UTC)
commit e59a74dd890a1b4da577a7b827c4d66961f8884f
Author: Christopher Davis <christopherdavis gnome org>
Date: Tue Sep 7 19:44:39 2021 -0700
leaflet: Remove {v,h}homogeneous-* properties
These properties are largely unused, and the defaults are
sensible. The *-unfolded properties can be replaced by using GtkSizeGroup.
Closes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/74
Closes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/75
doc/migrating-libhandy-1-4-to-libadwaita.md | 5 +
src/adw-leaflet.c | 178 +---------------------------
2 files changed, 8 insertions(+), 175 deletions(-)
---
diff --git a/doc/migrating-libhandy-1-4-to-libadwaita.md b/doc/migrating-libhandy-1-4-to-libadwaita.md
index 8d826c66..6439e64f 100644
--- a/doc/migrating-libhandy-1-4-to-libadwaita.md
+++ b/doc/migrating-libhandy-1-4-to-libadwaita.md
@@ -244,6 +244,11 @@ page objects, similarly to [class@Gtk.Stack]. For example,
[method@Adw.SqueezerPage.set_enabled] should be used to replace
`hdy_squeezer_set_child_enabled()`.
+The `hhomogeneous-folded`, `vhomogeneous-folded`, `hhomogeneous-unfolded`,
+and `vhomogeneous-unfolded` properties have been removed from [class@Adw.Leaflet].
+Use [class@Gtk.SizezGroup] replicate the functionality of `hhomogeneous-unfolded`
+and `vhomogeneous-unfolded`.
+
### Adapt to view switcher API Changes
[class@Adw.ViewSwitcher], [class@Adw.ViewSwitcherBar] and
diff --git a/src/adw-leaflet.c b/src/adw-leaflet.c
index 07e09a07..06b4e1fa 100644
--- a/src/adw-leaflet.c
+++ b/src/adw-leaflet.c
@@ -70,10 +70,6 @@ enum {
PROP_0,
PROP_FOLDED,
PROP_FOLD_THRESHOLD_POLICY,
- PROP_HHOMOGENEOUS_FOLDED,
- PROP_VHOMOGENEOUS_FOLDED,
- PROP_HHOMOGENEOUS_UNFOLDED,
- PROP_VHOMOGENEOUS_UNFOLDED,
PROP_VISIBLE_CHILD,
PROP_VISIBLE_CHILD_NAME,
PROP_TRANSITION_TYPE,
@@ -194,11 +190,6 @@ struct _AdwLeaflet {
static GParamSpec *props[LAST_PROP];
-static int HOMOGENEOUS_PROP[ADW_FOLD_MAX][GTK_ORIENTATION_MAX] = {
- { PROP_HHOMOGENEOUS_UNFOLDED, PROP_VHOMOGENEOUS_UNFOLDED},
- { PROP_HHOMOGENEOUS_FOLDED, PROP_VHOMOGENEOUS_FOLDED},
-};
-
static void adw_leaflet_buildable_init (GtkBuildableIface *iface);
static void adw_leaflet_swipeable_init (AdwSwipeableInterface *iface);
@@ -1007,8 +998,6 @@ static void
get_preferred_size (int *min,
int *nat,
gboolean same_orientation,
- gboolean homogeneous_folded,
- gboolean homogeneous_unfolded,
int visible_children,
double visible_child_progress,
int sum_nat,
@@ -1018,17 +1007,11 @@ get_preferred_size (int *min,
int last_visible_min)
{
if (same_orientation) {
- *min = homogeneous_folded ?
- max_min :
- adw_lerp (last_visible_min, visible_min, visible_child_progress);
- *nat = homogeneous_unfolded ?
- max_nat * visible_children :
- sum_nat;
+ *min = max_min;
+ *nat = max_nat * visible_children;
}
else {
- *min = homogeneous_folded ?
- max_min :
- adw_lerp (last_visible_min, visible_min, visible_child_progress);
+ *min = max_min;
*nat = max_nat;
}
}
@@ -1835,8 +1818,6 @@ adw_leaflet_measure (GtkWidget *widget,
get_preferred_size (minimum, natural,
same_orientation && self->can_unfold,
- self->homogeneous[ADW_FOLD_FOLDED][orientation],
- self->homogeneous[ADW_FOLD_UNFOLDED][orientation],
visible_children, visible_child_progress,
sum_nat, max_min, max_nat, visible_min, last_visible_min);
}
@@ -2146,18 +2127,6 @@ adw_leaflet_get_property (GObject *object,
case PROP_FOLD_THRESHOLD_POLICY:
g_value_set_enum (value, adw_leaflet_get_fold_threshold_policy (self));
break;
- case PROP_HHOMOGENEOUS_FOLDED:
- g_value_set_boolean (value, adw_leaflet_get_homogeneous (self, TRUE, GTK_ORIENTATION_HORIZONTAL));
- break;
- case PROP_VHOMOGENEOUS_FOLDED:
- g_value_set_boolean (value, adw_leaflet_get_homogeneous (self, TRUE, GTK_ORIENTATION_VERTICAL));
- break;
- case PROP_HHOMOGENEOUS_UNFOLDED:
- g_value_set_boolean (value, adw_leaflet_get_homogeneous (self, FALSE, GTK_ORIENTATION_HORIZONTAL));
- break;
- case PROP_VHOMOGENEOUS_UNFOLDED:
- g_value_set_boolean (value, adw_leaflet_get_homogeneous (self, FALSE, GTK_ORIENTATION_VERTICAL));
- break;
case PROP_VISIBLE_CHILD:
g_value_set_object (value, adw_leaflet_get_visible_child (self));
break;
@@ -2211,18 +2180,6 @@ adw_leaflet_set_property (GObject *object,
case PROP_FOLD_THRESHOLD_POLICY:
adw_leaflet_set_fold_threshold_policy (self, g_value_get_enum (value));
break;
- case PROP_HHOMOGENEOUS_FOLDED:
- adw_leaflet_set_homogeneous (self, TRUE, GTK_ORIENTATION_HORIZONTAL, g_value_get_boolean (value));
- break;
- case PROP_VHOMOGENEOUS_FOLDED:
- adw_leaflet_set_homogeneous (self, TRUE, GTK_ORIENTATION_VERTICAL, g_value_get_boolean (value));
- break;
- case PROP_HHOMOGENEOUS_UNFOLDED:
- adw_leaflet_set_homogeneous (self, FALSE, GTK_ORIENTATION_HORIZONTAL, g_value_get_boolean (value));
- break;
- case PROP_VHOMOGENEOUS_UNFOLDED:
- adw_leaflet_set_homogeneous (self, FALSE, GTK_ORIENTATION_VERTICAL, g_value_get_boolean (value));
- break;
case PROP_VISIBLE_CHILD:
adw_leaflet_set_visible_child (self, g_value_get_object (value));
break;
@@ -2353,64 +2310,6 @@ adw_leaflet_class_init (AdwLeafletClass *klass)
ADW_FOLD_THRESHOLD_POLICY_MINIMUM,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
- /**
- * AdwLeaflet:hhomogeneous-folded: (attributes org.gtk.Property.get=adw_leaflet_get_homogeneous
org.gtk.Property.set=adw_leaflet_set_homogeneous)
- *
- * Whether the leaflet allocates the same width for all children when folded.
- *
- * Since: 1.0
- */
- props[PROP_HHOMOGENEOUS_FOLDED] =
- g_param_spec_boolean ("hhomogeneous-folded",
- "Horizontally homogeneous folded",
- "Whether the leaflet allocates the same width for all children when folded",
- TRUE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * AdwLeaflet:vhomogeneous-folded: (attributes org.gtk.Property.get=adw_leaflet_get_homogeneous
org.gtk.Property.set=adw_leaflet_set_homogeneous)
- *
- * Whether the leaflet allocates the same height for all children when folded.
- *
- * Since: 1.0
- */
- props[PROP_VHOMOGENEOUS_FOLDED] =
- g_param_spec_boolean ("vhomogeneous-folded",
- "Vertically homogeneous folded",
- "Whether the leaflet allocates the same height for all children when folded",
- TRUE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * AdwLeaflet:hhomogeneous-unfolded: (attributes org.gtk.Property.get=adw_leaflet_get_homogeneous
org.gtk.Property.set=adw_leaflet_set_homogeneous)
- *
- * Whether the leaflet allocates the same width for all children when
- * unfolded.
- *
- * Since: 1.0
- */
- props[PROP_HHOMOGENEOUS_UNFOLDED] =
- g_param_spec_boolean ("hhomogeneous-unfolded",
- "Box horizontally homogeneous",
- "Whether the leaflet allocates the same width for all children when unfolded",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * AdwLeaflet:vhomogeneous-unfolded: (attributes org.gtk.Property.get=adw_leaflet_get_homogeneous
org.gtk.Property.set=adw_leaflet_set_homogeneous)
- *
- * Whether the leaflet allocates the same height for all children when
- * unfolded.
- *
- * Since: 1.0
- */
- props[PROP_VHOMOGENEOUS_UNFOLDED] =
- g_param_spec_boolean ("vhomogeneous-unfolded",
- "Box vertically homogeneous",
- "Whether the leaflet allocates the same height for all children when unfolded",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
-
/**
* AdwLeaflet:visible-child: (attributes org.gtk.Property.get=adw_leaflet_get_visible_child
org.gtk.Property.set=adw_leaflet_set_visible_child)
*
@@ -3192,77 +3091,6 @@ adw_leaflet_get_folded (AdwLeaflet *self)
return self->folded;
}
-/**
- * adw_leaflet_set_homogeneous:
- * @self: a `AdwLeaflet`
- * @folded: the fold
- * @orientation: the orientation
- * @homogeneous: `TRUE` to make @self homogeneous
- *
- * Sets @self to be homogeneous or not for the given fold and orientation.
- *
- * If it is homogeneous, @self will request the same width or height for all its
- * children depending on the orientation. If it isn't and it is folded, the
- * leaflet may change width or height when a different child becomes visible.
- *
- * See [property@Adw.Leaflet:hhomogeneous-folded],
- * [property@Adw.Leaflet:vhomogeneous-folded],
- * [property@Adw.Leaflet:hhomogeneous-unfolded],
- * [property@Adw.Leaflet:vhomogeneous-unfolded].
- *
- * Since: 1.0
- */
-void
-adw_leaflet_set_homogeneous (AdwLeaflet *self,
- gboolean folded,
- GtkOrientation orientation,
- gboolean homogeneous)
-{
- g_return_if_fail (ADW_IS_LEAFLET (self));
-
- folded = !!folded;
- homogeneous = !!homogeneous;
-
- if (self->homogeneous[folded][orientation] == homogeneous)
- return;
-
- self->homogeneous[folded][orientation] = homogeneous;
-
- if (gtk_widget_get_visible (GTK_WIDGET (self)))
- gtk_widget_queue_resize (GTK_WIDGET (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), props[HOMOGENEOUS_PROP[folded][orientation]]);
-}
-
-/**
- * adw_leaflet_get_homogeneous:
- * @self: a `AdwLeaflet`
- * @folded: the fold
- * @orientation: the orientation
- *
- * Gets whether @self is homogeneous for the given fold and orientation.
- *
- * See [property@Adw.Leaflet:hhomogeneous-folded],
- * [property@Adw.Leaflet:vhomogeneous-folded],
- * [property@Adw.Leaflet:hhomogeneous-unfolded],
- * [property@Adw.Leaflet:vhomogeneous-unfolded].
- *
- * Returns: whether @self is homogeneous for the given fold and orientation
- *
- * Since: 1.0
- */
-gboolean
-adw_leaflet_get_homogeneous (AdwLeaflet *self,
- gboolean folded,
- GtkOrientation orientation)
-{
- g_return_val_if_fail (ADW_IS_LEAFLET (self), FALSE);
-
- folded = !!folded;
-
- return self->homogeneous[folded][orientation];
-}
-
/**
* adw_leaflet_get_transition_type: (attributes org.gtk.Method.get_property=transition-type)
* @self: a `AdwLeaflet`
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]