From a28d0468805da949037d3a64c0ebfda21be77a56 Mon Sep 17 00:00:00 2001
From: Larry Ewing <lewing@ximian.com>
Date: Sun, 14 Oct 2001 04:02:13 +0000
Subject: call set_icon_from_comp. (set_icon_from_comp): set the window icon
 from

2001-10-13  Larry Ewing  <lewing@ximian.com>

	* gui/dialogs/comp-editor.c (real_edit_comp): call
	set_icon_from_comp.
	(set_icon_from_comp): set the window icon from the comp.
	(make_icon_from_comp): get the icon path based on comp type.

	* gui/dialogs/Makefile.am (iconsdir): EVOLUTION_ICONSDIR bits.

svn path=/trunk/; revision=13666
---
 calendar/gui/dialogs/comp-editor.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

(limited to 'calendar/gui/dialogs/comp-editor.c')

diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index b6d6e233db..2ae92ac9c3 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -657,6 +657,28 @@ make_title_from_comp (CalComponent *comp)
 	return title;
 }
 
+static const char *
+make_icon_from_comp (CalComponent *comp)
+{
+	CalComponentVType type;
+        const char *icon_path;
+	
+	if (!comp)
+		return EVOLUTION_ICONSDIR "/evolution-calendar-mini.png";
+
+	type = cal_component_get_vtype (comp);
+	switch (type) {
+	case CAL_COMPONENT_EVENT:
+		return EVOLUTION_ICONSDIR "/buttons/new_appointment.png";
+		break;
+	case CAL_COMPONENT_TODO:
+		return EVOLUTION_ICONSDIR "/buttons/new_task.png"; 
+		break;
+	default:		
+		return EVOLUTION_ICONSDIR "/evolution-calendar-mini.png";
+	}
+}
+
 /* Sets the event editor's window title from a calendar component */
 static void
 set_title_from_comp (CompEditor *editor)
@@ -670,6 +692,17 @@ set_title_from_comp (CompEditor *editor)
 	g_free (title);
 }
 
+static void
+set_icon_from_comp (CompEditor *editor)
+{
+	CompEditorPrivate *priv;
+	char *file;
+
+	priv = editor->priv;
+	file = make_icon_from_comp (priv->comp);
+	gnome_window_icon_set_from_file (GTK_WINDOW (priv->window), file);
+}
+
 static void
 fill_widgets (CompEditor *editor) 
 {
@@ -741,6 +774,7 @@ real_edit_comp (CompEditor *editor, CalComponent *comp)
 		priv->comp = cal_component_clone (comp);
 
 	set_title_from_comp (editor);
+	set_icon_from_comp (editor);
 	fill_widgets (editor);	
 }
 
-- 
cgit v1.2.3