diff options
-rw-r--r-- | my-evolution/ChangeLog | 28 | ||||
-rw-r--r-- | my-evolution/e-summary-calendar.c | 94 | ||||
-rw-r--r-- | my-evolution/e-summary-preferences.c | 4 | ||||
-rw-r--r-- | my-evolution/e-summary-tasks.c | 114 |
4 files changed, 163 insertions, 77 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 7079382892..e901cd73de 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,31 @@ +2002-10-23 Ettore Perazzoli <ettore@ximian.com> + + * e-summary-preferences.c: Replace Gnotices with Footnotes. + [#31581] + +2002-10-23 Ettore Perazzoli <ettore@ximian.com> + + [#31607 and #31616] + + * e-summary-tasks.c: New member config_listener in ESummaryTasks. + (e_summary_tasks_free): Unref the config_listener. + (config_listener_key_changed_cb): New, callback for the + config_listener. + (setup_task_folder): New helper function to set up access to the + task folder. + (setup_config_listener): New. + (e_summary_tasks_init): Use setup_config_listener() and + setup_task_folder(). + + * e-summary-calendar: New member config_listener in + ESummaryCalendar. + (setup_config_listener): New. + (config_listener_key_changed_cb): New callback for the + config_listener. + (setup_calendar): New. + (e_summary_calendar_init): Use setup_config_listener() and + setup_calendar(). + 2002-10-21 Ettore Perazzoli <ettore@ximian.com> * e-summary-weather.c (e_summary_weather_reconfigure): NULL the diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index d25bc713d6..8d874cc015 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -2,6 +2,7 @@ /* e-summary-calendar.c * * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 2002 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -29,6 +30,9 @@ #include "e-summary-calendar.h" #include "e-summary.h" + +#include "e-util/e-config-listener.h" + #include <cal-client/cal-client.h> #include <cal-util/timeutil.h> @@ -47,6 +51,8 @@ struct _ESummaryCalendar { gboolean wants24hr; char *default_uri; + + EConfigListener *config_listener; }; const char * @@ -506,36 +512,18 @@ locale_uses_24h_time_format (void) return s[0] == '\0'; } -void -e_summary_calendar_init (ESummary *summary) +static void +setup_calendar (ESummary *summary) { - Bonobo_ConfigDatabase db; - CORBA_Environment ev; ESummaryCalendar *calendar; - gboolean result; - g_return_if_fail (summary != NULL); - - calendar = g_new (ESummaryCalendar, 1); - 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; - } + calendar = summary->calendar; + g_assert (calendar != NULL); - CORBA_exception_free (&ev); + if (calendar->client != NULL) + gtk_object_unref (GTK_OBJECT (calendar->client)); calendar->client = cal_client_new (); - if (calendar->client == NULL) { - bonobo_object_release_unref (db, NULL); - g_warning ("Error making the client"); - return; - } gtk_signal_connect (GTK_OBJECT (calendar->client), "cal-opened", GTK_SIGNAL_FUNC (cal_opened_cb), summary); @@ -544,18 +532,58 @@ e_summary_calendar_init (ESummary *summary) gtk_signal_connect (GTK_OBJECT (calendar->client), "obj-removed", GTK_SIGNAL_FUNC (obj_changed_cb), summary); - result = cal_client_open_default_calendar (calendar->client, FALSE); - if (result == FALSE) { + if (! cal_client_open_default_calendar (calendar->client, FALSE)) g_message ("Open calendar failed"); - } - - e_summary_add_protocol_listener (summary, "calendar", e_summary_calendar_protocol, calendar); - calendar->wants24hr = bonobo_config_get_boolean_with_default (db, "/Calendar/Display/Use24HourFormat", locale_uses_24h_time_format (), NULL); - calendar->default_uri = bonobo_config_get_string_with_default (db, "/DefaultFolders/calendar_path", "evolution:/local/Calendar", NULL); + calendar->wants24hr = e_config_listener_get_boolean_with_default (calendar->config_listener, + "/Calendar/Display/Use24HourFormat", + locale_uses_24h_time_format (), NULL); + calendar->default_uri = e_config_listener_get_string_with_default (calendar->config_listener, + "/DefaultFolders/calendar_path", + "evolution:/local/Calendar", NULL); +} - g_print ("Default folder: %s\n", calendar->default_uri); - bonobo_object_release_unref (db, NULL); +static void +config_listener_key_changed_cb (EConfigListener *listener, + const char *key, + void *user_data) +{ + setup_calendar (E_SUMMARY (user_data)); + + generate_html (user_data); +} + +static void +setup_config_listener (ESummary *summary) +{ + ESummaryCalendar *calendar; + + calendar = summary->calendar; + g_assert (calendar != NULL); + + calendar->config_listener = e_config_listener_new (); + + gtk_signal_connect (GTK_OBJECT (calendar->config_listener), "key_changed", + GTK_SIGNAL_FUNC (config_listener_key_changed_cb), summary); + + setup_calendar (summary); +} + +void +e_summary_calendar_init (ESummary *summary) +{ + ESummaryCalendar *calendar; + + g_return_if_fail (summary != NULL); + + calendar = g_new0 (ESummaryCalendar, 1); + summary->calendar = calendar; + calendar->html = NULL; + + setup_config_listener (summary); + setup_calendar (summary); + + e_summary_add_protocol_listener (summary, "calendar", e_summary_calendar_protocol, calendar); } void diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index b3192e2f6f..ebbd943651 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -584,7 +584,7 @@ static struct _RDFInfo rdfs[] = { {"http://www.dictionary.com/wordoftheday/wotd.rss", N_("Dictionary.com Word of the Day"), FALSE}, {"http://www.dvdreview.com/rss/newschannel.rss", "DVD Review", FALSE}, {"http://freshmeat.net/backend/fm.rdf", "Freshmeat", FALSE}, - {"http://news.gnome.org/gnome-news/rdf", "GNotices", FALSE}, + {"http://www.gnomedesktop.org/backend.php", "Footnotes - GNOME News", FALSE}, {"http://headlines.internet.com/internetnews/prod-news/news.rss", "Internet.com", FALSE}, {"http://www.hispalinux.es/backend.php", "HispaLinux", FALSE}, {"http://dot.kde.org/rdf", "KDE Dot News", FALSE}, @@ -1327,8 +1327,6 @@ set_selected_folders (GNOME_Evolution_StorageSetView view) list->_maximum = count; list->_buffer = CORBA_sequence_GNOME_Evolution_Folder_allocbuf (count); -/* CORBA_sequence_set_release (list->_buffer, TRUE); */ - for (i = 0, l = global_preferences->display_folders; l; i++, l = l->next) { ESummaryPrefsFolder *folder = l->data; diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index 11abb30c7f..dd7bc15349 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -2,6 +2,7 @@ /* e-summary-tasks.c * * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 2002 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -29,12 +30,17 @@ #include "e-summary-tasks.h" #include "e-summary.h" + +#include "e-util/e-config-listener.h" + #include <cal-client/cal-client.h> #include <cal-util/timeutil.h> +#include <bonobo/bonobo-event-source.h> #include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-object.h> +#include <bonobo/bonobo-listener.h> #include <bonobo/bonobo-moniker-util.h> +#include <bonobo/bonobo-object.h> #include <bonobo-conf/bonobo-config-database.h> #include <liboaf/liboaf.h> @@ -46,6 +52,8 @@ struct _ESummaryTasks { char *overdue_colour; char *default_uri; + + EConfigListener *config_listener; }; const char * @@ -440,47 +448,31 @@ e_summary_tasks_protocol (ESummary *summary, bonobo_object_release_unref (factory, NULL); } -void -e_summary_tasks_init (ESummary *summary) +static void +setup_task_folder (ESummary *summary) { - Bonobo_ConfigDatabase db; - CORBA_Environment ev; ESummaryTasks *tasks; - gboolean result; - g_return_if_fail (summary != NULL); + tasks = summary->tasks; + g_assert (tasks != NULL); + g_assert (tasks->config_listener != NULL); - CORBA_exception_init (&ev); - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Tasks cannot get database "); - db = CORBA_OBJECT_NIL; - } - CORBA_exception_free (&ev); + g_free (tasks->due_today_colour); + g_free (tasks->overdue_colour); + g_free (tasks->default_uri); - tasks = g_new (ESummaryTasks, 1); - summary->tasks = tasks; - tasks->html = NULL; - - /* Get some configuration values from the calendar */ - if (db != CORBA_OBJECT_NIL) { - - CORBA_exception_init (&ev); - - tasks->due_today_colour = bonobo_config_get_string_with_default (db, "/Calendar/Tasks/Colors/TasksDueToday", "blue", NULL); - tasks->overdue_colour = bonobo_config_get_string_with_default (db, "/Calendar/Tasks/Colors/TasksOverdue", "red", NULL); - - tasks->default_uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_path", &ev); - if (BONOBO_EX (&ev)) { - tasks->default_uri = g_strdup ("evolution:/local/Tasks"); - } - CORBA_exception_free (&ev); - - bonobo_object_release_unref (db, NULL); - } else { - tasks->due_today_colour = g_strdup ("blue"); - tasks->overdue_colour = g_strdup ("red"); - } + tasks->due_today_colour = e_config_listener_get_string_with_default (tasks->config_listener, + "/Calendar/Tasks/Colors/TasksDueToday", "blue", NULL); + tasks->overdue_colour = e_config_listener_get_string_with_default (tasks->config_listener, + "/Calendar/Tasks/Colors/TasksOverdue", "red", NULL); + + tasks->default_uri = e_config_listener_get_string_with_default (tasks->config_listener, + "/DefaultFolders/tasks_path", + NULL, + NULL); + + if (tasks->client != NULL) + gtk_object_unref (GTK_OBJECT (tasks->client)); tasks->client = cal_client_new (); if (tasks->client == NULL) { @@ -495,10 +487,48 @@ e_summary_tasks_init (ESummary *summary) gtk_signal_connect (GTK_OBJECT (tasks->client), "obj-removed", GTK_SIGNAL_FUNC (obj_changed_cb), summary); - result = cal_client_open_default_tasks (tasks->client, FALSE); - if (result == FALSE) { + if (! cal_client_open_default_tasks (tasks->client, FALSE)) g_message ("Open tasks failed"); - } +} + +static void +config_listener_key_changed_cb (EConfigListener *config_listener, + const char *key, + void *user_data) +{ + setup_task_folder (E_SUMMARY (user_data)); + + generate_html (user_data); +} + +static void +setup_config_listener (ESummary *summary) +{ + ESummaryTasks *tasks; + + tasks = summary->tasks; + g_assert (tasks != NULL); + + tasks->config_listener = e_config_listener_new (); + + gtk_signal_connect (GTK_OBJECT (tasks->config_listener), "key_changed", + GTK_SIGNAL_FUNC (config_listener_key_changed_cb), summary); +} + +void +e_summary_tasks_init (ESummary *summary) +{ + ESummaryTasks *tasks; + + g_return_if_fail (summary != NULL); + + tasks = g_new0 (ESummaryTasks, 1); + tasks->config_listener = e_config_listener_new (); + + summary->tasks = tasks; + + setup_config_listener (summary); + setup_task_folder (summary); e_summary_add_protocol_listener (summary, "tasks", e_summary_tasks_protocol, tasks); } @@ -523,7 +553,9 @@ e_summary_tasks_free (ESummary *summary) g_free (tasks->due_today_colour); g_free (tasks->overdue_colour); g_free (tasks->default_uri); - + + gtk_object_unref (GTK_OBJECT (tasks->config_listener)); + g_free (tasks); summary->tasks = NULL; } |