[libdazzle] dock-bin: track reveal-child from children widgets
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] dock-bin: track reveal-child from children widgets
- Date: Mon, 3 Jul 2017 09:00:14 +0000 (UTC)
commit b256f4fda6dd0d9d07f2b2268b7f3639b0423a8a
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 3 02:00:05 2017 -0700
dock-bin: track reveal-child from children widgets
In case this gets toggled in another way, we should handle it gracefully.
src/panel/dzl-dock-bin.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/panel/dzl-dock-bin.c b/src/panel/dzl-dock-bin.c
index d73f436..f1763a9 100644
--- a/src/panel/dzl-dock-bin.c
+++ b/src/panel/dzl-dock-bin.c
@@ -390,6 +390,25 @@ dzl_dock_bin_add (GtkContainer *container,
}
static void
+dzl_dock_bin_notify_reveal_child (DzlDockBin *self,
+ GParamSpec *pspec,
+ GtkWidget *child)
+{
+ DzlDockBinPrivate *priv = dzl_dock_bin_get_instance_private (self);
+
+ g_assert (DZL_IS_DOCK_BIN (self));
+ g_assert (GTK_IS_WIDGET (child));
+
+ for (guint i = 0; i < G_N_ELEMENTS (priv->children); i++)
+ {
+ DzlDockBinChild *ele = &priv->children [i];
+
+ if (ele->widget == child)
+ g_object_notify (G_OBJECT (self), visible_names [ele->type]);
+ }
+}
+
+static void
dzl_dock_bin_remove (GtkContainer *container,
GtkWidget *widget)
{
@@ -403,6 +422,13 @@ dzl_dock_bin_remove (GtkContainer *container,
gtk_widget_unparent (child->widget);
g_clear_object (&child->widget);
+ g_signal_handlers_disconnect_by_func (widget,
+ G_CALLBACK (gtk_widget_destroyed),
+ &child->widget);
+ g_signal_handlers_disconnect_by_func (widget,
+ G_CALLBACK (dzl_dock_bin_notify_reveal_child),
+ self);
+
gtk_widget_queue_resize (GTK_WIDGET (self));
}
@@ -1494,6 +1520,17 @@ dzl_dock_bin_create_edge (DzlDockBin *self,
"reveal-child", FALSE,
NULL);
+ g_signal_connect (child->widget,
+ "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &child->widget);
+
+ g_signal_connect_object (child->widget,
+ "notify::reveal-child",
+ G_CALLBACK (dzl_dock_bin_notify_reveal_child),
+ self,
+ G_CONNECT_SWAPPED);
+
gtk_widget_set_parent (g_object_ref_sink (child->widget), GTK_WIDGET (self));
dzl_dock_item_adopt (DZL_DOCK_ITEM (self), DZL_DOCK_ITEM (child->widget));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]