aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2001-01-08 08:47:35 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-01-08 08:47:35 +0800
commita223b88a9034f0c33f2e979403e1352ff822f8a2 (patch)
tree180ec792800fb8d2468fb2ae6829b5c87cc7f5f8 /calendar
parent45b8f9d767b5a178e0fdcb48901e664334fd8183 (diff)
downloadgsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.tar
gsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.tar.gz
gsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.tar.bz2
gsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.tar.lz
gsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.tar.xz
gsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.tar.zst
gsoc2013-evolution-a223b88a9034f0c33f2e979403e1352ff822f8a2.zip
added new source files for the Tasks folders.
2001-01-08 Damon Chaplin <damon@helixcode.com> * gui/Makefile.am: added new source files for the Tasks folders. * gui/e-tasks.[hc]: new widget to encapsulate the Tasks view. * gui/tasks-control.[hc]: new files to implement the Tasks control. * gui/tasks-control-factory.[hc]: new files to implement the factory for the Tasks controls. (I think the way I've split the code up is a lot cleaner than the GnomeCal implementation - the factory file just contains the factory functions and the control file contains all the control functions. Maybe we should make GnomeCal like this.) * gui/main.c: initialize the Tasks control factory. * gui/component-factory.c: added support for the Tasks control. Also added a "create_folder" function so we can now create new Tasks and Calendar folders within Evolution. I'm not a Bonobo expert so someone might want to check these over. * gui/calendar-config.[hc]: added convenience functions to configure the common settings of ECalendar and EDateEdit widgets. * gui/dialogs/task-editor.c (task_editor_create_date_edit): * gui/gnome-cal.c (gnome_calendar_update_config_settings): * gui/event-editor.c: used function to configure the ECalendars and EDateEdits. * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): fixed minor bug in format strings. svn path=/trunk/; revision=7297
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog32
-rw-r--r--calendar/gui/Makefile.am6
-rw-r--r--calendar/gui/calendar-component.c41
-rw-r--r--calendar/gui/calendar-config.c55
-rw-r--r--calendar/gui/calendar-config.h8
-rw-r--r--calendar/gui/component-factory.c41
-rw-r--r--calendar/gui/e-day-view-top-item.c12
-rw-r--r--calendar/gui/e-tasks.c450
-rw-r--r--calendar/gui/e-tasks.h71
-rw-r--r--calendar/gui/event-editor.c6
-rw-r--r--calendar/gui/gnome-cal.c9
-rw-r--r--calendar/gui/main.c2
-rw-r--r--calendar/gui/tasks-control-factory.c78
-rw-r--r--calendar/gui/tasks-control-factory.h31
-rw-r--r--calendar/gui/tasks-control.c225
-rw-r--r--calendar/gui/tasks-control.h32
16 files changed, 1066 insertions, 33 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e0485372c2..10c9c6bf76 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,35 @@
+2001-01-08 Damon Chaplin <damon@helixcode.com>
+
+ * gui/Makefile.am: added new source files for the Tasks folders.
+
+ * gui/e-tasks.[hc]: new widget to encapsulate the Tasks view.
+
+ * gui/tasks-control.[hc]: new files to implement the Tasks control.
+
+ * gui/tasks-control-factory.[hc]: new files to implement the factory
+ for the Tasks controls. (I think the way I've split the code up is a
+ lot cleaner than the GnomeCal implementation - the factory file just
+ contains the factory functions and the control file contains all the
+ control functions. Maybe we should make GnomeCal like this.)
+
+ * gui/main.c: initialize the Tasks control factory.
+
+ * gui/component-factory.c: added support for the Tasks control.
+ Also added a "create_folder" function so we can now create new Tasks
+ and Calendar folders within Evolution.
+ I'm not a Bonobo expert so someone might want to check these over.
+
+ * gui/calendar-config.[hc]: added convenience functions to configure
+ the common settings of ECalendar and EDateEdit widgets.
+
+ * gui/dialogs/task-editor.c (task_editor_create_date_edit):
+ * gui/gnome-cal.c (gnome_calendar_update_config_settings):
+ * gui/event-editor.c: used function to configure the ECalendars
+ and EDateEdits.
+
+ * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event):
+ fixed minor bug in format strings.
+
2001-01-06 Iain Holmes <iain@helixcode.com>
* gui/calendar-summary.c (generate_html_summary): Neaten the HTML,
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index db2da7da5d..e10c6f8cc5 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -105,6 +105,8 @@ evolution_calendar_SOURCES = \
e-week-view-titles-item.h \
e-week-view.c \
e-week-view.h \
+ e-tasks.c \
+ e-tasks.h \
event-editor.c \
event-editor.h \
gnome-cal.c \
@@ -122,6 +124,10 @@ evolution_calendar_SOURCES = \
print.h \
tag-calendar.c \
tag-calendar.h \
+ tasks-control-factory.c \
+ tasks-control-factory.h \
+ tasks-control.c \
+ tasks-control.h \
weekday-picker.c \
weekday-picker.h \
widget-util.c \
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 700631b78d..f0fc7fffcf 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -26,6 +26,7 @@
#include "evolution-shell-component.h"
#include <executive-summary/evolution-services/executive-summary-component.h>
#include "component-factory.h"
+#include "tasks-control-factory.h"
#include "control-factory.h"
#include "calendar-config.h"
#include "calendar-summary.h"
@@ -39,6 +40,7 @@ char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
+ { "tasks", "evolution-tasks.png" },
{ NULL, NULL }
};
@@ -54,12 +56,17 @@ create_view (EvolutionShellComponent *shell_component,
{
BonoboControl *control;
- if (g_strcasecmp (type, "calendar") != 0)
+ if (!g_strcasecmp (type, "calendar")) {
+ control = control_factory_new_control ();
+ if (!control)
+ return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ } else if (!g_strcasecmp (type, "tasks")) {
+ control = tasks_control_new ();
+ if (!control)
+ return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ } else {
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
-
- control = control_factory_new_control ();
- if (!control)
- return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ }
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
@@ -68,6 +75,27 @@ create_view (EvolutionShellComponent *shell_component,
return EVOLUTION_SHELL_COMPONENT_OK;
}
+static void
+create_folder (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ const char *type,
+ const GNOME_Evolution_ShellComponentListener listener,
+ void *closure)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init(&ev);
+ /* FIXME: I don't think we have to do anything to create a calendar
+ or tasks folder - the '.ics' files are created automatically when
+ needed. But I'm not sure - Damon. */
+ if (!strcmp(type, "calendar") || !strcmp(type, "tasks")) {
+ GNOME_Evolution_ShellComponentListener_notifyResult(listener, GNOME_Evolution_ShellComponentListener_OK, &ev);
+ } else {
+ GNOME_Evolution_ShellComponentListener_notifyResult(listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev);
+ }
+ CORBA_exception_free(&ev);
+}
+
static gint owner_count = 0;
static void
@@ -77,7 +105,6 @@ owner_set_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
evolution_dir = g_strdup (evolution_homedir);
- g_print ("evolution_dir: %s\n", evolution_dir);
calendar_config_init ();
owner_count ++;
}
@@ -101,7 +128,7 @@ factory_fn (BonoboGenericFactory *factory,
EvolutionShellComponent *shell_component;
shell_component = evolution_shell_component_new (folder_types,
- create_view, NULL, NULL, NULL, NULL);
+ create_view, create_folder, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 0245a05f2a..dc12e60ab4 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -421,3 +421,58 @@ calendar_config_set_working_days (CalWeekdays days)
config->working_days = days;
}
+
+/* This sets all the common config settings for an ECalendar widget.
+ These are the week start day, and whether we show week numbers. */
+void
+calendar_config_configure_e_calendar (ECalendar *cal)
+{
+ gboolean dnav_show_week_no;
+ gint week_start_day;
+
+ dnav_show_week_no = calendar_config_get_dnav_show_week_no ();
+
+ /* Note that this is 0 (Sun) to 6 (Sat). */
+ week_start_day = calendar_config_get_week_start_day ();
+
+ /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */
+ week_start_day = (week_start_day + 6) % 7;
+
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM (cal->calitem),
+ "show_week_numbers", dnav_show_week_no,
+ "week_start_day", week_start_day,
+ NULL);
+}
+
+
+/* This sets all the common config settings for an EDateEdit widget.
+ These are the week start day, whether we show week numbers, whether we
+ use 24 hour format, and the hours of the working day to use in the time
+ popup. */
+void
+calendar_config_configure_e_date_edit (EDateEdit *dedit)
+{
+ gboolean dnav_show_week_no, use_24_hour;
+ gint week_start_day, start_hour, end_hour;
+
+ dnav_show_week_no = calendar_config_get_dnav_show_week_no ();
+
+ /* Note that this is 0 (Sun) to 6 (Sat). */
+ week_start_day = calendar_config_get_week_start_day ();
+
+ /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */
+ week_start_day = (week_start_day + 6) % 7;
+
+ use_24_hour = calendar_config_get_24_hour_format ();
+
+ start_hour = calendar_config_get_day_start_hour ();
+ end_hour = calendar_config_get_day_end_hour ();
+ /* Round up the end hour. */
+ if (calendar_config_get_day_end_minute () != 0)
+ end_hour = end_hour + 1 % 24;
+
+ e_date_edit_set_week_start_day (dedit, week_start_day);
+ e_date_edit_set_show_week_numbers (dedit, dnav_show_week_no);
+ e_date_edit_set_use_24_hour_format (dedit, use_24_hour);
+ e_date_edit_set_time_popup_range (dedit, start_hour, end_hour);
+}
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index aa9bdefb80..d5176d624c 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -29,6 +29,9 @@
#ifndef _CALENDAR_CONFIG_H_
#define _CALENDAR_CONFIG_H_
+#include <widgets/misc/e-calendar.h>
+#include <widgets/misc/e-dateedit.h>
+
/* These are used to get/set the working days in the week. The bit-flags are
combined together. The bits must be from 0 (Sun) to 6 (Sat) to match the
@@ -114,4 +117,9 @@ gfloat calendar_config_get_month_vpane_pos (void);
void calendar_config_set_month_vpane_pos (gfloat vpane_pos);
+/* Convenience functions to configure common properties of ECalendar and
+ EDateEdit widgets. */
+void calendar_config_configure_e_calendar (ECalendar *cal);
+void calendar_config_configure_e_date_edit (EDateEdit *dedit);
+
#endif /* _CALENDAR_CONFIG_H_ */
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index 700631b78d..f0fc7fffcf 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -26,6 +26,7 @@
#include "evolution-shell-component.h"
#include <executive-summary/evolution-services/executive-summary-component.h>
#include "component-factory.h"
+#include "tasks-control-factory.h"
#include "control-factory.h"
#include "calendar-config.h"
#include "calendar-summary.h"
@@ -39,6 +40,7 @@ char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png" },
+ { "tasks", "evolution-tasks.png" },
{ NULL, NULL }
};
@@ -54,12 +56,17 @@ create_view (EvolutionShellComponent *shell_component,
{
BonoboControl *control;
- if (g_strcasecmp (type, "calendar") != 0)
+ if (!g_strcasecmp (type, "calendar")) {
+ control = control_factory_new_control ();
+ if (!control)
+ return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ } else if (!g_strcasecmp (type, "tasks")) {
+ control = tasks_control_new ();
+ if (!control)
+ return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ } else {
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
-
- control = control_factory_new_control ();
- if (!control)
- return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
+ }
bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
@@ -68,6 +75,27 @@ create_view (EvolutionShellComponent *shell_component,
return EVOLUTION_SHELL_COMPONENT_OK;
}
+static void
+create_folder (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ const char *type,
+ const GNOME_Evolution_ShellComponentListener listener,
+ void *closure)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init(&ev);
+ /* FIXME: I don't think we have to do anything to create a calendar
+ or tasks folder - the '.ics' files are created automatically when
+ needed. But I'm not sure - Damon. */
+ if (!strcmp(type, "calendar") || !strcmp(type, "tasks")) {
+ GNOME_Evolution_ShellComponentListener_notifyResult(listener, GNOME_Evolution_ShellComponentListener_OK, &ev);
+ } else {
+ GNOME_Evolution_ShellComponentListener_notifyResult(listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev);
+ }
+ CORBA_exception_free(&ev);
+}
+
static gint owner_count = 0;
static void
@@ -77,7 +105,6 @@ owner_set_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
evolution_dir = g_strdup (evolution_homedir);
- g_print ("evolution_dir: %s\n", evolution_dir);
calendar_config_init ();
owner_count ++;
}
@@ -101,7 +128,7 @@ factory_fn (BonoboGenericFactory *factory,
EvolutionShellComponent *shell_component;
shell_component = evolution_shell_component_new (folder_types,
- create_view, NULL, NULL, NULL, NULL);
+ create_view, create_folder, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index a9ece2cc50..145809893f 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -453,10 +453,10 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
&display_hour,
&suffix, &suffix_width);
if (day_view->use_24_hour_format) {
- g_snprintf (buffer, sizeof (buffer), "%2i:%02i",
+ g_snprintf (buffer, sizeof (buffer), "%i:%02i",
display_hour, minute);
} else {
- g_snprintf (buffer, sizeof (buffer), "%2i:%02i%s",
+ g_snprintf (buffer, sizeof (buffer), "%i:%02i%s",
display_hour, minute, suffix);
}
@@ -467,7 +467,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
gdk_gc_set_clip_rectangle (fg_gc, &clip_rect);
time_x = item_x + E_DAY_VIEW_LONG_EVENT_X_PAD - x;
- if (hour < 10)
+ if (display_hour < 10)
time_x += day_view->digit_width;
gdk_draw_string (drawable, font, fg_gc,
@@ -502,14 +502,14 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
&suffix_width);
if (day_view->use_24_hour_format) {
g_snprintf (buffer, sizeof (buffer),
- "%2i:%02i", display_hour, minute);
+ "%i:%02i", display_hour, minute);
} else {
g_snprintf (buffer, sizeof (buffer),
- "%2i:%02i%s", display_hour, minute,
+ "%i:%02i%s", display_hour, minute,
suffix);
}
- if (hour < 10)
+ if (display_hour < 10)
time_x += day_view->digit_width;
gdk_draw_string (drawable, font, fg_gc,
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
new file mode 100644
index 0000000000..552b1f54fc
--- /dev/null
+++ b/calendar/gui/e-tasks.c
@@ -0,0 +1,450 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-tasks.c
+ *
+ * Copyright (C) 2001 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Federico Mena Quintero <federico@helixcode.com>
+ * Damon Chaplin <damon@helixcode.com>
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <gal/util/e-util.h>
+#include <gal/e-table/e-table-scrolled.h>
+#include "e-calendar-table.h"
+#include "alarm-notify.h"
+
+#include "e-tasks.h"
+
+
+/* States for the calendar loading and creation state machine */
+typedef enum {
+ LOAD_STATE_NOT_LOADED,
+ LOAD_STATE_WAIT_LOAD,
+ LOAD_STATE_WAIT_LOAD_BEFORE_CREATE,
+ LOAD_STATE_WAIT_CREATE,
+ LOAD_STATE_LOADED
+} LoadState;
+
+/* Private part of the GnomeCalendar structure */
+struct _ETasksPrivate {
+ /* The calendar client object we monitor */
+ CalClient *client;
+
+ /* Loading state; we can be loading or creating a calendar */
+ LoadState load_state;
+
+ /* URI being loaded, NULL if we are not being loaded */
+ char *loading_uri;
+
+ /* The ECalendarTable showing the tasks. */
+ GtkWidget *tasks_view;
+};
+
+
+static void e_tasks_class_init (ETasksClass *class);
+static void e_tasks_init (ETasks *tasks);
+static void setup_widgets (ETasks *tasks);
+static void e_tasks_destroy (GtkObject *object);
+
+static void cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data);
+static void obj_updated_cb (CalClient *client, const char *uid, gpointer data);
+static void obj_removed_cb (CalClient *client, const char *uid, gpointer data);
+
+static GtkTableClass *parent_class;
+
+E_MAKE_TYPE (e_tasks, "ETasks", ETasks,
+ e_tasks_class_init, e_tasks_init,
+ GTK_TYPE_TABLE)
+
+
+/* Class initialization function for the gnome calendar */
+static void
+e_tasks_class_init (ETasksClass *class)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass *) class;
+
+ parent_class = gtk_type_class (GTK_TYPE_TABLE);
+
+ object_class->destroy = e_tasks_destroy;
+}
+
+
+/* Object initialization function for the gnome calendar */
+static void
+e_tasks_init (ETasks *tasks)
+{
+ ETasksPrivate *priv;
+
+ priv = g_new0 (ETasksPrivate, 1);
+ tasks->priv = priv;
+
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+
+ setup_widgets (tasks);
+}
+
+
+#define E_TASKS_TABLE_DEFAULT_STATE \
+ "<?xml version=\"1.0\"?>" \
+ "<ETableState>" \
+ "<column source=\"13\"/>" \
+ "<column source=\"14\"/>" \
+ "<column source=\"9\"/>" \
+ "<column source=\"5\"/>" \
+ "<grouping/>" \
+ "</ETableState>"
+
+static void
+setup_widgets (ETasks *tasks)
+{
+ ETasksPrivate *priv;
+ ETable *etable;
+
+ priv = tasks->priv;
+
+ priv->tasks_view = e_calendar_table_new ();
+ etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable));
+ e_table_set_state (etable, E_TASKS_TABLE_DEFAULT_STATE);
+ gtk_table_attach (GTK_TABLE (tasks), priv->tasks_view, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_widget_show (priv->tasks_view);
+
+}
+
+
+GtkWidget *
+e_tasks_construct (ETasks *tasks)
+{
+ ETasksPrivate *priv;
+
+ g_return_val_if_fail (tasks != NULL, NULL);
+ g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
+
+ priv = tasks->priv;
+
+ priv->client = cal_client_new ();
+ if (!priv->client)
+ return NULL;
+
+ gtk_signal_connect (GTK_OBJECT (priv->client), "cal_loaded",
+ GTK_SIGNAL_FUNC (cal_loaded_cb), tasks);
+ gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated",
+ GTK_SIGNAL_FUNC (obj_updated_cb), tasks);
+ gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed",
+ GTK_SIGNAL_FUNC (obj_removed_cb), tasks);
+
+ alarm_notify_add_client (priv->client);
+
+ e_calendar_table_set_cal_client (E_CALENDAR_TABLE (priv->tasks_view),
+ priv->client);
+
+ return GTK_WIDGET (tasks);
+}
+
+
+GtkWidget *
+e_tasks_new (void)
+{
+ ETasks *tasks;
+
+ tasks = gtk_type_new (e_tasks_get_type ());
+
+ if (!e_tasks_construct (tasks)) {
+ g_message ("e_tasks_new(): Could not construct the tasks GUI");
+ gtk_object_unref (GTK_OBJECT (tasks));
+ return NULL;
+ }
+
+ return GTK_WIDGET (tasks);
+}
+
+
+static void
+e_tasks_destroy (GtkObject *object)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (E_IS_TASKS (object));
+
+ tasks = E_TASKS (object);
+ priv = tasks->priv;
+
+ /* Save the ETable layout. FIXME: Need to save in a per-folder config
+ file like the mail folders use. */
+#if 0
+ filename = g_strdup_printf ("%s/config/TaskPad", evolution_dir);
+ e_calendar_table_save_state (E_CALENDAR_TABLE (priv->todo), filename);
+ g_free (filename);
+#endif
+
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+
+ if (priv->loading_uri) {
+ g_free (priv->loading_uri);
+ priv->loading_uri = NULL;
+ }
+
+ if (priv->client) {
+ alarm_notify_remove_client (priv->client);
+ gtk_object_unref (GTK_OBJECT (priv->client));
+ priv->client = NULL;
+ }
+
+ g_free (priv);
+ tasks->priv = NULL;
+
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+gboolean
+e_tasks_open (ETasks *tasks,
+ char *file,
+ ETasksOpenMode gcom)
+{
+ ETasksPrivate *priv;
+
+ g_return_val_if_fail (tasks != NULL, FALSE);
+ g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
+ g_return_val_if_fail (file != NULL, FALSE);
+
+ priv = tasks->priv;
+ g_return_val_if_fail (priv->load_state == LOAD_STATE_NOT_LOADED,
+ FALSE);
+
+ g_assert (priv->loading_uri == NULL);
+
+ priv->loading_uri = g_strdup (file);
+
+ if (gcom == E_TASKS_OPEN)
+ priv->load_state = LOAD_STATE_WAIT_LOAD;
+ else if (gcom == E_TASKS_OPEN_OR_CREATE)
+ priv->load_state = LOAD_STATE_WAIT_LOAD_BEFORE_CREATE;
+ else {
+ g_assert_not_reached ();
+ return FALSE;
+ }
+
+ if (!cal_client_load_calendar (priv->client, file)) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ g_free (priv->loading_uri);
+ priv->loading_uri = NULL;
+
+ g_message ("e_tasks_open(): Could not issue the request");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Loads the initial data into the calendar; this should be called right after
+ * the cal_loaded signal from the client is invoked.
+ */
+static void
+initial_load (ETasks *tasks)
+{
+ ETasksPrivate *priv;
+
+ priv = tasks->priv;
+
+ /* FIXME: Do we need to do anything? */
+}
+
+/* Displays an error to indicate that loading a calendar failed */
+static void
+load_error (ETasks *tasks, const char *uri)
+{
+ char *msg;
+
+ msg = g_strdup_printf (_("Could not load the tasks in `%s'"), uri);
+ gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
+ g_free (msg);
+}
+
+/* Displays an error to indicate that creating a calendar failed */
+static void
+create_error (ETasks *tasks, const char *uri)
+{
+ char *msg;
+
+ msg = g_strdup_printf (_("Could not create a tasks file in `%s'"),
+ uri);
+ gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
+ g_free (msg);
+}
+
+/* Displays an error to indicate that the specified URI method is not supported */
+static void
+method_error (ETasks *tasks, const char *uri)
+{
+ char *msg;
+
+ msg = g_strdup_printf (_("The method required to load `%s' is not supported"), uri);
+ gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
+ g_free (msg);
+}
+
+/* Callback from the calendar client when a calendar is loaded */
+static void
+cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+ gboolean free_uri;
+
+ tasks = E_TASKS (data);
+ priv = tasks->priv;
+
+ g_assert (priv->load_state != LOAD_STATE_NOT_LOADED
+ && priv->load_state != LOAD_STATE_LOADED);
+ g_assert (priv->loading_uri != NULL);
+
+ free_uri = TRUE;
+
+ switch (priv->load_state) {
+ case LOAD_STATE_WAIT_LOAD:
+ if (status == CAL_CLIENT_LOAD_SUCCESS) {
+ priv->load_state = LOAD_STATE_LOADED;
+ initial_load (tasks);
+ } else if (status == CAL_CLIENT_LOAD_ERROR) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ load_error (tasks, priv->loading_uri);
+ } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ method_error (tasks, priv->loading_uri);
+ } else
+ g_assert_not_reached ();
+
+ break;
+
+ case LOAD_STATE_WAIT_LOAD_BEFORE_CREATE:
+ if (status == CAL_CLIENT_LOAD_SUCCESS) {
+ priv->load_state = LOAD_STATE_LOADED;
+ initial_load (tasks);
+ } else if (status == CAL_CLIENT_LOAD_ERROR) {
+ priv->load_state = LOAD_STATE_WAIT_CREATE;
+ free_uri = FALSE;
+
+ if (!cal_client_create_calendar (priv->client,
+ priv->loading_uri)) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ free_uri = TRUE;
+ g_message ("cal_loaded_cb(): Could not issue the create request");
+ }
+ } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ method_error (tasks, priv->loading_uri);
+ } else
+ g_assert_not_reached ();
+
+ break;
+
+ case LOAD_STATE_WAIT_CREATE:
+ if (status == CAL_CLIENT_LOAD_SUCCESS) {
+ priv->load_state = LOAD_STATE_LOADED;
+ initial_load (tasks);
+ } else if (status == CAL_CLIENT_LOAD_ERROR) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ create_error (tasks, priv->loading_uri);
+ } else if (status == CAL_CLIENT_LOAD_IN_USE) {
+ /* Someone created the URI while we were issuing the
+ * create request, so we just try to reload.
+ */
+ priv->load_state = LOAD_STATE_WAIT_LOAD;
+ free_uri = FALSE;
+
+ if (!cal_client_load_calendar (priv->client,
+ priv->loading_uri)) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ free_uri = TRUE;
+ g_message ("cal_loaded_cb(): Could not issue the load request");
+ }
+ } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) {
+ priv->load_state = LOAD_STATE_NOT_LOADED;
+ method_error (tasks, priv->loading_uri);
+ } else
+ g_assert_not_reached ();
+
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ if (free_uri) {
+ g_free (priv->loading_uri);
+ priv->loading_uri = NULL;
+ }
+}
+
+
+/* Callback from the calendar client when an object is updated */
+static void
+obj_updated_cb (CalClient *client, const char *uid, gpointer data)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+
+ tasks = E_TASKS (data);
+ priv = tasks->priv;
+
+ /* FIXME: Do we need to do anything? */
+}
+
+
+/* Callback from the calendar client when an object is removed */
+static void
+obj_removed_cb (CalClient *client, const char *uid, gpointer data)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+
+ tasks = E_TASKS (data);
+ priv = tasks->priv;
+
+ /* FIXME: Do we need to do anything? */
+}
+
+
+/**
+ * e_tasks_get_cal_client:
+ * @tasks: An #ETasks.
+ *
+ * Queries the calendar client interface object that a tasks view is using.
+ *
+ * Return value: A calendar client interface object.
+ **/
+CalClient *
+e_tasks_get_cal_client (ETasks *tasks)
+{
+ ETasksPrivate *priv;
+
+ g_return_val_if_fail (tasks != NULL, NULL);
+ g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
+
+ priv = tasks->priv;
+
+ return priv->client;
+}
diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h
new file mode 100644
index 0000000000..86dbb1ff56
--- /dev/null
+++ b/calendar/gui/e-tasks.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-tasks.h
+ *
+ * Copyright (C) 2001 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Federico Mena Quintero <federico@helixcode.com>
+ * Damon Chaplin <damon@helixcode.com>
+ */
+
+#ifndef _E_TASKS_H_
+#define _E_TASKS_H_
+
+#include <cal-client/cal-client.h>
+
+
+#define E_TYPE_TASKS (e_tasks_get_type ())
+#define E_TASKS(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TASKS, ETasks))
+#define E_TASKS_CLASS(klass) (GTK_CHECK_CAST_CLASS ((klass), E_TYPE_TASKS, \
+ ETasksClass))
+#define E_IS_TASKS(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TASKS))
+#define E_IS_TASKS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TASKS))
+
+typedef struct _ETasks ETasks;
+typedef struct _ETasksClass ETasksClass;
+typedef struct _ETasksPrivate ETasksPrivate;
+
+struct _ETasks {
+ GtkTable table;
+
+ /* Private data */
+ ETasksPrivate *priv;
+};
+
+struct _ETasksClass {
+ GtkTableClass parent_class;
+};
+
+
+typedef enum {
+ E_TASKS_OPEN,
+ E_TASKS_OPEN_OR_CREATE
+} ETasksOpenMode;
+
+GtkType e_tasks_get_type (void);
+GtkWidget *e_tasks_construct (ETasks *tasks);
+
+GtkWidget *e_tasks_new (void);
+
+gboolean e_tasks_open (ETasks *tasks,
+ char *file,
+ ETasksOpenMode gcom);
+
+CalClient *e_tasks_get_cal_client (ETasks *tasks);
+
+
+#endif /* _E_TASKS_H_ */
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index f3adb24c91..16a9737b35 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -1088,7 +1088,6 @@ init_widgets (EventEditor *ee)
GtkWidget *menu;
GtkAdjustment *adj;
ECalendar *ecal;
- int week_start_day;
priv = ee->priv;
@@ -1133,16 +1132,13 @@ init_widgets (EventEditor *ee)
/* Recurrence preview */
- week_start_day = calendar_config_get_week_start_day ();
-
priv->recurrence_preview_calendar = e_calendar_new ();
ecal = E_CALENDAR (priv->recurrence_preview_calendar);
gtk_signal_connect (GTK_OBJECT (ecal->calitem), "date_range_changed",
GTK_SIGNAL_FUNC (recur_preview_date_range_changed_cb), ee);
+ calendar_config_configure_e_calendar (ecal);
gnome_canvas_item_set (GNOME_CANVAS_ITEM (ecal->calitem),
"maximum_days_selected", 0,
- "week_start_day", (week_start_day + 6) % 7,
- "show_week_numbers", calendar_config_get_dnav_show_week_no (),
NULL);
gtk_container_add (GTK_CONTAINER (priv->recurrence_preview_bin),
priv->recurrence_preview_calendar);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 808f5d9ee8..5daf6c9b55 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -957,7 +957,6 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
gint week_start_day, time_divisions;
gint start_hour, start_minute, end_hour, end_minute;
gboolean use_24_hour, show_event_end, compress_weekend;
- gboolean dnav_show_week_no;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
@@ -985,9 +984,6 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
week_start_day);
e_week_view_set_week_start_day (E_WEEK_VIEW (priv->month_view),
week_start_day);
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (priv->date_navigator)->calitem),
- "week_start_day", week_start_day,
- NULL);
start_hour = calendar_config_get_day_start_hour ();
start_minute = calendar_config_get_day_start_minute ();
@@ -1030,10 +1026,7 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
e_week_view_set_compress_weekend (E_WEEK_VIEW (priv->month_view),
compress_weekend);
- dnav_show_week_no = calendar_config_get_dnav_show_week_no ();
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (priv->date_navigator)->calitem),
- "show_week_numbers", dnav_show_week_no,
- NULL);
+ calendar_config_configure_e_calendar (E_CALENDAR (priv->date_navigator));
if (initializing) {
priv->hpane_pos = calendar_config_get_hpane_pos ();
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 53f833f70f..b286eb060a 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -39,6 +39,7 @@
#include "calendar-config.h"
#include "component-factory.h"
#include "control-factory.h"
+#include "tasks-control-factory.h"
#include "e-itip-control.h"
static void
@@ -77,6 +78,7 @@ main (int argc, char **argv)
control_factory_init ();
component_factory_init ();
e_itip_control_factory_init ();
+ tasks_control_factory_init ();
bonobo_main ();
diff --git a/calendar/gui/tasks-control-factory.c b/calendar/gui/tasks-control-factory.c
new file mode 100644
index 0000000000..946d4163a8
--- /dev/null
+++ b/calendar/gui/tasks-control-factory.c
@@ -0,0 +1,78 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* tasks-control-factory.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Ettore Perazzoli
+ * Damon Chaplin <damon@helixcode.com>
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <bonobo.h>
+#include <bonobo/bonobo-control.h>
+
+#include <liboaf/liboaf.h>
+
+#include "tasks-control-factory.h"
+#include "tasks-control.h"
+
+
+#define TASKS_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Tasks_ControlFactory"
+
+
+CORBA_Environment ev;
+CORBA_ORB orb;
+
+static BonoboObject *tasks_control_factory_fn (BonoboGenericFactory *Factory,
+ void *data);
+
+
+/* Registers the factory with Bonobo. Should be called on startup. */
+void
+tasks_control_factory_init (void)
+{
+ static BonoboGenericFactory *factory = NULL;
+
+ if (factory != NULL)
+ return;
+
+ factory = bonobo_generic_factory_new (TASKS_CONTROL_FACTORY_ID,
+ tasks_control_factory_fn, NULL);
+
+ if (factory == NULL)
+ g_error ("I could not register a Tasks control factory.");
+}
+
+
+/* Callback factory function to create a tasks control. */
+static BonoboObject *
+tasks_control_factory_fn (BonoboGenericFactory *Factory,
+ void *data)
+{
+ BonoboControl *control;
+
+ control = tasks_control_new ();
+
+ if (control)
+ return BONOBO_OBJECT (control);
+ else
+ return NULL;
+}
+
+
diff --git a/calendar/gui/tasks-control-factory.h b/calendar/gui/tasks-control-factory.h
new file mode 100644
index 0000000000..217ebc68fc
--- /dev/null
+++ b/calendar/gui/tasks-control-factory.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* tasks-control-factory.h
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Federico Mena Quintero <federico@helixcode.com>
+ * Damon Chaplin <damon@helixcode.com>
+ */
+
+#ifndef _TASKS_CONTROL_FACTORY_H_
+#define _TASKS_CONTROL_FACTORY_H_
+
+void tasks_control_factory_init (void);
+BonoboControl *tasks_control_factory_new_control (void);
+
+#endif /* _TASKS_CONTROL_FACTORY_H_ */
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
new file mode 100644
index 0000000000..ba2b699dd2
--- /dev/null
+++ b/calendar/gui/tasks-control.c
@@ -0,0 +1,225 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* tasks-control.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Damon Chaplin <damon@helixcode.com>
+ * Ettore Perazzoli
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <bonobo.h>
+#include <bonobo/bonobo-control.h>
+#include "e-tasks.h"
+#include "tasks-control.h"
+
+
+#define TASKS_CONTROL_PROPERTY_URI "folder_uri"
+#define TASKS_CONTROL_PROPERTY_URI_IDX 1
+
+
+static void tasks_control_properties_init (BonoboControl *control,
+ ETasks *tasks);
+static void tasks_control_get_property (BonoboPropertyBag *bag,
+ BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data);
+static void tasks_control_set_property (BonoboPropertyBag *bag,
+ const BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data);
+static void tasks_control_activate_cb (BonoboControl *control,
+ gboolean activate,
+ gpointer user_data);
+static void tasks_control_activate (BonoboControl *control,
+ ETasks *tasks);
+static void tasks_control_deactivate (BonoboControl *control);
+
+static void tasks_control_new_task_cmd (BonoboUIComponent *uic,
+ gpointer data,
+ const char *path);
+
+
+BonoboControl *
+tasks_control_new (void)
+{
+ BonoboControl *control;
+ GtkWidget *tasks;
+
+ tasks = e_tasks_new ();
+ if (!tasks)
+ return NULL;
+
+ gtk_widget_show (tasks);
+
+ control = bonobo_control_new (tasks);
+ if (!control) {
+ g_message ("control_factory_fn(): could not create the control!");
+ return NULL;
+ }
+
+ tasks_control_properties_init (control, E_TASKS (tasks));
+
+ gtk_signal_connect (GTK_OBJECT (control), "activate",
+ GTK_SIGNAL_FUNC (tasks_control_activate_cb),
+ tasks);
+
+ return control;
+}
+
+
+/* Creates the property bag for our new control. */
+static void
+tasks_control_properties_init (BonoboControl *control,
+ ETasks *tasks)
+
+{
+ BonoboPropertyBag *pbag;
+
+ pbag = bonobo_property_bag_new (tasks_control_get_property,
+ tasks_control_set_property, tasks);
+
+ bonobo_property_bag_add (pbag,
+ TASKS_CONTROL_PROPERTY_URI,
+ TASKS_CONTROL_PROPERTY_URI_IDX,
+ BONOBO_ARG_STRING,
+ NULL,
+ _("The URI of the tasks folder to display"),
+ 0);
+
+ bonobo_control_set_properties (control, pbag);
+}
+
+
+/* Gets a property of our control. FIXME: Finish. */
+static void
+tasks_control_get_property (BonoboPropertyBag *bag,
+ BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data)
+{
+ /*GnomeCalendar *gcal = user_data;*/
+
+ switch (arg_id) {
+
+ case TASKS_CONTROL_PROPERTY_URI_IDX:
+ /*
+ if (fb && fb->uri)
+ BONOBO_ARG_SET_STRING (arg, fb->uri);
+ else
+ BONOBO_ARG_SET_STRING (arg, "");
+ */
+ break;
+
+ default:
+ g_warning ("Unhandled arg %d\n", arg_id);
+ }
+}
+
+
+static void
+tasks_control_set_property (BonoboPropertyBag *bag,
+ const BonoboArg *arg,
+ guint arg_id,
+ gpointer user_data)
+{
+ ETasks *tasks = user_data;
+ char *filename;
+
+ switch (arg_id) {
+
+ case TASKS_CONTROL_PROPERTY_URI_IDX:
+ filename = g_strdup_printf ("%s/tasks.ics",
+ BONOBO_ARG_GET_STRING (arg));
+ e_tasks_open (tasks, filename, E_TASKS_OPEN_OR_CREATE);
+ g_free (filename);
+ break;
+
+ default:
+ g_warning ("Unhandled arg %d\n", arg_id);
+ break;
+ }
+}
+
+
+static void
+tasks_control_activate_cb (BonoboControl *control,
+ gboolean activate,
+ gpointer user_data)
+{
+ if (activate)
+ tasks_control_activate (control, user_data);
+ else
+ tasks_control_deactivate (control);
+}
+
+
+static BonoboUIVerb verbs [] = {
+ BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd),
+
+ BONOBO_UI_VERB_END
+};
+
+
+static void
+tasks_control_activate (BonoboControl *control,
+ ETasks *tasks)
+{
+ Bonobo_UIContainer remote_uih;
+ BonoboUIComponent *uic;
+
+ uic = bonobo_control_get_ui_component (control);
+ g_assert (uic != NULL);
+
+ remote_uih = bonobo_control_get_remote_ui_container (control);
+ bonobo_ui_component_set_container (uic, remote_uih);
+ bonobo_object_release_unref (remote_uih, NULL);
+
+ bonobo_ui_component_add_verb_list_with_data (uic, verbs, tasks);
+
+ bonobo_ui_component_freeze (uic, NULL);
+
+ bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR,
+ "evolution-tasks.xml",
+ "evolution-tasks");
+
+ bonobo_ui_component_thaw (uic, NULL);
+}
+
+
+static void
+tasks_control_deactivate (BonoboControl *control)
+{
+ BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
+ g_assert (uic != NULL);
+
+ bonobo_ui_component_rm (uic, "/", NULL);
+ bonobo_ui_component_unset_container (uic);
+}
+
+
+static void
+tasks_control_new_task_cmd (BonoboUIComponent *uic,
+ gpointer data,
+ const char *path)
+{
+ g_print ("Create new task\n");
+
+}
+
diff --git a/calendar/gui/tasks-control.h b/calendar/gui/tasks-control.h
new file mode 100644
index 0000000000..d2f0f4e2fb
--- /dev/null
+++ b/calendar/gui/tasks-control.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* tasks-control.h
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Federico Mena Quintero <federico@helixcode.com>
+ * Damon Chaplin <damon@helixcode.com>
+ */
+
+#ifndef _TASKS_CONTROL_H_
+#define _TASKS_CONTROL_H_
+
+
+BonoboControl *tasks_control_new (void);
+
+
+#endif /* _TASKS_CONTROL_H_ */