aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
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
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')
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/calendar-component.c75
-rw-r--r--calendar/gui/tasks-component.c43
3 files changed, 69 insertions, 61 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 4a5161f63b..923e1512e3 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,15 @@
+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
+
2004-01-14 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-calendar-table.c (e_calendar_table_show_popup_menu):
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 0726ee9ccc..194d4ec563 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -112,26 +112,6 @@ is_in_uids (GSList *uids, ESource *source)
return FALSE;
}
-static ESource *
-find_first_source (ESourceList *source_list)
-{
- GSList *groups, *sources, *l, *m;
-
- groups = e_source_list_peek_groups (source_list);
- for (l = groups; l; l = l->next) {
- ESourceGroup *group = l->data;
-
- sources = e_source_group_peek_sources (group);
- for (m = sources; m; m = m->next) {
- ESource *source = m->data;
-
- return source;
- }
- }
-
- return NULL;
-}
-
static void
update_uris_for_selection (CalendarComponent *calendar_component)
{
@@ -826,52 +806,55 @@ setup_create_ecal (CalendarComponent *calendar_component)
}
static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
+create_new_event (CalendarComponent *calendar_component, gboolean is_allday, gboolean is_meeting, CORBA_Environment *ev)
{
- CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
CalendarComponentPrivate *priv;
ECalComponent *comp;
EventEditor *editor;
- gboolean is_meeting = FALSE;
- gboolean read_only = FALSE;
+ gboolean read_only;
priv = calendar_component->priv;
-
+
if (!setup_create_ecal (calendar_component)) {
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
return;
-
- e_cal_is_read_only (priv->create_ecal, &read_only, NULL);
- if (read_only)
- return;
-
}
+ if (!e_cal_is_read_only (priv->create_ecal, &read_only, NULL) || read_only);
+ return;
+
editor = event_editor_new (priv->create_ecal);
+ comp = get_default_event (priv->create_ecal, is_allday);
+
+ comp_editor_edit_comp (COMP_EDITOR (editor), comp);
+ if (is_meeting)
+ event_editor_show_meeting (editor);
+ 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)
+{
+ CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
+ CalendarComponentPrivate *priv;
+
+ priv = calendar_component->priv;
if (strcmp (item_type_name, CREATE_EVENT_ID) == 0) {
- comp = get_default_event (priv->create_ecal, FALSE);
+ create_new_event (calendar_component, FALSE, FALSE, ev);
} else if (strcmp (item_type_name, CREATE_ALLDAY_EVENT_ID) == 0) {
- comp = get_default_event (priv->create_ecal, TRUE);
+ create_new_event (calendar_component, TRUE, FALSE, ev);
} else if (strcmp (item_type_name, CREATE_MEETING_ID) == 0) {
- comp = get_default_event (priv->create_ecal, FALSE);
- is_meeting = TRUE;
+ create_new_event (calendar_component, FALSE, TRUE, ev);
} else if (strcmp (item_type_name, CREATE_CALENDAR_ID) == 0) {
calendar_setup_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->calendar))));
- return;
} else {
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
- return;
- }
-
- comp_editor_edit_comp (COMP_EDITOR (editor), comp);
- if (is_meeting)
- event_editor_show_meeting (editor);
- comp_editor_focus (COMP_EDITOR (editor));
-
- e_comp_editor_registry_add (comp_editor_registry, COMP_EDITOR (editor), TRUE);
+ }
}
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;
}
}