diff options
author | JP Rosevear <jpr@ximian.com> | 2004-01-25 06:36:04 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-01-25 06:36:04 +0800 |
commit | 419c24ed2a3901b126c461aa91b57a8ee3451d02 (patch) | |
tree | 99d3c899f9123efb64b6ff57868f2251ae43e7e2 /calendar | |
parent | 6332f975fdf4fe1d935dcfa6473af04594e3b424 (diff) | |
download | gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.tar gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.tar.gz gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.tar.bz2 gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.tar.lz gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.tar.xz gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.tar.zst gsoc2013-evolution-419c24ed2a3901b126c461aa91b57a8ee3451d02.zip |
use e_source_list_peek_source_any (setup_create_ecal): ditto
2004-01-24 JP Rosevear <jpr@ximian.com>
* gui/tasks-component.c (update_primary_selection): use
e_source_list_peek_source_any
(setup_create_ecal): ditto
(create_new_todo): just use the default call directly
(update_uris_for_selection): just use e-tasks remove/add todo
source directly
svn path=/trunk/; revision=24416
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 9 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 55 |
2 files changed, 14 insertions, 50 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 472bab359b..f51ae5d262 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,14 @@ 2004-01-24 JP Rosevear <jpr@ximian.com> + * gui/tasks-component.c (update_primary_selection): use + e_source_list_peek_source_any + (setup_create_ecal): ditto + (create_new_todo): just use the default call directly + (update_uris_for_selection): just use e-tasks remove/add todo + source directly + +2004-01-24 JP Rosevear <jpr@ximian.com> + * gui/e-tasks.c (e_tasks_add_todo_source): don't unref and ref, the hash table does this (e_tasks_remove_todo_source): ditto diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 939a4ba207..f037680781 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -81,18 +81,6 @@ struct _TasksComponentPrivate { /* Utility functions. */ /* FIXME Some of these are duplicated from calendar-component.c */ -static void -add_uri_for_source (ESource *source, ETasks *tasks) -{ - e_tasks_add_todo_source (tasks, source); -} - -static void -remove_uri_for_source (ESource *source, ETasks *tasks) -{ - e_tasks_remove_todo_source (tasks, source); -} - static gboolean is_in_selection (GSList *selection, ESource *source) { @@ -123,26 +111,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 (TasksComponent *component) { @@ -157,13 +125,13 @@ update_uris_for_selection (TasksComponent *component) ESource *old_selected_source = l->data; if (!is_in_selection (selection, old_selected_source)) - remove_uri_for_source (old_selected_source, E_TASKS (priv->tasks)); + e_tasks_remove_todo_source (priv->tasks, old_selected_source); } for (l = selection; l; l = l->next) { ESource *selected_source = l->data; - add_uri_for_source (selected_source, E_TASKS (priv->tasks)); + e_tasks_add_todo_source (priv->tasks, selected_source); uids_selected = g_slist_append (uids_selected, (char *)e_source_peek_uid (selected_source)); } @@ -256,26 +224,13 @@ update_primary_selection (TasksComponent *component) if (source) { e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->source_selector), source); } else { - ESource *source; - /* Try to create a default if there isn't one */ - source = find_first_source (priv->source_list); + source = e_source_list_peek_source_any (priv->source_list); if (source) e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->source_selector), source); } } -/* FIXME This is duplicated from comp-editor-factory.c, should it go in comp-util? */ -static ECalComponent * -get_default_task (ECal *ecal) -{ - ECalComponent *comp; - - comp = cal_comp_task_new_with_defaults (ecal); - - return comp; -} - /* Callbacks. */ static void add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, @@ -663,7 +618,7 @@ setup_create_ecal (TasksComponent *component) if (!priv->create_ecal) { /* Try to create a default if there isn't one */ - source = find_first_source (priv->source_list); + source = e_source_list_peek_source_any (priv->source_list); if (source) priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO); } @@ -723,7 +678,7 @@ create_new_todo (TasksComponent *task_component, CORBA_Environment *ev) return; editor = task_editor_new (priv->create_ecal); - comp = get_default_task (priv->create_ecal); + comp = cal_comp_task_new_with_defaults (priv->create_ecal); comp_editor_edit_comp (COMP_EDITOR (editor), comp); comp_editor_focus (COMP_EDITOR (editor)); |