aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gncal-full-day.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-09 07:24:29 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-09 07:24:29 +0800
commit9bb0572b2caf451f7b91b7ff17eed75a0a9292da (patch)
tree8715c751bd3d33a046c27d70507c7c0853aa8b11 /calendar/gncal-full-day.c
parent2e5812a2c1575b9863e8f9209c123bb081eff436 (diff)
downloadgsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.tar
gsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.tar.gz
gsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.tar.bz2
gsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.tar.lz
gsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.tar.xz
gsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.tar.zst
gsoc2013-evolution-9bb0572b2caf451f7b91b7ff17eed75a0a9292da.zip
The full day widget now gets updated correctly when you add an
appointment from the menus. - Federico svn path=/trunk/; revision=116
Diffstat (limited to 'calendar/gncal-full-day.c')
-rw-r--r--calendar/gncal-full-day.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c
index 10a8246f73..90a4813947 100644
--- a/calendar/gncal-full-day.c
+++ b/calendar/gncal-full-day.c
@@ -128,7 +128,7 @@ child_map (GncalFullDay *fullday, Child *child)
{
gdk_window_show (child->window);
- if (GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget))
+ if (!GTK_WIDGET_MAPPED (child->widget))
gtk_widget_map (child->widget);
}
@@ -137,7 +137,7 @@ child_unmap (GncalFullDay *fullday, Child *child)
{
gdk_window_hide (child->window);
- if (GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_MAPPED (child->widget))
+ if (GTK_WIDGET_MAPPED (child->widget))
gtk_widget_unmap (child->widget);
}
@@ -322,7 +322,6 @@ child_new (GncalFullDay *fullday, iCalObject *ico)
gtk_text_set_word_wrap (GTK_TEXT (child->widget), TRUE);
gtk_widget_set_parent (child->widget, GTK_WIDGET (fullday));
- gtk_widget_show (child->widget);
return child;
}
@@ -330,7 +329,21 @@ child_new (GncalFullDay *fullday, iCalObject *ico)
static void
child_destroy (GncalFullDay *fullday, Child *child)
{
- /* FIXME */
+ /* Unparent the child widget manually as we don't have a remove method */
+
+ gtk_widget_ref (child->widget);
+
+ gtk_widget_unparent (child->widget);
+
+ if (GTK_WIDGET_MAPPED (fullday))
+ child_unmap (fullday, child);
+
+ if (GTK_WIDGET_REALIZED (fullday))
+ child_unrealize (fullday, child);
+
+ gtk_widget_unref (child->widget);
+
+ g_free (child);
}
static void
@@ -341,7 +354,7 @@ child_set_pos (GncalFullDay *fullday, Child *child, int x, int y, int width, int
child->width = width;
child->height = height;
- if (!GTK_WIDGET_REALIZED (fullday))
+ if (!child->window) /* realized? */
return;
child_set_text_pos (child);
@@ -566,12 +579,22 @@ static void
gncal_full_day_destroy (GtkObject *object)
{
GncalFullDay *fullday;
+ GList *children;
+ Child *child;
g_return_if_fail (object != NULL);
g_return_if_fail (GNCAL_IS_FULL_DAY (object));
fullday = GNCAL_FULL_DAY (object);
+ /* Unparent the children manually as we don't have a remove method */
+
+ for (children = fullday->children; children; children = children->next) {
+ child = children->data;
+
+ gtk_widget_unparent (child->widget);
+ }
+
g_list_free (fullday->children);
g_free (fullday->drag_info);
@@ -1161,13 +1184,6 @@ gncal_full_day_update (GncalFullDay *fullday)
if (!fullday->calendar->cal)
return;
- l_events = calendar_get_events_in_range (fullday->calendar->cal,
- fullday->lower,
- fullday->upper,
- calendar_compare_by_dtstart);
-
- /* FIXME: this is expensive and looks ugly -- use some form of cache? */
-
for (children = fullday->children; children; children = children->next)
child_destroy (fullday, children->data);
@@ -1175,6 +1191,11 @@ gncal_full_day_update (GncalFullDay *fullday)
children = NULL;
+ l_events = calendar_get_events_in_range (fullday->calendar->cal,
+ fullday->lower,
+ fullday->upper,
+ calendar_compare_by_dtstart);
+
for (events = l_events; events; events = events->next) {
child = child_new (fullday, events->data);
children = g_list_append (children, child);