aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify/config-data.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-08-26 23:56:05 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-08-26 23:56:05 +0800
commit4e8966108728859537ec045decb368251bf078dc (patch)
tree17066ea78b122d70ec7deb6594cd33d828c0d18b /calendar/gui/alarm-notify/config-data.c
parentf95a4634519d4e41c4d1f29ab4f6cf0503a37995 (diff)
downloadgsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.tar
gsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.tar.gz
gsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.tar.bz2
gsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.tar.lz
gsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.tar.xz
gsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.tar.zst
gsoc2013-evolution-4e8966108728859537ec045decb368251bf078dc.zip
Fixes #12326
2002-08-26 Rodrigo Moya <rodrigo@ximian.com> Fixes #12326 * gui/alarm-notify/config-data.c (ensure_inited): create a EConfigListener for configuration access. (do_cleanup): g_atexit installed function, to clean up configuration database resources. (config_data_get_timezone): retrieve the configuration for the EConfigListener object. (config_data_get_listener): new function. * gui/alarm-notify/save.c (get_config_db, discard_config_db): removed. Use EConfigListener instead. (save_notification_time, get_saved_notification_time, save_calendars_to_load, get_calendars_to_load, save_blessed_program, is_blessed_program): use EConfigListener. * gui/alarm-notify/notify-main.c (init_alarm_notify_service): removed. (alarm_notify_factory_fn): create here the alarm_notify_service if it hasn't been created yet. (load_calendars): likewise. (main): don't call init_alarm_notify_service. svn path=/trunk/; revision=17859
Diffstat (limited to 'calendar/gui/alarm-notify/config-data.c')
-rw-r--r--calendar/gui/alarm-notify/config-data.c80
1 files changed, 42 insertions, 38 deletions
diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c
index 71170a3ad6..0e2846308f 100644
--- a/calendar/gui/alarm-notify/config-data.c
+++ b/calendar/gui/alarm-notify/config-data.c
@@ -28,11 +28,8 @@
/* Whether we have initied ourselves by reading the data from the configuration engine */
-static gboolean inited;
-
-/* Configuration values */
-static icaltimezone *local_timezone;
-static gboolean use_24_hour_format;
+static gboolean inited = FALSE;
+static EConfigListener *config;
@@ -41,7 +38,7 @@ static gboolean use_24_hour_format;
*/
static gboolean
locale_supports_12_hour_format (void)
-{
+{
char s[16];
time_t t = 0;
@@ -49,57 +46,58 @@ locale_supports_12_hour_format (void)
return s[0] != '\0';
}
+static void
+do_cleanup (void)
+{
+ gtk_object_unref (GTK_OBJECT (config));
+ config = NULL;
+ inited = FALSE;
+}
+
/* Ensures that the configuration values have been read */
static void
ensure_inited (void)
{
- Bonobo_ConfigDatabase db;
- char *location;
-
if (inited)
return;
inited = TRUE;
- db = get_config_db ();
- if (db == CORBA_OBJECT_NIL) {
- /* This sucks */
- local_timezone = icaltimezone_get_utc_timezone ();
-
- /* This sucks as well */
- use_24_hour_format = TRUE;
-
+ config = e_config_listener_new ();
+ if (!E_IS_CONFIG_LISTENER (config)) {
+ inited = FALSE;
return;
}
- location = bonobo_config_get_string_with_default (db,
- "/Calendar/Display/Timezone", "UTC", NULL);
- if (location && location[0]) {
- local_timezone = icaltimezone_get_builtin_timezone (location);
- } else {
- local_timezone = icaltimezone_get_utc_timezone ();
- }
- g_free (location);
-
- if (locale_supports_12_hour_format ()) {
- /* Wasn't the whole point of a configuration engine *NOT* to
- * have apps specify their own stupid defaults everywhere, but
- * just in a schema file?
- */
- use_24_hour_format = bonobo_config_get_boolean_with_default (
- db,
- "/Calendar/Display/Use24HourFormat", FALSE, NULL);
- } else
- use_24_hour_format = TRUE;
+ g_atexit ((GVoidFunc) do_cleanup);
+}
- discard_config_db (db);
+EConfigListener *
+config_data_get_listener (void)
+{
+ ensure_inited ();
+ return config;
}
icaltimezone *
config_data_get_timezone (void)
{
+ char *location;
+ icaltimezone *local_timezone;
+
ensure_inited ();
+ location = e_config_listener_get_string_with_default (config,
+ "/Calendar/Display/Timezone",
+ "UTC", NULL);
+ if (location && location[0]) {
+ local_timezone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ local_timezone = icaltimezone_get_utc_timezone ();
+ }
+
+ g_free (location);
+
return local_timezone;
}
@@ -108,5 +106,11 @@ config_data_get_24_hour_format (void)
{
ensure_inited ();
- return use_24_hour_format;
+ if (locale_supports_12_hour_format ()) {
+ return e_config_listener_get_boolean_with_default (
+ config,
+ "/Calendar/Display/Use24HourFormat", FALSE, NULL);
+ }
+
+ return TRUE;
}