Index: applets/clock/calendar-window.c
===================================================================
--- applets/clock/calendar-window.c	(revision 11170)
+++ applets/clock/calendar-window.c	(working copy)
@@ -49,6 +49,7 @@
 #include "clock-typebuiltins.h"
 #ifdef HAVE_LIBECAL
 #include "calendar-client.h"
+#include <libgnome/libgnome.h>
 #endif
 
 #define CALENDAR_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CALENDAR_TYPE_WINDOW, CalendarWindowPrivate))
@@ -61,6 +62,8 @@
 #  define KEY_BIRTHDAYS_EXPANDED    "expand_birthdays"
 #  define KEY_TASKS_EXPANDED        "expand_tasks"
 #  define KEY_WEATHER_EXPANDED      "expand_weather"
+#  define KEY_CALENDAR_PROGRAM      "/desktop/gnome/applications/calendar"
+#  define KEY_TASKS_PROGRAM         "/desktop/gnome/applications/tasks"
 #else
 #  define N_CALENDAR_WINDOW_GCONF_PREFS 1
 #endif
@@ -137,30 +140,58 @@
 #ifdef HAVE_LIBECAL
 
 static void
-clock_launch_evolution (CalendarWindow *calwin,
+clock_launch_calendar_tasks_program (CalendarWindow *calwin, 
+			const char     *key_program, 
 			const char     *argument)
 {
 	char      *command_line;
+	char      *program;
+	char      *key;
+	gboolean  terminal;
 	GdkScreen *screen;
 	GError    *error;
 
-	command_line = g_find_program_in_path ("evolution");
-	if (command_line == NULL)
+	key = g_strdup_printf ("%s%s", key_program, "/exec");
+	program = gconf_client_get_string (calwin->priv->gconfclient, 
+					   key, NULL);
+	g_free(key);
+	key = g_strdup_printf ("%s%s", key_program, "/needs_term");
+	terminal = gconf_client_get_bool (calwin->priv->gconfclient, 
+					  key, NULL);
+	g_free(key);
+
+	if (program == NULL) {
+		g_printerr ("Cannot calendar/tasks program key not set\n");
 		return;
+	}
+	command_line = g_find_program_in_path (program);
+	if (command_line == NULL) {
+		g_printerr ("Cannot calendar/tasks program: %s in path\n", program);
+		g_free(program);
+		return;
+	}
 	g_free (command_line);
 
 	if (argument)
-		command_line = g_strdup_printf ("evolution %s", argument);
+		command_line = g_strdup_printf ("%s %s", program, argument);
 	else
-		command_line = g_strdup ("evolution");
+		command_line = g_strdup (program);
+	g_free (program);
 
 	screen = gtk_widget_get_screen (calwin->priv->calendar);
 	error = NULL;
 
-	if (!gdk_spawn_command_line_on_screen (screen, command_line,
-					       &error)) {
-		g_printerr ("Cannot launch evolution: %s\n", error->message);
-		g_error_free (error);
+	if (terminal) {
+		if (gnome_execute_terminal_shell(NULL, command_line) == -1) {
+			g_printerr ("Cannot launch calendar/tasks program\n");
+		}
+	} else {
+		if (!gdk_spawn_command_line_on_screen (screen, command_line,
+						       &error)) {
+			g_printerr ("Cannot launch calendar/tasks program: %s\n", 
+			            error->message);
+			g_error_free (error);
+		}
 	}
 
 	g_free (command_line);
@@ -505,7 +536,8 @@
 
 	argument = g_strdup_printf ("task:%s", uid);
 
-	clock_launch_evolution (calwin, argument);
+	clock_launch_calendar_tasks_program (calwin, KEY_TASKS_PROGRAM, 
+	                                     argument);
 
 	g_free (argument);
         g_free (uid);
@@ -754,7 +786,7 @@
 static void
 edit_tasks (CalendarWindow *calwin)
 {
-       clock_launch_evolution (calwin, "--component=tasks");
+       clock_launch_calendar_tasks_program (calwin, KEY_TASKS_PROGRAM, NULL);
 }
 
 static GtkWidget *
@@ -1020,7 +1052,7 @@
 static void
 edit_appointments (CalendarWindow *calwin)
 {
-       clock_launch_evolution (calwin, "--component=calendar");
+       clock_launch_calendar_tasks_program (calwin, KEY_CALENDAR_PROGRAM, NULL);
 }
 
 static GtkWidget *
@@ -1044,7 +1076,7 @@
 static void
 edit_birthdays (CalendarWindow *calwin)
 {
-       clock_launch_evolution (calwin, "--component=calendar");
+       clock_launch_calendar_tasks_program (calwin, KEY_CALENDAR_PROGRAM, NULL);
 }
 
 static GtkWidget *
@@ -1069,7 +1101,7 @@
 static void
 edit_weather (CalendarWindow *calwin)
 {
-       clock_launch_evolution (calwin, "--component=calendar");
+       clock_launch_calendar_tasks_program (calwin, KEY_CALENDAR_PROGRAM, NULL);
 }
 
 
@@ -1185,7 +1217,8 @@
 				    0  + utc_tm.tm_min  - local_tm.tm_min,
 				    0);
 
-	clock_launch_evolution (calwin, argument);
+	clock_launch_calendar_tasks_program (calwin, KEY_CALENDAR_PROGRAM, 
+	                                     argument);
 
 	g_free (argument);
 }
