[evolution-patches] change window title on summary change



this makes the window title of the calendar editor change when the
summary is changed.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1797
diff -u -p -r1.1797 ChangeLog
--- ChangeLog	20 Jun 2003 14:36:16 -0000	1.1797
+++ ChangeLog	23 Jun 2003 11:57:15 -0000
@@ -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-19  Dan Winship  <danw ximian com>
 
 	* pcs/cal-backend.c (cal_backend_finalize): don't leak the
Index: gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.78
diff -u -p -r1.78 comp-editor.c
--- gui/dialogs/comp-editor.c	20 Jun 2003 12:50:26 -0000	1.78
+++ gui/dialogs/comp-editor.c	23 Jun 2003 11:57:16 -0000
@@ -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,
 			  _("Changes made to this item may be discarded if an update arrives"));
 		priv->warned = TRUE;
 	}
+
+	set_title_from_string (editor, summary);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]