aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-tasks.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2004-01-22 01:55:44 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-01-22 01:55:44 +0800
commit4e676f28fcd8bb7e5430c696bb6e6b711e18bf25 (patch)
treeb20fdca549b69f10c583e46d4fe5707664c14f6c /calendar/gui/e-tasks.c
parent29ca7c6778a87c64230982432ee9364c95f5c614 (diff)
downloadgsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.tar
gsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.tar.gz
gsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.tar.bz2
gsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.tar.lz
gsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.tar.xz
gsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.tar.zst
gsoc2013-evolution-4e676f28fcd8bb7e5430c696bb6e6b711e18bf25.zip
renamed to _source and made them work with ESource's.
2004-01-21 Rodrigo Moya <rodrigo@ximian.com> * gui/e-tasks.[ch] (e_tasks_add_todo_uri, e_tasks_remove_todo_uri, e_tasks_get_default_uri): renamed to _source and made them work with ESource's. * gui/tasks-component.c (update_uri_for_primary_selection, add_uri_for_source, remove_uri_for_source): * gui/tasks-control.c (tasks_control_set_property): updated for changes in e-tasks.[ch]. svn path=/trunk/; revision=24354
Diffstat (limited to 'calendar/gui/e-tasks.c')
-rw-r--r--calendar/gui/e-tasks.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 7b5abba0c9..d4d88a70eb 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -789,27 +789,31 @@ e_tasks_new_task (ETasks *tasks)
}
gboolean
-e_tasks_add_todo_uri (ETasks *tasks, const char *str_uri)
+e_tasks_add_todo_source (ETasks *tasks, ESource *source)
{
ETasksPrivate *priv;
ECal *client;
ECalModel *model;
+ char *str_uri;
GError *error = NULL;
g_return_val_if_fail (tasks != NULL, FALSE);
g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
- g_return_val_if_fail (str_uri != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
priv = tasks->priv;
+ str_uri = e_source_get_uri (source);
client = g_hash_table_lookup (priv->clients, str_uri);
- if (client)
+ if (client) {
+ g_free (str_uri);
return TRUE;
+ }
set_status_message (tasks, _("Opening tasks at %s"), str_uri);
- client = auth_new_cal_from_uri (str_uri, E_CAL_SOURCE_TYPE_TODO);
- g_hash_table_insert (priv->clients, g_strdup (str_uri), client);
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
+ g_hash_table_insert (priv->clients, str_uri, client);
priv->clients_list = g_list_prepend (priv->clients_list, client);
g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), tasks);
@@ -830,6 +834,9 @@ e_tasks_add_todo_uri (ETasks *tasks, const char *str_uri)
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, tasks);
+ g_free (str_uri);
+ g_object_unref (client);
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -849,21 +856,24 @@ e_tasks_add_todo_uri (ETasks *tasks, const char *str_uri)
}
gboolean
-e_tasks_remove_todo_uri (ETasks *tasks, const char *str_uri)
+e_tasks_remove_todo_source (ETasks *tasks, ESource *source)
{
ETasksPrivate *priv;
ECal *client;
ECalModel *model;
+ char *str_uri, *orig_uri;
g_return_val_if_fail (tasks != NULL, FALSE);
g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
- g_return_val_if_fail (str_uri != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
priv = tasks->priv;
- client = g_hash_table_lookup (priv->clients, str_uri);
- if (!client)
+ str_uri = e_source_get_uri (source);
+ if (!g_hash_table_lookup_extended (priv->clients, str_uri, &orig_uri, &client)) {
+ g_free (str_uri);
return TRUE;
+ }
g_hash_table_remove (priv->clients, str_uri);
priv->clients_list = g_list_remove (priv->clients_list, client);
@@ -873,24 +883,31 @@ e_tasks_remove_todo_uri (ETasks *tasks, const char *str_uri)
model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
e_cal_model_remove_client (model, client);
+ g_free (str_uri);
+ g_free (orig_uri);
+ g_object_unref (client);
+
return TRUE;
}
gboolean
-e_tasks_set_default_uri (ETasks *tasks, const char *str_uri)
+e_tasks_set_default_source (ETasks *tasks, ESource *source)
{
ETasksPrivate *priv;
ECal *ecal;
ECalModel *model;
+ char *str_uri;
g_return_val_if_fail (tasks != NULL, FALSE);
g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
- g_return_val_if_fail (str_uri != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
priv = tasks->priv;
+ str_uri = e_source_get_uri (source);
model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
ecal = e_cal_model_get_client_for_uri (model, str_uri);
+ g_free (str_uri);
if (!ecal)
return FALSE;