diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-06-27 17:04:30 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-06-27 17:04:30 +0800 |
commit | 63c17f1684e715c5312c8cdca357e76ff623d3a5 (patch) | |
tree | 256203cceee6ba598589f227d27c404d37100239 /calendar/gui/dialogs/alarm-page.c | |
parent | e62619554adc0caa28bc549721727c71ed651153 (diff) | |
download | gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.tar gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.tar.gz gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.tar.bz2 gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.tar.lz gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.tar.xz gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.tar.zst gsoc2013-evolution-63c17f1684e715c5312c8cdca357e76ff623d3a5.zip |
Fixes #44723
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.
svn path=/trunk/; revision=21561
Diffstat (limited to 'calendar/gui/dialogs/alarm-page.c')
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 42 |
1 files changed, 42 insertions, 0 deletions
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 */ |