diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-12-01 23:04:14 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-12-01 23:04:14 +0800 |
commit | faf2cd005b73c7131345859db8c6b3f2b7bb18b6 (patch) | |
tree | 62f94967c81f22fcdaf93a5aced75afcea849199 /calendar/gui/alarm-notify/config-data.c | |
parent | ae58e6cddf5547d17c521e98f8e8c22defb3a1c7 (diff) | |
download | gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.tar gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.tar.gz gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.tar.bz2 gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.tar.lz gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.tar.xz gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.tar.zst gsoc2013-evolution-faf2cd005b73c7131345859db8c6b3f2b7bb18b6.zip |
removed this function, since we now use the ESourceList to know what
2003-12-01 Rodrigo Moya <rodrigo@ximian.com>
* gui/alarm-notify/save.c (save_calendars_to_load): removed this
function, since we now use the ESourceList to know what calendars
to load.
(get_calendars_to_load): moved to config-data.c.
(save_notification_time, get_saved_notification_time,
save_blessed_program, is_blessed_program): use the
shared GConfClient.
* gui/alarm-notify/config-data.[ch]: use a GConfClient instead of a
EConfigListener.
(config_data_get_conf_client): renamed from _get_listener.
(config_data_get_timezone, config_data_get_24_hour_format): changed
to use the GConfClient.
(config_data_get_calendars_to_load): new function.
(ensure_inited): create the source lists for calendar and tasks here.
(do_cleanup): cleanup the source lists here.
* gui/alarm-notify/notify-main.c (load_calendars): use
config_data_get_calendars_to_load().
svn path=/trunk/; revision=23523
Diffstat (limited to 'calendar/gui/alarm-notify/config-data.c')
-rw-r--r-- | calendar/gui/alarm-notify/config-data.c | 78 |
1 files changed, 65 insertions, 13 deletions
diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 8737d0549f..23ec04826a 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -22,6 +22,7 @@ #include <config.h> #endif +#include <libedataserver/e-source-list.h> #include "config-data.h" #include "save.h" @@ -29,7 +30,8 @@ /* Whether we have initied ourselves by reading the data from the configuration engine */ static gboolean inited = FALSE; -static EConfigListener *config; +static GConfClient *conf_client = NULL; +static ESourceList *calendar_source_list = NULL, *tasks_source_list = NULL; @@ -49,8 +51,19 @@ locale_supports_12_hour_format (void) static void do_cleanup (void) { - g_object_unref (config); - config = NULL; + if (calendar_source_list) { + g_object_unref (calendar_source_list); + calendar_source_list = NULL; + } + + if (tasks_source_list) { + g_object_unref (tasks_source_list); + tasks_source_list = NULL; + } + + g_object_unref (conf_client); + conf_client = NULL; + inited = FALSE; } @@ -63,20 +76,27 @@ ensure_inited (void) inited = TRUE; - config = e_config_listener_new (); - if (!E_IS_CONFIG_LISTENER (config)) { + conf_client = gconf_client_get_default (); + if (!GCONF_IS_CLIENT (conf_client)) { inited = FALSE; return; } g_atexit ((GVoidFunc) do_cleanup); + + /* load the sources for calendars and tasks */ + calendar_source_list = e_source_list_new_for_gconf (conf_client, + "/apps/evolution/calendar/sources"); + tasks_source_list = e_source_list_new_for_gconf (conf_client, + "/apps/evolution/tasks/sources"); + } -EConfigListener * +GConfClient * config_data_get_listener (void) { ensure_inited (); - return config; + return conf_client; } icaltimezone * @@ -87,9 +107,9 @@ config_data_get_timezone (void) ensure_inited (); - location = e_config_listener_get_string_with_default (config, - "/apps/evolution/calendar/display/timezone", - "UTC", NULL); + location = gconf_client_get_string (conf_client, + "/apps/evolution/calendar/display/timezone", + NULL); if (location && location[0]) { local_timezone = icaltimezone_get_builtin_timezone (location); } else { @@ -107,10 +127,42 @@ config_data_get_24_hour_format (void) ensure_inited (); if (locale_supports_12_hour_format ()) { - return e_config_listener_get_boolean_with_default ( - config, - "/apps/evolution/calendar/display/use_24hour_format", FALSE, NULL); + return gconf_client_get_bool (conf_client, + "/apps/evolution/calendar/display/use_24hour_format", + NULL); } return TRUE; } + +GPtrArray * +config_data_get_calendars_to_load (void) +{ + GPtrArray *cals; + GSList *groups, *gl, *sources, *sl; + + ensure_inited (); + + /* create the array to be returned */ + cals = g_ptr_array_new (); + + /* process calendar sources */ + groups = e_source_list_peek_groups (calendar_source_list); + for (gl = groups; gl != NULL; gl = gl->next) { + sources = e_source_group_peek_sources (E_SOURCE_GROUP (gl->data)); + for (sl = sources; sl != NULL; sl = sl->next) { + g_ptr_array_add (cals, sl->data); + } + } + + /* process tasks sources */ + groups = e_source_list_peek_groups (tasks_source_list); + for (gl = groups; gl != NULL; gl = gl->next) { + sources = e_source_group_peek_sources (E_SOURCE_GROUP (gl->data)); + for (sl = sources; sl != NULL; sl = sl->next) { + g_ptr_array_add (cals, sl->data); + } + } + + return cals; +} |