From 0c1f55e5e62a0a1552fd4e15330caa47ae02eb5a Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 24 Jun 2003 11:37:12 +0000 Subject: new functions. (page_summary_changed_cb): change the window title when the 2003-06-23 Rodrigo Moya * gui/dialogs/comp-editor.c (make_title_from_string, set_title_from_string): new functions. (page_summary_changed_cb): change the window title when the object's summary changes. svn path=/trunk/; revision=21523 --- calendar/ChangeLog | 7 ++++++ calendar/gui/dialogs/comp-editor.c | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index eadead579e..3d31247c27 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2003-06-23 Rodrigo Moya + + * gui/dialogs/comp-editor.c (make_title_from_string, set_title_from_string): + new functions. + (page_summary_changed_cb): change the window title when the object's + summary changes. + 2003-06-22 Rodrigo Moya * cal-client/cal-client.c (get_factories): don't use a static GList, diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 57ba30bf6d..d1712eca03 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -818,6 +818,42 @@ make_title_from_comp (CalComponent *comp) return title; } +/* Creates an appropriate title for the event editor dialog */ +static char * +make_title_from_string (CalComponent *comp, const char *str) +{ + char *title; + const char *type_string; + CalComponentVType type; + + if (!comp) + return g_strdup (_("Edit Appointment")); + + type = cal_component_get_vtype (comp); + switch (type) { + case CAL_COMPONENT_EVENT: + type_string = _("Appointment - %s"); + break; + case CAL_COMPONENT_TODO: + type_string = _("Task - %s"); + break; + case CAL_COMPONENT_JOURNAL: + type_string = _("Journal entry - %s"); + break; + default: + g_message ("make_title_from_string(): Cannot handle object of type %d", type); + return NULL; + } + + if (str) { + title = g_strdup_printf (type_string, str); + } else { + title = g_strdup_printf (type_string, _("No summary")); + } + + return title; +} + static const char * make_icon_from_comp (CalComponent *comp) { @@ -852,6 +888,18 @@ set_title_from_comp (CompEditor *editor) g_free (title); } +static void +set_title_from_string (CompEditor *editor, const char *str) +{ + CompEditorPrivate *priv; + char *title; + + priv = editor->priv; + title = make_title_from_string (priv->comp, str); + gtk_window_set_title (GTK_WINDOW (editor), title); + g_free (title); +} + static void set_icon_from_comp (CompEditor *editor) { @@ -1358,6 +1406,8 @@ page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data) _("Changes made to this item may be discarded if an update arrives")); priv->warned = TRUE; } + + set_title_from_string (editor, summary); } static void -- cgit v1.2.3