From 731caf5eb269c46696c1cacf63a8e088d0464d93 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 22 Oct 2002 16:43:05 +0000 Subject: use e_config_listener_* to get values (itip_addresses_get): ditto 2002-10-22 JP Rosevear * gui/itip-utils.c (get_address): use e_config_listener_* to get values (itip_addresses_get): ditto (itip_addresses_get_default): ditto * gui/calendar-model.c (calendar_model_value_to_string): don't send back a null string (affects if it is the group header) (calendar_model_init): pre load config database info so we don't do corba calls during draws svn path=/trunk/; revision=18410 --- calendar/gui/calendar-model.c | 8 +++++++- calendar/gui/itip-utils.c | 47 ++++++++++--------------------------------- 2 files changed, 18 insertions(+), 37 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index cef066c1b1..83448d01f8 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -239,6 +239,12 @@ calendar_model_init (CalendarModel *model) priv->zone = NULL; priv->activity = NULL; + + /* Preload here, to avoid corba calls later */ + /* Gross hack because gnome-canvas is not re-entrant */ + calendar_config_get_tasks_due_today_color (); + calendar_config_get_tasks_overdue_color (); + g_free (calendar_config_get_hide_completed_tasks_sexp ()); } static void @@ -1732,7 +1738,7 @@ calendar_model_value_to_string (ETableModel *etm, int col, const void *value) case CAL_COMPONENT_FIELD_PERCENT: if (GPOINTER_TO_INT (value) < 0) - return NULL; + return g_strdup ("N/A"); else return g_strdup_printf ("%i%%", GPOINTER_TO_INT (value)); diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index b3e18422af..76e23e47f1 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include "calendar-config.h" @@ -68,7 +69,7 @@ static icalproperty_method itip_methods_enum[] = { ICAL_METHOD_DECLINECOUNTER, }; -static Bonobo_ConfigDatabase db = NULL; +static EConfigListener *config = NULL; static ItipAddress * get_address (long num) @@ -80,11 +81,11 @@ get_address (long num) /* get the identity info */ path = g_strdup_printf ("/Mail/Accounts/identity_name_%ld", num); - a->name = bonobo_config_get_string (db, path, NULL); + a->name = e_config_listener_get_string_with_default (config, path, NULL, NULL); g_free (path); path = g_strdup_printf ("/Mail/Accounts/identity_address_%ld", num); - a->address = bonobo_config_get_string (db, path, NULL); + a->address = e_config_listener_get_string_with_default (config, path, NULL, NULL); a->address = g_strstrip (a->address); g_free (path); @@ -96,28 +97,14 @@ get_address (long num) GList * itip_addresses_get (void) { - - CORBA_Environment ev; GList *addresses = NULL; glong len, def, i; - if (db == 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); - return NULL; - } - - CORBA_exception_free (&ev); - } + if (config == NULL) + config = e_config_listener_new (); - len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL); - def = bonobo_config_get_long_with_default (db, "/Mail/Accounts/default_account", 0, NULL); + len = e_config_listener_get_long_with_default (config, "/Mail/Accounts/num", 0, NULL); + def = e_config_listener_get_long_with_default (config, "/Mail/Accounts/default_account", 0, NULL); for (i = 0; i < len; i++) { ItipAddress *a; @@ -135,26 +122,14 @@ itip_addresses_get (void) ItipAddress * itip_addresses_get_default (void) { - CORBA_Environment ev; ItipAddress *a; glong def; - if (db == NULL) { - CORBA_exception_init (&ev); - - db = bonobo_get_object ("wombat:", - "Bonobo/ConfigDatabase", - &ev); + if (config == NULL) + config = e_config_listener_new (); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - } + def = e_config_listener_get_long_with_default (config, "/Mail/Accounts/default_account", 0, NULL); - def = bonobo_config_get_long_with_default (db, "/Mail/Accounts/default_account", 0, NULL); a = get_address (def); a->default_address = TRUE; -- cgit v1.2.3