From ec13cd14dacd7ebcc32a984a4ef858073995653b Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 22 Aug 2001 12:09:12 +0000 Subject: open the tasks folder associated with the calendar being opened, and not 2001-08-22 Rodrigo Moya * gui/gnome-cal.c (gnome_calendar_open): open the tasks folder associated with the calendar being opened, and not always the local tasks.ics file * pcs/cal-factory.c (open_fn): use gnome_vfs_uri_new_private when parsing the URI to allow non-registered URIs svn path=/trunk/; revision=12379 --- calendar/gui/gnome-cal.c | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) (limited to 'calendar/gui/gnome-cal.c') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 6d0e7cbb53..5c7227bf73 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -1596,6 +1597,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) GnomeCalendarPrivate *priv; char *tasks_uri; gboolean success; + GnomeVFSURI *uri; g_return_val_if_fail (gcal != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); @@ -1618,15 +1620,47 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) add_alarms (str_uri); - /* Open the appropriate Tasks folder to show in the TaskPad. - Currently we just show the folder named "Tasks", but it will be - a per-calendar option in future. */ + /* Open the appropriate Tasks folder to show in the TaskPad */ - tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); - success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE); + uri = gnome_vfs_uri_new_private (str_uri, TRUE, TRUE, TRUE); + if (!uri) { + tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); + success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE); - add_alarms (tasks_uri); - g_free (tasks_uri); + add_alarms (tasks_uri); + g_free (tasks_uri); + } + else { + if (gnome_vfs_uri_is_local (uri)) { + tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); + success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE); + + add_alarms (tasks_uri); + g_free (tasks_uri); + } + else { + CalendarModel *model; + + /* we use the same CalClient for tasks than for events */ + gtk_object_unref (GTK_OBJECT (priv->task_pad_client)); + gtk_object_ref (GTK_OBJECT (priv->client)); + priv->task_pad_client = priv->client; + + gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "cal_opened", + GTK_SIGNAL_FUNC (client_cal_opened_cb), gcal); + gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "categories_changed", + GTK_SIGNAL_FUNC (client_categories_changed_cb), gcal); + + model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)); + g_assert (model != NULL); + + calendar_model_set_cal_client (model, priv->task_pad_client, CALOBJ_TYPE_TODO); + + success = TRUE; + } + + gnome_vfs_uri_unref (uri); + } if (!success) { g_message ("gnome_calendar_open(): Could not issue the request"); -- cgit