aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/tasks-component.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-01-15 03:30:36 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-01-15 03:30:36 +0800
commite0eb6c79e5c4fc9f259443c611c212f2ae2daa7f (patch)
tree4edb1ad4f08836639c98e64629486f6f7384549e /calendar/gui/tasks-component.c
parent80e8b67fed5a863eba6bf0c8ff86699f243905ca (diff)
downloadgsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.tar
gsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.tar.gz
gsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.tar.bz2
gsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.tar.lz
gsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.tar.xz
gsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.tar.zst
gsoc2013-evolution-e0eb6c79e5c4fc9f259443c611c212f2ae2daa7f.zip
new utility routine to create new tasks (create_new_todo): use above so we
2004-01-14 JP Rosevear <jpr@ximian.com> * gui/tasks-component.c (impl_requestCreateItem): new utility routine to create new tasks (create_new_todo): use above so we don't try to set up the creation ecal unless we are actually creating a new item * gui/calendar-component.c (create_new_event): new utility routine to create new events (impl_requestCreateItem): use above so we don't try to set up the creation ecal unless we are actually creating a new item svn path=/trunk/; revision=24225
Diffstat (limited to 'calendar/gui/tasks-component.c')
-rw-r--r--calendar/gui/tasks-component.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index ce9f77157f..3472aeb418 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -726,6 +726,33 @@ setup_create_ecal (TasksComponent *component)
}
static void
+create_new_todo (TasksComponent *task_component, CORBA_Environment *ev)
+{
+ TasksComponentPrivate *priv;
+ ECalComponent *comp;
+ TaskEditor *editor;
+ gboolean read_only;
+
+ priv = task_component->priv;
+
+ if (!setup_create_ecal (task_component)) {
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
+ return;
+ }
+
+ if (!e_cal_is_read_only (priv->create_ecal, &read_only, NULL) || read_only);
+ return;
+
+ editor = task_editor_new (priv->create_ecal);
+ comp = get_default_task (priv->create_ecal);
+
+ comp_editor_edit_comp (COMP_EDITOR (editor), comp);
+ comp_editor_focus (COMP_EDITOR (editor));
+
+ e_comp_editor_registry_add (comp_editor_registry, COMP_EDITOR (editor), TRUE);
+}
+
+static void
impl_requestCreateItem (PortableServer_Servant servant,
const CORBA_char *item_type_name,
CORBA_Environment *ev)
@@ -736,25 +763,11 @@ impl_requestCreateItem (PortableServer_Servant servant,
priv = tasks_component->priv;
if (strcmp (item_type_name, CREATE_TASK_ID) == 0) {
- ECalComponent *comp;
- TaskEditor *editor;
-
- if (!setup_create_ecal (tasks_component))
- return;
-
- editor = task_editor_new (priv->create_ecal);
-
- comp = get_default_task (priv->create_ecal);
-
- comp_editor_edit_comp (COMP_EDITOR (editor), comp);
- comp_editor_focus (COMP_EDITOR (editor));
-
- e_comp_editor_registry_add (comp_editor_registry, COMP_EDITOR (editor), TRUE);
+ create_new_todo (tasks_component, ev);
} else if (strcmp (item_type_name, CREATE_TASK_LIST_ID) == 0) {
calendar_setup_new_task_list (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->tasks))));
} else {
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
- return;
}
}