diff options
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 42 |
2 files changed, 53 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 4d0bacb57a..07413363f0 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,16 @@ 2003-06-25 Rodrigo Moya <rodrigo@ximian.com> + Fixes #44723 + + * gui/dialogs/alarm-page.c: added a new field to the private structure + to keep track of the old summary. + (alarm_page_init): initialize new field. + (alarm_page_finalize): free new field. + (alarm_page_set_summary): iterate over the list of alarms to change + their description if it was the same as the event's summary. + +2003-06-25 Rodrigo Moya <rodrigo@ximian.com> + Fixes #44719 * gui/alarm-notify/alarm-notify-dialog.c (alarm_notify_dialog): use diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c index 540f11db92..785734ad8c 100644 --- a/calendar/gui/dialogs/alarm-page.c +++ b/calendar/gui/dialogs/alarm-page.c @@ -80,6 +80,9 @@ struct _AlarmPagePrivate { EAlarmList *list_store; gboolean updating; + + /* Old summary, to detect changes */ + gchar *old_summary; }; /* "relative" types */ @@ -218,6 +221,7 @@ alarm_page_init (AlarmPage *apage) icalcomponent_add_property (icalcomp, icalprop); priv->updating = FALSE; + priv->old_summary = NULL; } /* Destroy handler for the alarm page */ @@ -251,6 +255,11 @@ alarm_page_finalize (GObject *object) priv->list_store = NULL; } + if (priv->old_summary) { + g_free (priv->old_summary); + priv->old_summary = NULL; + } + g_free (priv); apage->priv = NULL; @@ -499,6 +508,39 @@ alarm_page_set_summary (CompEditorPage *page, const char *summary) priv = apage->priv; gtk_label_set_text (GTK_LABEL (priv->summary), summary); + + /* iterate over all alarms */ + if (priv->old_summary) { + GtkTreeView *view; + GtkTreeModel *model; + GtkTreeIter iter; + gboolean valid_iter; + + view = GTK_TREE_VIEW (priv->list); + model = GTK_TREE_MODEL (priv->list_store); + + for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter; + valid_iter = gtk_tree_model_iter_next (model, &iter)) { + CalComponentAlarm *alarm; + CalComponentText desc; + + alarm = (CalComponentAlarm *) e_alarm_list_get_alarm (priv->list_store, &iter); + g_assert (alarm != NULL); + + cal_component_alarm_get_description (alarm, &desc); + if (desc.value && *desc.value) { + if (!strcmp (desc.value, priv->old_summary)) { + desc.value = summary; + cal_component_alarm_set_description (alarm, &desc); + } + } + } + + g_free (priv->old_summary); + } + + /* update old summary */ + priv->old_summary = g_strdup (summary); } /* set_dates handler for the alarm page */ |