[libdazzle] dock-revealer: code cleanup and fix initial state
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] dock-revealer: code cleanup and fix initial state
- Date: Tue, 4 Jul 2017 23:24:43 +0000 (UTC)
commit a7cc5a2e19b8c9dd4ec73955b363ac22d83b40b1
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 4 16:24:26 2017 -0700
dock-revealer: code cleanup and fix initial state
This tries to fix the initial state of the reveal-child so that the proper
action state can be preserved.
src/panel/dzl-dock-revealer.c | 49 ++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 27 deletions(-)
---
diff --git a/src/panel/dzl-dock-revealer.c b/src/panel/dzl-dock-revealer.c
index a482ffd..95e520f 100644
--- a/src/panel/dzl-dock-revealer.c
+++ b/src/panel/dzl-dock-revealer.c
@@ -262,39 +262,33 @@ dzl_dock_revealer_set_reveal_child (DzlDockRevealer *self,
if (reveal_child != priv->reveal_child)
{
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (self));
DzlAnimation *animation;
- GtkWidget *child;
+ guint duration;
priv->reveal_child = reveal_child;
- child = gtk_bin_get_child (GTK_BIN (self));
-
- if (child != NULL)
- {
- guint duration;
+ dzl_animation_stop (priv->animation);
+ dzl_clear_weak_pointer (&priv->animation);
- if (priv->animation != NULL)
- {
- dzl_animation_stop (priv->animation);
- dzl_clear_weak_pointer (&priv->animation);
- }
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REVEAL_CHILD]);
- gtk_widget_set_child_visible (child, TRUE);
+ if (child == NULL)
+ return;
- duration = dzl_dock_revealer_calculate_duration (self);
+ gtk_widget_set_child_visible (child, TRUE);
- animation = dzl_object_animate_full (priv->adjustment,
- DZL_ANIMATION_EASE_IN_OUT_CUBIC,
- duration,
- gtk_widget_get_frame_clock (GTK_WIDGET (self)),
- dzl_dock_revealer_animation_done,
- g_object_ref (self),
- "value", reveal_child ? 1.0 : 0.0,
- NULL);
- dzl_set_weak_pointer (&priv->animation, animation);
- }
+ duration = dzl_dock_revealer_calculate_duration (self);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REVEAL_CHILD]);
+ animation = dzl_object_animate_full (priv->adjustment,
+ DZL_ANIMATION_EASE_IN_OUT_CUBIC,
+ duration,
+ gtk_widget_get_frame_clock (GTK_WIDGET (self)),
+ dzl_dock_revealer_animation_done,
+ g_object_ref (self),
+ "value", reveal_child ? 1.0 : 0.0,
+ NULL);
+ dzl_set_weak_pointer (&priv->animation, animation);
}
}
@@ -603,6 +597,7 @@ dzl_dock_revealer_add (GtkContainer *container,
GTK_CONTAINER_CLASS (dzl_dock_revealer_parent_class)->add (container, widget);
gtk_widget_set_child_visible (widget, priv->reveal_child);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]