diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-10-30 02:57:55 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-10-30 02:57:55 +0800 |
commit | 54a2c04bc16f8c01f011d99f793573e98209c917 (patch) | |
tree | 9f4c860a2f5435c3b46645c703d42f9030fe7145 | |
parent | 242ed7f944cde5ab4d822e33be50bf689a8ce6b4 (diff) | |
download | gsoc2013-evolution-54a2c04bc16f8c01f011d99f793573e98209c917.tar.gz gsoc2013-evolution-54a2c04bc16f8c01f011d99f793573e98209c917.tar.zst gsoc2013-evolution-54a2c04bc16f8c01f011d99f793573e98209c917.zip |
retrieve the default URI for calendars from the configuration instead of
2001-10-29 Rodrigo Moya <rodrigo@ximian.com>
* e-summary-calendar.c (e_summary_calendar_init): retrieve the
default URI for calendars from the configuration instead of
hard-coding it
* e-summary-tasks.c (e_summary_tasks_init): likewise for tasks
svn path=/trunk/; revision=14352
-rw-r--r-- | my-evolution/ChangeLog | 8 | ||||
-rw-r--r-- | my-evolution/e-summary-calendar.c | 28 | ||||
-rw-r--r-- | my-evolution/e-summary-tasks.c | 23 |
3 files changed, 48 insertions, 11 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 4cc9aada28..9430d0c3e8 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,11 @@ +2001-10-29 Rodrigo Moya <rodrigo@ximian.com> + + * e-summary-calendar.c (e_summary_calendar_init): retrieve the + default URI for calendars from the configuration instead of + hard-coding it + + * e-summary-tasks.c (e_summary_tasks_init): likewise for tasks + 2001-10-29 Ettore Perazzoli <ettore@ximian.com> * e-summary-preferences.c (make_initial_weather_list): We only diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index c4640f0a62..7de4e6a545 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -487,6 +487,7 @@ e_summary_calendar_init (ESummary *summary) ESummaryCalendar *calendar; gboolean result; char *uri; + char *default_uri; g_return_if_fail (summary != NULL); @@ -494,8 +495,19 @@ e_summary_calendar_init (ESummary *summary) summary->calendar = calendar; calendar->html = NULL; + CORBA_exception_init (&ev); + db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { + CORBA_exception_free (&ev); + g_warning ("Error getting Wombat. Using defaults"); + return; + } + + CORBA_exception_free (&ev); + calendar->client = cal_client_new (); if (calendar->client == NULL) { + bonobo_object_release_unref (db, NULL); g_warning ("Error making the client"); return; } @@ -507,7 +519,12 @@ e_summary_calendar_init (ESummary *summary) gtk_signal_connect (GTK_OBJECT (calendar->client), "obj-removed", GTK_SIGNAL_FUNC (obj_changed_cb), summary); - uri = gnome_util_prepend_user_home ("evolution/local/Calendar/calendar.ics"); + default_uri = bonobo_config_get_string (db, "/Calendar/DefaultUri", NULL); + if (!default_uri) + uri = gnome_util_prepend_user_home ("evolution/local/Calendar/calendar.ics"); + else + uri = g_strdup (default_uri); + result = cal_client_open_calendar (calendar->client, uri, FALSE); g_free (uri); if (result == FALSE) { @@ -515,18 +532,9 @@ e_summary_calendar_init (ESummary *summary) } e_summary_add_protocol_listener (summary, "calendar", e_summary_calendar_protocol, calendar); - - CORBA_exception_init (&ev); - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - CORBA_exception_free (&ev); - g_warning ("Error getting Wombat. Using defaults"); - return; - } calendar->wants24hr = bonobo_config_get_boolean_with_default (db, "/Calendar/Display/Use24HourFormat", locale_uses_24h_time_format (), NULL); bonobo_object_release_unref (db, NULL); - CORBA_exception_free (&ev); } void diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index 8fc60f66f5..4700e507da 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -34,6 +34,8 @@ #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-object.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo-conf/bonobo-config-database.h> #include <liboaf/liboaf.h> struct _ESummaryTasks { @@ -374,6 +376,9 @@ e_summary_tasks_init (ESummary *summary) ESummaryTasks *tasks; gboolean result; char *uri; + char *default_uri; + Bonobo_ConfigDatabase db; + CORBA_Environment ev; g_return_if_fail (summary != NULL); @@ -381,8 +386,18 @@ e_summary_tasks_init (ESummary *summary) summary->tasks = tasks; tasks->html = NULL; + CORBA_exception_init (&ev); + db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { + CORBA_exception_free (&ev); + g_warning ("Error getting Wombat. Using defaults"); + } + + CORBA_exception_free (&ev); + tasks->client = cal_client_new (); if (tasks->client == NULL) { + bonobo_object_release_unref (db, NULL); g_warning ("Error making the client"); return; } @@ -394,7 +409,12 @@ e_summary_tasks_init (ESummary *summary) gtk_signal_connect (GTK_OBJECT (tasks->client), "obj-removed", GTK_SIGNAL_FUNC (obj_changed_cb), summary); - uri = gnome_util_prepend_user_home ("evolution/local/Tasks/tasks.ics"); + default_uri = bonobo_config_get_string (db, "/Calendar/DefaultTasksUri", NULL); + if (!default_uri) + uri = gnome_util_prepend_user_home ("evolution/local/Tasks/tasks.ics"); + else + uri = g_strdup (default_uri); + result = cal_client_open_calendar (tasks->client, uri, FALSE); g_free (uri); if (result == FALSE) { @@ -402,6 +422,7 @@ e_summary_tasks_init (ESummary *summary) } e_summary_add_protocol_listener (summary, "tasks", e_summary_tasks_protocol, tasks); + bonobo_object_release_unref (db, NULL); } void |