From a28d0468805da949037d3a64c0ebfda21be77a56 Mon Sep 17 00:00:00 2001 From: Larry Ewing 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 * 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/Makefile.am | 3 +++ calendar/gui/dialogs/comp-editor.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index c0c410a565..2784a36004 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -31,6 +31,7 @@ INCLUDES = \ $(EXTRA_GNOME_CFLAGS) \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ + -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ $(BONOBO_VFS_GNOME_CFLAGS) \ -DGNOMELOCALEDIR=\""$(localedir)"\" @@ -80,6 +81,8 @@ libcal_dialogs_a_SOURCES = \ task-page.c \ task-page.h +iconsdir = $(datadir)/images/evolution + gladedir = $(datadir)/evolution/glade glade_DATA = \ alarm-options.glade \ 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