[gnome-calendar] Fixed bug when destroying child widgets.
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] Fixed bug when destroying child widgets.
- Date: Thu, 23 Aug 2012 13:45:16 +0000 (UTC)
commit 009e65cdd3bcd2a46726a57fadedc30cdb739f73
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Wed Aug 22 16:16:04 2012 -0400
Fixed bug when destroying child widgets.
src/gcal-month-view.c | 21 +++++++++++++++------
src/gcal-week-view.c | 12 +++++++++++-
2 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 88f4a15..df54c01 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -759,15 +759,21 @@ gcal_month_view_remove (GtkContainer *container,
child = (GcalViewChild*) l->data;
if (child->widget == widget)
{
+ gboolean was_visible;
+
+ was_visible = gtk_widget_get_visible (widget);
+ gtk_widget_unparent (widget);
+
priv->days[i] = g_list_remove (priv->days[i], child);
g_free (child);
- i = 36;
- break;
+ if (was_visible)
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+
+ return;
}
}
}
- gtk_widget_unparent (widget);
}
static void
@@ -784,11 +790,15 @@ gcal_month_view_forall (GtkContainer *container,
for (i = 0; i < 35; i++)
{
- for (l = priv->days[i]; l != NULL; l = l->next)
+ l = priv->days[i];
+
+ while (l)
{
GcalViewChild *child;
child = (GcalViewChild*) l->data;
+ l = l->next;
+
(* callback) (child->widget, callback_data);
}
}
@@ -1346,8 +1356,7 @@ gcal_month_view_remove_by_uuid (GcalView *view,
if (g_strcmp0 (uuid, widget_uuid) == 0)
{
gtk_widget_destroy (child->widget);
- i = 36;
- break;
+ return;
}
}
}
diff --git a/src/gcal-week-view.c b/src/gcal-week-view.c
index f357b88..8e741c6 100644
--- a/src/gcal-week-view.c
+++ b/src/gcal-week-view.c
@@ -900,6 +900,7 @@ gcal_week_view_remove (GtkContainer *container,
GList *l;
icaltimetype *date;
gint day;
+ gboolean was_visible;
g_return_if_fail (GCAL_IS_WEEK_VIEW (container));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (container));
@@ -921,8 +922,13 @@ gcal_week_view_remove (GtkContainer *container,
}
}
+
+ was_visible = gtk_widget_get_visible (widget);
gtk_widget_unparent (widget);
+ if (was_visible)
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+
g_free (date);
}
@@ -940,11 +946,15 @@ gcal_week_view_forall (GtkContainer *container,
for (i = 0; i < 7; i++)
{
- for (l = priv->days[i]; l != NULL; l = l->next)
+ l = priv->days[i];
+
+ while (l)
{
GcalViewChild *child;
child = (GcalViewChild*) l->data;
+ l = l->next;
+
(* callback) (child->widget, callback_data);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]