diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-12-09 05:09:04 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-12-09 05:09:04 +0800 |
commit | 4e47d1142a431f2c64437a7e47fc892a43c17d16 (patch) | |
tree | 0b83423b2a97d03a35aee348bce1374c7c01dcce | |
parent | 3df2257e016793b56ab81107ef61beecf2ced330 (diff) | |
download | gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.tar gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.tar.gz gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.tar.bz2 gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.tar.lz gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.tar.xz gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.tar.zst gsoc2013-evolution-4e47d1142a431f2c64437a7e47fc892a43c17d16.zip |
Free the strings we get from the editables.
2000-12-08 Federico Mena Quintero <federico@helixcode.com>
* gui/event-editor.c (dialog_to_comp_object): Free the strings we
get from the editables.
* gui/dialogs/task-editor.c (dialog_to_comp_object): Likewise.
This sucks; this code should be shared between the two dialogs.
svn path=/trunk/; revision=6868
-rw-r--r-- | calendar/ChangeLog | 8 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 54 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 11 |
3 files changed, 55 insertions, 18 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 4b15fd8c73..a2a7cf282e 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,13 @@ 2000-12-08 Federico Mena Quintero <federico@helixcode.com> + * gui/event-editor.c (dialog_to_comp_object): Free the strings we + get from the editables. + + * gui/dialogs/task-editor.c (dialog_to_comp_object): Likewise. + This sucks; this code should be shared between the two dialogs. + +2000-12-08 Federico Mena Quintero <federico@helixcode.com> + * gui/event-editor.c (fill_widgets): Free the dates we get from the component. diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 61767b4fd1..8cd7c33ba9 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -845,33 +845,57 @@ dialog_to_comp_object (TaskEditor *tedit) { TaskEditorPrivate *priv; CalComponent *comp; - CalComponentText *text; CalComponentDateTime date; time_t t; - GSList *list; icalproperty_status status; TaskEditorPriority priority; int priority_value, percent; CalComponentClassification classification; char *url; const char *status_string; + char *str; priv = tedit->priv; comp = priv->comp; /* Summary. */ - text = g_new0 (CalComponentText, 1); - text->value = e_dialog_editable_get (priv->summary); - cal_component_set_summary (comp, text); - - /* Description. Note that we use the text variable again, and it is - freed in cal_component_free_text_list(). */ - list = NULL; - text->value = e_dialog_editable_get (priv->description); - list = g_slist_prepend (list, text); - cal_component_set_description_list (comp, list); - cal_component_free_text_list (list); + + str = e_dialog_editable_get (priv->summary); + if (!str || strlen (str) == 0) + cal_component_set_summary (comp, NULL); + else { + CalComponentText text; + + text.value = str; + text.altrep = NULL; + + cal_component_set_summary (comp, &text); + } + + if (str) + g_free (str); + + /* Description */ + + str = e_dialog_editable_get (priv->description); + if (!str || strlen (str) == 0) + cal_component_set_description_list (comp, NULL); + else { + GSList l; + CalComponentText text; + + text.value = str; + text.altrep = NULL; + l.data = &text; + l.next = NULL; + + cal_component_set_description_list (comp, &l); + } + if (!str) + g_free (str); + + /* Dates */ date.value = g_new (struct icaltimetype, 1); date.tzid = NULL; @@ -929,8 +953,8 @@ dialog_to_comp_object (TaskEditor *tedit) url = e_dialog_editable_get (priv->url); cal_component_set_url (comp, url); - - + if (url) + g_free (url); cal_component_commit_sequence (comp); } diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 0d98d75d24..8939e9bb64 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -2150,7 +2150,7 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) /* Summary */ str = e_dialog_editable_get (priv->general_summary); - if (strlen (str) == 0) + if (!str || strlen (str) == 0) cal_component_set_summary (comp, NULL); else { CalComponentText text; @@ -2161,10 +2161,13 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) cal_component_set_summary (comp, &text); } + if (str) + g_free (str); + /* Description */ str = e_dialog_editable_get (priv->description); - if (strlen (str) == 0) + if (!str || strlen (str) == 0) cal_component_set_description_list (comp, NULL); else { GSList l; @@ -2177,7 +2180,9 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) cal_component_set_description_list (comp, &l); } - /* FIXME: Do we need to free str?? */ + + if (!str) + g_free (str); /* Dates */ |