[libhandy/wip/haecker-felix/flap-widget] Refactor measure()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/haecker-felix/flap-widget] Refactor measure()
- Date: Wed, 18 Nov 2020 11:43:12 +0000 (UTC)
commit 25093cbb9b02b8b79fcf9bf975b45aa64cb493a5
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Nov 18 16:26:29 2020 +0500
Refactor measure()
src/hdy-flap.c | 67 ++++++++++++++++++++++------------------------------------
1 file changed, 25 insertions(+), 42 deletions(-)
---
diff --git a/src/hdy-flap.c b/src/hdy-flap.c
index d59821f0..16082f8c 100644
--- a/src/hdy-flap.c
+++ b/src/hdy-flap.c
@@ -80,7 +80,6 @@ enum {
PROP_REVEAL_FLAP,
PROP_LOCKED,
PROP_FOLDED,
-
PROP_FOLD_DURATION,
PROP_REVEAL_DURATION,
@@ -450,55 +449,39 @@ hdy_flap_measure (GtkWidget *widget,
gint content_min = 0, content_nat = 0;
gint flap_min = 0, flap_nat = 0;
+ gint min, nat;
- if (minimum)
- *minimum = 0;
- if (natural)
- *natural = 0;
- if (minimum_baseline)
- *minimum_baseline = -1;
- if (natural_baseline)
- *natural_baseline = -1;
-
- if (orientation == GTK_ORIENTATION_VERTICAL) {
- if (self->content)
+ if (self->content) {
+ if (orientation == GTK_ORIENTATION_VERTICAL)
gtk_widget_get_preferred_height (self->content, &content_min, &content_nat);
-
- if (self->flap)
- gtk_widget_get_preferred_height (self->flap, &flap_min, &flap_nat);
-
- if (self->orientation == GTK_ORIENTATION_VERTICAL &&
- self->fold_policy != HDY_FLAP_FOLD_POLICY_AUTO) {
- if (minimum)
- *minimum = MAX (content_min + adjust_for_overlay (self, flap_min), flap_min);
-
- if (natural)
- *natural = MAX (content_nat + adjust_for_overlay (self, flap_nat), flap_nat);
-
- return;
- }
- } else {
- if (self->content)
+ else
gtk_widget_get_preferred_width (self->content, &content_min, &content_nat);
+ }
- if (self->flap)
+ if (self->flap) {
+ if (orientation == GTK_ORIENTATION_VERTICAL)
+ gtk_widget_get_preferred_height (self->flap, &flap_min, &flap_nat);
+ else
gtk_widget_get_preferred_width (self->flap, &flap_min, &flap_nat);
+ }
- if (self->orientation == GTK_ORIENTATION_HORIZONTAL &&
- self->fold_policy != HDY_FLAP_FOLD_POLICY_AUTO) {
-
- if (minimum)
- *minimum = MAX (content_min + adjust_for_overlay (self, flap_min), flap_min);
-
- if (natural)
- *natural = MAX (content_nat + adjust_for_overlay (self, flap_nat), flap_nat);
-
- return;
- }
+ if (self->orientation == orientation &&
+ self->fold_policy != HDY_FLAP_FOLD_POLICY_AUTO) {
+ min = MAX (content_min + adjust_for_overlay (self, flap_min), flap_min);
+ nat = MAX (content_nat + adjust_for_overlay (self, flap_nat), flap_nat);
+ } else {
+ min = MAX (content_min, flap_min);
+ nat = MAX (content_nat, flap_nat);
}
- *minimum = MAX (content_min, flap_min);
- *natural = MAX (content_nat, flap_nat);
+ if (minimum)
+ *minimum = min;
+ if (natural)
+ *natural = nat;
+ if (minimum_baseline)
+ *minimum_baseline = -1;
+ if (natural_baseline)
+ *natural_baseline = -1;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]