From 7b07f1342a80551d76bc0f2f26f0cf4cda394d6c Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 13 Dec 2000 06:56:16 +0000 Subject: Use set_title_from_comp (save_todo_object): ditto (set_title_from_comp): 2000-12-12 JP Rosevear * gui/dialogs/task-editor.c (task_editor_set_todo_object): Use set_title_from_comp (save_todo_object): ditto (set_title_from_comp): Make sure the title is encoded properly (as in event-editor) svn path=/trunk/; revision=6962 --- calendar/ChangeLog | 8 ++++++++ calendar/gui/dialogs/task-editor.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 992ae523b5..a48cbbb973 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2000-12-12 JP Rosevear + + * gui/dialogs/task-editor.c (task_editor_set_todo_object): Use + set_title_from_comp + (save_todo_object): ditto + (set_title_from_comp): Make sure the title is encoded properly (as in + event-editor) + 2000-12-12 Federico Mena Quintero * cal-util/cal-component.c (get_text_list): Constify for new diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 60a9bdd60a..34b62ba61e 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -132,6 +133,7 @@ static gboolean get_widgets (TaskEditor *tedit); static void init_widgets (TaskEditor *tedit); static void task_editor_destroy (GtkObject *object); static char * make_title_from_comp (CalComponent *comp); +static void set_title_from_comp (TaskEditor *tedit, CalComponent *comp); static void clear_widgets (TaskEditor *tedit); static void fill_widgets (TaskEditor *tedit); @@ -648,7 +650,6 @@ task_editor_set_todo_object (TaskEditor *tedit, CalComponent *comp) { TaskEditorPrivate *priv; - char *title; g_return_if_fail (tedit != NULL); g_return_if_fail (IS_TASK_EDITOR (tedit)); @@ -663,10 +664,7 @@ task_editor_set_todo_object (TaskEditor *tedit, if (comp) priv->comp = cal_component_clone (comp); - title = make_title_from_comp (priv->comp); - gtk_window_set_title (GTK_WINDOW (priv->app), title); - g_free (title); - + set_title_from_comp (tedit, priv->comp); fill_widgets (tedit); } @@ -706,6 +704,27 @@ make_title_from_comp (CalComponent *comp) } } +/* Sets the event editor's window title from a calendar component */ +static void +set_title_from_comp (TaskEditor *tedit, CalComponent *comp) +{ + TaskEditorPrivate *priv; + char *title, *tmp; + + priv = tedit->priv; + + title = make_title_from_comp (comp); + tmp = e_utf8_to_gtk_string (priv->app, title); + g_free (title); + + if (tmp) { + gtk_window_set_title (GTK_WINDOW (priv->app), tmp); + g_free (tmp); + } else { + g_message ("set_title_from_comp(): Could not convert the title from UTF8"); + gtk_window_set_title (GTK_WINDOW (priv->app), ""); + } +} /* Fills the widgets with default values */ static void @@ -842,7 +861,6 @@ static void save_todo_object (TaskEditor *tedit) { TaskEditorPrivate *priv; - char *title; priv = tedit->priv; @@ -852,10 +870,7 @@ save_todo_object (TaskEditor *tedit) return; dialog_to_comp_object (tedit); - - title = make_title_from_comp (priv->comp); - gtk_window_set_title (GTK_WINDOW (priv->app), title); - g_free (title); + set_title_from_comp (tedit, priv->comp); if (!cal_client_update_object (priv->client, priv->comp)) g_message ("save_todo_object(): Could not update the object!"); -- cgit