aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/dialogs/comp-editor.c50
2 files changed, 57 insertions, 0 deletions
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 <rodrigo@ximian.com>
+
+ * 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 <rodrigo@ximian.com>
* 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)
{
@@ -853,6 +889,18 @@ set_title_from_comp (CompEditor *editor)
}
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)
{
CompEditorPrivate *priv;
@@ -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