diff options
Diffstat (limited to 'my-evolution')
-rw-r--r-- | my-evolution/ChangeLog | 47 | ||||
-rw-r--r-- | my-evolution/Makefile.am | 22 | ||||
-rw-r--r-- | my-evolution/apps_evolution_summary.schemas | 141 | ||||
-rw-r--r-- | my-evolution/component-factory.c | 15 | ||||
-rw-r--r-- | my-evolution/e-summary-calendar.c | 51 | ||||
-rw-r--r-- | my-evolution/e-summary-preferences.c | 421 | ||||
-rw-r--r-- | my-evolution/e-summary-tasks.c | 46 | ||||
-rw-r--r-- | my-evolution/e-summary-weather.c | 7 | ||||
-rw-r--r-- | my-evolution/e-summary.c | 14 | ||||
-rw-r--r-- | my-evolution/e-summary.h | 6 |
10 files changed, 398 insertions, 372 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 8df7cf1f68..8cd0595167 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,50 @@ +2002-11-20 Ettore Perazzoli <ettore@ximian.com> + + * e-summary.c (e_summary_init): Use GConf. + + * e-summary-tasks.c: Replaced member config_listener in + ESummaryTasks with a gconf_client. + (setup_gconf_client): Renamed from setup_config_listener(). Set + up the GConf client and invoke gconf_client_add_dir() on the + interesting namespaces. + (gconf_client_value_changed_cb): Renamed from + config_listener_value_changed_cb and changed prototype to match + that of the "value_changed" signal in GConfClient. + (setup_task_folder): Updated to use GConf. + + * e-summary-calendar.c: Replaced member config_listener with a + gconf_listener. + (setup_calendar): Use GConf. + (setup_gconf_client): Renamed from setup_config_listener. Set up + a GConf client and invoke gconf_client_add_dir() on the + interesting namespaces. + (gconf_client_value_changed_cb): Renamed from + config_listener_key_changed_cb() and changed prototype to match + that of the "value_changed" signal in GConfClient. + (locale_uses_24h_time_format): Removed. + (e_summary_calendar_free): g_object_unref() the gconf_client. + + * Makefile.am: Add rules to install the schemas. + + * apps_evolution_summary.schemas: New. + + * e-summary-preferences.c: Did a global GList -> GSList switch. + (e_summary_preferences_restore): Use GConfClient instead of + EConfigListener. + (vector_from_folder_list): Removed since GConf makes this useless. + (folder_list_from_vector): Likewise. + (str_list_from_vector): Likewise. + (vector_from_str_list): Likewise. + (make_initial_weather_list): Likewise. + (make_initial_rdf_list): Likewise. + (make_initial_mail_list): Likewise. + (e_summary_preferences_save): Use GConf. + (e_summary_preferences_init): No need to set up defaults here. + + * e-summary.h: Changed members display_folders, rdf_urls, stations + in ESummaryPrefs to be GSLists instead of GLists; updated all the + functions that use them accordingly. + 2002-11-14 Ettore Perazzoli <ettore@ximian.com> * Makefile.am: Added rule to generate diff --git a/my-evolution/Makefile.am b/my-evolution/Makefile.am index b05e0d3c8a..68b10e53c2 100644 --- a/my-evolution/Makefile.am +++ b/my-evolution/Makefile.am @@ -103,6 +103,9 @@ endif Locationdir = $(datadir)/evolution Location_DATA = Locations + +# .server files + server_in_files = GNOME_Evolution_Summary.server.in.in serverdir = $(libdir)/bonobo/servers @@ -110,10 +113,27 @@ server_DATA = $(server_in_files:.server.in.in=.server) $(server_in_files:.server.in.in=.server.in): $(server_in_files) sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ +@INTLTOOL_SERVER_RULE@ + + +# Glade + gladedir = $(datadir)/evolution/glade glade_DATA = my-evolution.glade -@INTLTOOL_SERVER_RULE@ +# GConf schemas + +schemadir = $(GCONF_SCHEMA_FILE_DIR) +schema_DATA = apps_evolution_summary.schemas + +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \ + done \ + fi + +# Extra EXTRA_DIST = \ $(summary_sources) \ diff --git a/my-evolution/apps_evolution_summary.schemas b/my-evolution/apps_evolution_summary.schemas new file mode 100644 index 0000000000..840ff00b37 --- /dev/null +++ b/my-evolution/apps_evolution_summary.schemas @@ -0,0 +1,141 @@ +<gconfschemafile> + <schemalist> + + <!-- Mail section --> + + <schema> + <key>/schemas/apps/evolution/summary/mail/folder_evolution_uris</key> + <applyto>/apps/evolution/summary/mail/folder_evolution_uris</applyto> + <owner>evolution</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>evolution: URIs of the folders to display in the summary</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/summary/mail/folder_physical_uris</key> + <applyto>/apps/evolution/summary/mail/folder_physical_uris</applyto> + <owner>evolution</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Physical URIs of the folders to display in the summary</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/summary/mail/show_full_paths</key> + <applyto>/apps/evolution/summary/mail/show_full_paths</applyto> + <owner>evolution</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Whether to show the full paths to the mail folders displayed in the summary</short> + </locale> + </schema> + + <!-- Calendar section --> + + <schema> + <key>/schemas/apps/evolution/summary/calendar/days_shown</key> + <applyto>/apps/evolution/summary/calendar/days_shown</applyto> + <owner>evolution</owner> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Number of days shown in the calendar section</short> + <long>Use '0' to display one day, '1' to display five days, '2' to display a full week, '3' to display a full month.</long> + </locale> + </schema> + + <!-- Tasks section --> + + <schema> + <key>/schemas/apps/evolution/summary/tasks/show_all</key> + <applyto>/apps/evolution/summary/tasks/show_all</applyto> + <owner>evolution</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Whether to display all pending tasks instead of only today's tasks</short> + </locale> + </schema> + + <!-- RDF section --> + + <schema> + <key>/schemas/apps/evolution/summary/rdf/uris</key> + <applyto>/apps/evolution/summary/rdf/uris</applyto> + <owner>evolution</owner> + <type>list</type> + <list_type>string</list_type> + <default>[http://linuxtoday.com/backend/my-netscape.rdf,http://www.salon.com/feed/RDF/salon_use.rdf]</default> + <locale name="C"> + <short>URIs of the RDF feeds to display in the summary</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/summary/rdf/refresh_time</key> + <applyto>/apps/evolution/summary/rdf/refresh_time</applyto> + <owner>evolution</owner> + <type>int</type> + <default>600</default> + <locale name="C"> + <short>Number of seconds between updates of the RDF feeds in the summary</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/summary/rdf/max_items</key> + <applyto>/apps/evolution/summary/rdf/max_items</applyto> + <owner>evolution</owner> + <type>int</type> + <default>10</default> + <locale name="C"> + <short>Maximum number of recent items to display for each RDF feed</short> + </locale> + </schema> + + <!-- Weather section --> + + <schema> + <key>/schemas/apps/evolution/summary/weather/stations</key> + <applyto>/apps/evolution/summary/weather/stations</applyto> + <owner>evolution</owner> + <type>list</type> + <list_type>string</list_type> + <default>[KBOS]</default> + <locale name="C"> + <short>List of weather stations to display in the summary</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/summary/weather/use_metric</key> + <applyto>/apps/evolution/summary/weather/use_metric</applyto> + <owner>evolution</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Whether to use metric (instead of imperial) units in the summary</short> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/summary/weather/refresh_time</key> + <applyto>/apps/evolution/summary/weather/refresh_time</applyto> + <owner>evolution</owner> + <type>int</type> + <default>600</default> + <locale name="C"> + <short>Number of seconds between updates of the weather section of the summary</short> + </locale> + </schema> + + </schemalist> +</gconfschemafile> diff --git a/my-evolution/component-factory.c b/my-evolution/component-factory.c index d266bf2706..481d817403 100644 --- a/my-evolution/component-factory.c +++ b/my-evolution/component-factory.c @@ -127,9 +127,7 @@ component_destroy (BonoboObject *factory, } static BonoboObject * -create_component (BonoboGenericFactory *factory, - const char *id, - void *data) +create_component (void) { EvolutionShellComponent *shell_component; ESummaryOfflineHandler *offline_handler; @@ -164,12 +162,15 @@ void component_factory_init (void) { BonoboGenericFactory *factory; + Bonobo_RegistrationResult result; + BonoboObject *shell_component; - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, - create_component, - NULL); + shell_component = create_component (); - if (factory == NULL) + result = bonobo_activation_active_server_register (COMPONENT_ID, + bonobo_object_corba_objref (BONOBO_OBJECT (shell_component))); + + if (result != Bonobo_ACTIVATION_REG_SUCCESS) g_error ("Cannot register Evolution Summary component factory."); } diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index 0bb57276e8..71b62829be 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -1,8 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-summary-calendar.c * - * Copyright (C) 2001 Ximian, Inc. - * Copyright (C) 2002 Ximian, Inc. + * Copyright (C) 2001, 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 @@ -31,14 +30,14 @@ #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> #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-moniker-util.h> +#include <gconf/gconf-client.h> + #include <ical.h> #define MAX_RELOAD_TRIES 10 @@ -51,7 +50,7 @@ struct _ESummaryCalendar { char *default_uri; - EConfigListener *config_listener; + GConfClient *gconf_client; int cal_open_reload_timeout_id; int reload_count; @@ -526,16 +525,6 @@ e_summary_calendar_protocol (ESummary *summary, bonobo_object_release_unref (factory, NULL); } -static gboolean -locale_uses_24h_time_format (void) -{ - char s[16]; - time_t t = 0; - - strftime (s, sizeof s, "%p", gmtime (&t)); - return s[0] == '\0'; -} - static void setup_calendar (ESummary *summary) { @@ -562,34 +551,38 @@ setup_calendar (ESummary *summary) if (! cal_client_open_default_calendar (calendar->client, FALSE)) g_message ("Open calendar failed"); - 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); + calendar->wants24hr = gconf_client_get_bool (calendar->gconf_client, + "/apps/evolution/calendar/display/use_24h_format", NULL); + calendar->default_uri = gconf_client_get_string (calendar->gconf_client, + "/apps/evolution/shell/default_folders/celendar_path", + NULL); } static void -config_listener_key_changed_cb (EConfigListener *listener, - const char *key, - void *user_data) +gconf_client_value_changed_cb (GConfClient *client, + const char *key, + GConfValue *value, + void *user_data) { setup_calendar (E_SUMMARY (user_data)); generate_html (user_data); } static void -setup_config_listener (ESummary *summary) +setup_gconf_client (ESummary *summary) { ESummaryCalendar *calendar; calendar = summary->calendar; g_assert (calendar != NULL); - calendar->config_listener = e_config_listener_new (); + calendar->gconf_client = gconf_client_get_default (); - g_signal_connect (calendar->config_listener, "key_changed", G_CALLBACK (config_listener_key_changed_cb), summary); + g_signal_connect (calendar->gconf_client, "value_changed", + G_CALLBACK (gconf_client_value_changed_cb), summary); + + gconf_client_add_dir (calendar->gconf_client, "/apps/evolution/calendar", FALSE, NULL); + gconf_client_add_dir (calendar->gconf_client, "/apps/evolution/shell/default_folders", FALSE, NULL); setup_calendar (summary); } @@ -605,7 +598,7 @@ e_summary_calendar_init (ESummary *summary) summary->calendar = calendar; calendar->html = NULL; - setup_config_listener (summary); + setup_gconf_client (summary); setup_calendar (summary); e_summary_add_protocol_listener (summary, "calendar", e_summary_calendar_protocol, calendar); @@ -635,6 +628,8 @@ e_summary_calendar_free (ESummary *summary) g_free (calendar->html); g_free (calendar->default_uri); + g_object_unref (calendar->gconf_client); + g_free (calendar); summary->calendar = NULL; } diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index 11d49e7874..0d5db9235d 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-summary-preferences.c * - * Copyright (C) 2001 Ximian, Inc. + * Copyright (C) 2001, 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 @@ -42,12 +42,12 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-widget.h> +#include <gconf/gconf-client.h> + #include <shell/evolution-storage-set-view-listener.h> #include <string.h> -#include "e-util/e-config-listener.h" - #include "e-summary.h" #include "e-summary-preferences.h" #include "e-summary-table.h" @@ -60,280 +60,121 @@ static ESummaryPrefs *global_preferences = NULL; static GNOME_Evolution_Shell global_shell = NULL; -static char *default_folders[2] = { - "/local/Inbox", "/local/Outbox" -}; - -static void -make_initial_mail_list (ESummaryPrefs *prefs) -{ - char *evolution_dir; - GList *folders = NULL; - int i; - - evolution_dir = gnome_util_prepend_user_home ("evolution"); - for (i = 0; i < 2; i++) { - ESummaryPrefsFolder *folder; - - folder = g_new (ESummaryPrefsFolder, 1); - folder->evolution_uri = g_strconcat ("evolution:", default_folders[i], NULL); - folder->physical_uri = g_strconcat ("file://", evolution_dir, default_folders[i], NULL); - - folders = g_list_append (folders, folder); - } - - g_free (evolution_dir); - prefs->display_folders = folders; -} - -static void -make_initial_rdf_list (ESummaryPrefs *prefs) -{ - GList *rdfs; - - rdfs = g_list_prepend (NULL, g_strdup ("http://linuxtoday.com/backend/my-netscape.rdf")); - rdfs = g_list_append (rdfs, g_strdup ("http://www.salon.com/feed/RDF/salon_use.rdf")); - - prefs->rdf_urls = rdfs; -} - -static void -make_initial_weather_list (ESummaryPrefs *prefs) -{ - /* translators: Put a list of codes for locations you want to see in - My Evolution by default here. You can find the list of all - stations and their codes in Evolution sources. - (evolution/my-evolution/Locations) - Codes are seperated with : eg. "KBOS:EGAA"*/ - char *default_stations = _("KBOS"), **stations_v, **p; - GList *stations = NULL; - - stations_v = g_strsplit (default_stations, ":", 0); - g_assert (stations_v != NULL); - for (p = stations_v; *p != NULL; p++) { - stations = g_list_prepend (stations, *p); - } - g_free (stations_v); - - prefs->stations = g_list_reverse (stations); -} - -/* Load the prefs off disk */ - -static char * -vector_from_str_list (GList *strlist) -{ - char *vector; - GString *str; - - if (strlist == NULL) { - return g_strdup (""); - } - - str = g_string_new (""); - for (; strlist; strlist = strlist->next) { - g_string_append (str, strlist->data); - - /* No space at end */ - if (strlist->next) { - g_string_append (str, " !<-->! "); - } - } - - vector = str->str; - g_string_free (str, FALSE); - - return vector; -} - -static GList * -str_list_from_vector (const char *vector) +gboolean +e_summary_preferences_restore (ESummaryPrefs *prefs) { - GList *strlist = NULL; - char **tokens, **t; - - t = tokens = g_strsplit (vector, " !<-->! ", 8196); - - if (tokens == NULL) { - return NULL; - } - - for (; *tokens; tokens++) { - strlist = g_list_prepend (strlist, g_strdup (*tokens)); - } + GConfClient *gconf_client; + GSList *path_list; + GSList *uri_list; + GSList *p, *q; - g_strfreev (t); - - strlist = g_list_reverse (strlist); - return strlist; -} + g_return_val_if_fail (prefs != NULL, FALSE); -static GList * -folder_list_from_vector (const char *vector) -{ - GList *flist = NULL; - char **tokens, **t; + gconf_client = gconf_client_get_default (); - t = tokens = g_strsplit (vector, " !<-->! ", 8196); - if (tokens == NULL) { - return NULL; - } + path_list = gconf_client_get_list (gconf_client, "/apps/evolution/summary/mail/folder_evolution_uris", + GCONF_VALUE_STRING, NULL); + uri_list = gconf_client_get_list (gconf_client, "/apps/evolution/summary/mail/folder_physical_uris", + GCONF_VALUE_STRING, NULL); - for (tokens = t; *tokens; tokens += 2) { + prefs->display_folders = NULL; + for (p = path_list, q = uri_list; p != NULL && q != NULL; p = p->next, q = q->next) { ESummaryPrefsFolder *folder; - const char *evolution_uri; - const char *physical_uri; - - evolution_uri = *tokens; - if (evolution_uri == NULL || strncmp (evolution_uri, "evolution:", 10) != 0) - break; - - physical_uri = *(tokens + 1); - if (physical_uri == NULL) - break; folder = g_new (ESummaryPrefsFolder, 1); - folder->evolution_uri = g_strdup (evolution_uri); - folder->physical_uri = g_strdup (physical_uri); - - flist = g_list_prepend (flist, folder); + folder->evolution_uri = p->data; + folder->physical_uri = q->data; } - g_strfreev (t); + g_slist_free (path_list); + g_slist_free (uri_list); - flist = g_list_reverse (flist); - return flist; -} + prefs->show_full_path = gconf_client_get_bool (gconf_client, "/apps/evolution/summary/mail/show_full_paths", NULL); -static char * -vector_from_folder_list (GList *flist) -{ - char *vector; - GString *string; + prefs->rdf_urls = gconf_client_get_list (gconf_client, "/apps/evolution/summary/rdf/uris", + GCONF_VALUE_STRING, NULL); - if (flist == NULL) { - return g_strdup (""); - } + prefs->rdf_refresh_time = gconf_client_get_int (gconf_client, "/apps/evolution/summary/rdf/refresh_time", NULL); - string = g_string_new (""); - for (; flist; flist = flist->next) { - ESummaryPrefsFolder *folder; + prefs->limit = gconf_client_get_int (gconf_client, "/apps/evolution/summary/rdf/max_items", NULL); - folder = flist->data; - string = g_string_append (string, folder->evolution_uri); - string = g_string_append (string, " !<-->! "); - string = g_string_append (string, folder->physical_uri); + prefs->stations = gconf_client_get_list (gconf_client, "/apps/evolution/summary/weather/stations", + GCONF_VALUE_STRING, NULL); - if (flist->next != NULL) { - string = g_string_append (string, " !<-->! "); - } - } + if (gconf_client_get_bool (gconf_client, "/apps/evolution/summary/weather/use_metric", NULL)) + prefs->units = UNITS_METRIC; + else + prefs->units = UNITS_IMPERIAL; - vector = string->str; - g_string_free (string, FALSE); + prefs->weather_refresh_time = gconf_client_get_int (gconf_client, "/apps/evolution/summary/weather/refresh_time", + NULL); + + prefs->days = gconf_client_get_int (gconf_client, "/apps/evolution/summary/calendar/days_shown", NULL); + if (gconf_client_get_bool (gconf_client, "/apps/evolution/summary/tasks/show_all", NULL)) + prefs->show_tasks = E_SUMMARY_CALENDAR_ALL_TASKS; + else + prefs->show_tasks = E_SUMMARY_CALENDAR_ONE_DAY; - return vector; + g_object_unref (gconf_client); + return TRUE; } -gboolean -e_summary_preferences_restore (ESummaryPrefs *prefs) +void +e_summary_preferences_save (ESummaryPrefs *prefs) { - EConfigListener *config_listener; - char *vector; - gboolean used_default; + GConfClient *gconf_client; + GSList *evolution_uri_list, *physical_uri_list; + GSList *p; - g_return_val_if_fail (prefs != NULL, FALSE); + gconf_client = gconf_client_get_default (); - config_listener = e_config_listener_new (); + evolution_uri_list = NULL; + physical_uri_list = NULL; + for (p = prefs->display_folders; p != NULL; p = p->next) { + const ESummaryPrefsFolder *folder; - vector = e_config_listener_get_string (config_listener, "My-Evolution/Mail/display_folders-1.2"); - if (vector == NULL) { - g_warning ("Error getting Mail/display_folders. Using defaults"); - make_initial_mail_list (prefs); - } else { - prefs->display_folders = folder_list_from_vector (vector); - g_free (vector); + folder = (const ESummaryPrefsFolder *) p->data; + evolution_uri_list = g_slist_prepend (evolution_uri_list, folder->evolution_uri); + physical_uri_list = g_slist_prepend (evolution_uri_list, folder->physical_uri); } + evolution_uri_list = g_slist_reverse (evolution_uri_list); + physical_uri_list = g_slist_reverse (physical_uri_list); - prefs->show_full_path = e_config_listener_get_boolean (config_listener, "My-Evolution/Mail/show_full_path"); + gconf_client_set_list (gconf_client, "/apps/evolution/summary/mail/folder_evolution_uris", + GCONF_VALUE_STRING, evolution_uri_list, NULL); + gconf_client_set_list (gconf_client, "/apps/evolution/summary/mail/folder_physical_uris", + GCONF_VALUE_STRING, physical_uri_list, NULL); - vector = e_config_listener_get_string (config_listener, "My-Evolution/RDF/rdf_urls"); - if (vector == NULL) - return FALSE; - - prefs->rdf_urls = str_list_from_vector (vector); - g_free (vector); + g_slist_free (evolution_uri_list); + g_slist_free (physical_uri_list); - prefs->rdf_refresh_time = e_config_listener_get_long_with_default (config_listener, "My-Evolution/RDF/rdf_refresh_time", 600, NULL); + gconf_client_set_bool (gconf_client, "/apps/evolution/summary/mail/show_full_paths", prefs->show_full_path, NULL); - prefs->limit = e_config_listener_get_long_with_default (config_listener, "My-Evolution/RDF/limit", 10, NULL); + gconf_client_set_list (gconf_client, "/apps/evolution/summary/rdf/uris", + GCONF_VALUE_STRING, prefs->rdf_urls, NULL); - vector = e_config_listener_get_string (config_listener, "My-Evolution/Weather/stations"); - if (vector == NULL) - return FALSE; + gconf_client_set_int (gconf_client, "/apps/evolution/summary/rdf/refresh_time", prefs->rdf_refresh_time, NULL); + gconf_client_set_int (gconf_client, "/apps/evolution/summary/rdf/max_items", prefs->limit, NULL); - prefs->stations = str_list_from_vector (vector); - g_free (vector); + gconf_client_set_list (gconf_client, "/apps/evolution/summary/weather/stations", + GCONF_VALUE_STRING, prefs->stations, NULL); - prefs->units = e_config_listener_get_long_with_default (config_listener, "My-Evolution/Weather/units", -1, &used_default); - if (used_default) - return FALSE; + gconf_client_set_bool (gconf_client, "/apps/evolution/summary/weather/use_metric", + prefs->units == UNITS_METRIC, NULL); + gconf_client_set_int (gconf_client, "/apps/evolution/summary/weather/refresh_time", + prefs->weather_refresh_time, NULL); - prefs->weather_refresh_time = e_config_listener_get_long_with_default (config_listener, - "My-Evolution/Weather/weather_refresh_time", - -1, &used_default); - if (used_default) - return FALSE; - - prefs->days = e_config_listener_get_long_with_default (config_listener, "My-Evolution/Schedule/days", -1, &used_default); - if (used_default) - return FALSE; + gconf_client_set_int (gconf_client, "/apps/evolution/summary/calendar/days_shown", + prefs->days, NULL); - prefs->show_tasks = e_config_listener_get_long_with_default (config_listener, "My-Evolution/Schedule/show_tasks", -1, &used_default); - if (&used_default) - return FALSE; + gconf_client_set_bool (gconf_client, "/apps/evolution/summary/tasks/show_all", + prefs->show_tasks == E_SUMMARY_CALENDAR_ALL_TASKS, NULL); - g_object_unref (config_listener); - return TRUE; -} - -/* Write prefs to disk */ -void -e_summary_preferences_save (ESummaryPrefs *prefs) -{ - EConfigListener *config_listener; - char *vector; - - config_listener = e_config_listener_new (); - - vector = vector_from_folder_list (prefs->display_folders); - e_config_listener_set_string (config_listener, "My-Evolution/Mail/display_folders-1.2", vector); - g_free (vector); - - e_config_listener_set_boolean (config_listener, "My-Evolution/Mail/show_full_path", prefs->show_full_path); - - vector = vector_from_str_list (prefs->rdf_urls); - e_config_listener_set_string (config_listener, "My-Evolution/RDF/rdf_urls", vector); - g_free (vector); - - e_config_listener_set_long (config_listener, "My-Evolution/RDF/rdf_refresh_time", prefs->rdf_refresh_time); - e_config_listener_set_long (config_listener, "My-Evolution/RDF/limit", prefs->limit); - - vector = vector_from_str_list (prefs->stations); - e_config_listener_set_string (config_listener, "My-Evolution/Weather/stations", vector); - g_free (vector); - - e_config_listener_set_long (config_listener, "My-Evolution/Weather/units", prefs->units); - e_config_listener_set_long (config_listener, "My-Evolution/Weather/weather_refresh_time", prefs->weather_refresh_time); - - e_config_listener_set_long (config_listener, "My-Evolution/Schedule/days", prefs->days); - e_config_listener_set_long (config_listener, "My-Evolution/Schedule/show_tasks", prefs->show_tasks); - - g_object_unref (config_listener); + g_object_unref (gconf_client); } static void -free_str_list (GList *list) +free_str_list (GSList *list) { for (; list; list = list->next) { g_free (list->data); @@ -341,7 +182,7 @@ free_str_list (GList *list) } static void -free_folder_list (GList *list) +free_folder_list (GSList *list) { for (; list; list = list->next) { ESummaryPrefsFolder *f = list->data; @@ -357,39 +198,39 @@ e_summary_preferences_free (ESummaryPrefs *prefs) { if (prefs->display_folders) { free_folder_list (prefs->display_folders); - g_list_free (prefs->display_folders); + g_slist_free (prefs->display_folders); } if (prefs->rdf_urls) { free_str_list (prefs->rdf_urls); - g_list_free (prefs->rdf_urls); + g_slist_free (prefs->rdf_urls); } if (prefs->stations) { free_str_list (prefs->stations); - g_list_free (prefs->stations); + g_slist_free (prefs->stations); } g_free (prefs); } -static GList * -copy_str_list (GList *list) +static GSList * +copy_str_list (GSList *list) { - GList *list_copy = NULL; + GSList *list_copy = NULL; for (; list; list = list->next) { - list_copy = g_list_prepend (list_copy, g_strdup (list->data)); + list_copy = g_slist_prepend (list_copy, g_strdup (list->data)); } - list_copy = g_list_reverse (list_copy); + list_copy = g_slist_reverse (list_copy); return list_copy; } -static GList * -copy_folder_list (GList *list) +static GSList * +copy_folder_list (GSList *list) { - GList *list_copy = NULL; + GSList *list_copy = NULL; for (; list; list = list->next) { ESummaryPrefsFolder *f1, *f2; @@ -399,10 +240,10 @@ copy_folder_list (GList *list) f2->evolution_uri = g_strdup (f1->evolution_uri); f2->physical_uri = g_strdup (f1->physical_uri); - list_copy = g_list_prepend (list_copy, f2); + list_copy = g_slist_prepend (list_copy, f2); } - list_copy = g_list_reverse (list_copy); + list_copy = g_slist_reverse (list_copy); return list_copy; } @@ -442,27 +283,7 @@ e_summary_preferences_init (void) prefs = g_new0 (ESummaryPrefs, 1); global_preferences = prefs; - if (e_summary_preferences_restore (prefs) == TRUE) { - return prefs; - } - - /* Defaults */ - - /* Mail */ - make_initial_mail_list (prefs); - - /* RDF */ - make_initial_rdf_list (prefs); - prefs->rdf_refresh_time = 600; - prefs->limit = 10; - - /* Weather */ - make_initial_weather_list (prefs); - prefs->units = UNITS_METRIC; - prefs->weather_refresh_time = 600; - - prefs->days = E_SUMMARY_CALENDAR_ONE_DAY; - prefs->show_tasks = E_SUMMARY_CALENDAR_ALL_TASKS; + e_summary_preferences_restore (prefs); return prefs; } @@ -480,7 +301,7 @@ struct _MailPage { GtkWidget *add, *remove; GHashTable *model; - GList *tmp_list; + GSList *tmp_list; }; struct _RDFPage { @@ -489,7 +310,7 @@ struct _RDFPage { GtkWidget *new_button, *delete_url; GHashTable *default_hash, *model; - GList *known, *tmp_list; + GSList *known, *tmp_list; }; struct _WeatherPage { @@ -498,7 +319,7 @@ struct _WeatherPage { GtkWidget *add, *remove; GHashTable *model; - GList *tmp_list; + GSList *tmp_list; }; struct _CalendarPage { @@ -559,7 +380,7 @@ static struct _RDFInfo rdfs[] = { }; static void -save_known_rdfs (GList *rdfs) +save_known_rdfs (GSList *rdfs) { FILE *handle; char *rdf_file; @@ -595,7 +416,7 @@ static gboolean rdf_is_shown (PropertyData *pd, const char *url) { - GList *p; + GSList *p; for (p = global_preferences->rdf_urls; p; p = p->next) { if (strcmp (p->data, url) == 0) { @@ -642,7 +463,7 @@ fill_rdf_etable (GtkWidget *widget, e_summary_shown_add_node (ess, FALSE, entry, NULL, TRUE, NULL); } - pd->rdf->known = g_list_append (pd->rdf->known, &rdfs[i]); + pd->rdf->known = g_slist_append (pd->rdf->known, &rdfs[i]); g_hash_table_insert (pd->rdf->default_hash, rdfs[i].url, &rdfs[i]); } @@ -688,7 +509,7 @@ fill_rdf_etable (GtkWidget *widget, info->name = g_strdup (tokens[1]); info->custom = TRUE; - pd->rdf->known = g_list_append (pd->rdf->known, info); + pd->rdf->known = g_slist_append (pd->rdf->known, info); entry = g_new (ESummaryShownModelEntry, 1); entry->location = g_strdup (info->url); @@ -752,7 +573,7 @@ add_dialog_clicked_cb (GtkWidget *widget, info->name = g_strdup (name); info->custom = TRUE; - pd->rdf->known = g_list_append (pd->rdf->known, info); + pd->rdf->known = g_slist_append (pd->rdf->known, info); entry = g_new (ESummaryShownModelEntry, 1); entry->location = g_strdup (info->url); @@ -833,7 +654,7 @@ rdf_delete_url_cb (GtkButton *button, } e_summary_shown_remove_node (E_SUMMARY_SHOWN (pd->rdf->etable), TRUE, entry); - pd->rdf->known = g_list_remove (pd->rdf->known, entry->data); + pd->rdf->known = g_slist_remove (pd->rdf->known, entry->data); /* FIXME: Remove from shown side as well */ } @@ -1151,20 +972,20 @@ static void free_property_dialog (PropertyData *pd) { if (pd->rdf) { - g_list_free (pd->rdf->known); + g_slist_free (pd->rdf->known); free_str_list (pd->rdf->tmp_list); - g_list_free (pd->rdf->tmp_list); + g_slist_free (pd->rdf->tmp_list); g_free (pd->rdf); } if (pd->mail) { free_str_list (pd->mail->tmp_list); - g_list_free (pd->mail->tmp_list); + g_slist_free (pd->mail->tmp_list); g_free (pd->mail); } if (pd->weather) { free_str_list (pd->weather->tmp_list); - g_list_free (pd->weather->tmp_list); + g_slist_free (pd->weather->tmp_list); g_free (pd->weather); } if (pd->calendar) { @@ -1188,7 +1009,7 @@ set_selected_folders (GNOME_Evolution_StorageSetView view) { GNOME_Evolution_FolderList *list; CORBA_Environment ev; - GList *l; + GSList *l; int i, count; for (count = 0, l = global_preferences->display_folders; l; @@ -1293,21 +1114,21 @@ add_shown_to_list (gpointer key, gpointer data) { ESummaryShownModelEntry *item; - GList **list; + GSList **list; item = (ESummaryShownModelEntry *) value; - list = (GList **) data; + list = (GSList **) data; - *list = g_list_prepend (*list, g_strdup (item->location)); + *list = g_slist_prepend (*list, g_strdup (item->location)); } -static GList * +static GSList * get_folders_from_view (GtkWidget *view) { GNOME_Evolution_StorageSetView set_view; GNOME_Evolution_FolderList *list; CORBA_Environment ev; - GList *out_list = NULL; + GSList *out_list = NULL; int i; set_view = g_object_get_data (G_OBJECT (view), "corba_view"); @@ -1330,7 +1151,7 @@ get_folders_from_view (GtkWidget *view) f = g_new (ESummaryPrefsFolder, 1); f->evolution_uri = g_strdup (folder.evolutionUri); f->physical_uri = g_strdup (folder.physicalUri); - out_list = g_list_append (out_list, f); + out_list = g_slist_append (out_list, f); } return out_list; @@ -1346,7 +1167,7 @@ config_control_apply_cb (EvolutionConfigControl *control, if (pd->rdf->tmp_list) { free_str_list (pd->rdf->tmp_list); - g_list_free (pd->rdf->tmp_list); + g_slist_free (pd->rdf->tmp_list); pd->rdf->tmp_list = NULL; } /* Take each news feed which is on and add it @@ -1356,7 +1177,7 @@ config_control_apply_cb (EvolutionConfigControl *control, if (global_preferences->rdf_urls) { free_str_list (global_preferences->rdf_urls); - g_list_free (global_preferences->rdf_urls); + g_slist_free (global_preferences->rdf_urls); } global_preferences->rdf_urls = copy_str_list (pd->rdf->tmp_list); @@ -1364,7 +1185,7 @@ config_control_apply_cb (EvolutionConfigControl *control, /* Weather */ if (pd->weather->tmp_list) { free_str_list (pd->weather->tmp_list); - g_list_free (pd->weather->tmp_list); + g_slist_free (pd->weather->tmp_list); pd->weather->tmp_list = NULL; } @@ -1372,14 +1193,14 @@ config_control_apply_cb (EvolutionConfigControl *control, add_shown_to_list, &pd->weather->tmp_list); if (global_preferences->stations) { free_str_list (global_preferences->stations); - g_list_free (global_preferences->stations); + g_slist_free (global_preferences->stations); } global_preferences->stations = copy_str_list (pd->weather->tmp_list); /* Folders */ if (pd->mail->tmp_list) { free_str_list (pd->mail->tmp_list); - g_list_free (pd->mail->tmp_list); + g_slist_free (pd->mail->tmp_list); pd->mail->tmp_list = NULL; } #if 0 @@ -1389,7 +1210,7 @@ config_control_apply_cb (EvolutionConfigControl *control, if (global_preferences->display_folders) { free_str_list (global_preferences->display_folders); - g_list_free (global_preferences->display_folders); + g_slist_free (global_preferences->display_folders); } global_preferences->display_folders = copy_str_list (pd->mail->tmp_list); diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index 7763f248ad..3f0ba8ab73 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -31,8 +31,6 @@ #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> @@ -42,6 +40,9 @@ #include <bonobo/bonobo-moniker-util.h> #include <bonobo/bonobo-object.h> +#include <gconf/gconf-client.h> + + #define MAX_RELOAD_TRIES 10 struct _ESummaryTasks { @@ -53,7 +54,7 @@ struct _ESummaryTasks { char *default_uri; - EConfigListener *config_listener; + GConfClient *gconf_client; int cal_open_reload_timeout_id; int reload_count; @@ -478,7 +479,7 @@ setup_task_folder (ESummary *summary) tasks = summary->tasks; g_assert (tasks != NULL); - g_assert (tasks->config_listener != NULL); + g_assert (tasks->gconf_client != NULL); if (tasks->cal_open_reload_timeout_id != 0) { g_source_remove (tasks->cal_open_reload_timeout_id); @@ -490,15 +491,13 @@ setup_task_folder (ESummary *summary) g_free (tasks->overdue_colour); g_free (tasks->default_uri); - 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->due_today_colour = gconf_client_get_string (tasks->gconf_client, + "/apps/evolution/calendar/tasks/colors/TasksDueToday", NULL); + tasks->overdue_colour = gconf_client_get_string (tasks->gconf_client, + "/apps/evolution/calendar/tasks/colors/TasksOverdue", NULL); - tasks->default_uri = e_config_listener_get_string_with_default (tasks->config_listener, - "/DefaultFolders/tasks_path", - NULL, - NULL); + tasks->default_uri = gconf_client_get_string (tasks->gconf_client, + "/apps/evolution/shell/default_folders/tasks_path", NULL); if (tasks->client != NULL) g_object_unref (tasks->client); @@ -518,26 +517,30 @@ setup_task_folder (ESummary *summary) } static void -config_listener_key_changed_cb (EConfigListener *config_listener, - const char *key, - void *user_data) +gconf_client_value_changed_cb (GConfClient *gconf_client, + const char *key, + GConfValue *value, + void *user_data) { setup_task_folder (E_SUMMARY (user_data)); - generate_html (user_data); } static void -setup_config_listener (ESummary *summary) +setup_gconf_client (ESummary *summary) { ESummaryTasks *tasks; tasks = summary->tasks; g_assert (tasks != NULL); - tasks->config_listener = e_config_listener_new (); + tasks->gconf_client = gconf_client_get_default (); + + gconf_client_add_dir (tasks->gconf_client, "/apps/evolution/calendar/tasks/colors", FALSE, NULL); + gconf_client_add_dir (tasks->gconf_client, "/apps/evolution/shell/default_folders", FALSE, NULL); - g_signal_connect (tasks->config_listener, "key_changed", G_CALLBACK (config_listener_key_changed_cb), summary); + g_signal_connect (tasks->gconf_client, "value_changed", + G_CALLBACK (gconf_client_value_changed_cb), summary); } void @@ -548,11 +551,10 @@ e_summary_tasks_init (ESummary *summary) 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_gconf_client (summary); setup_task_folder (summary); e_summary_add_protocol_listener (summary, "tasks", e_summary_tasks_protocol, tasks); @@ -584,7 +586,7 @@ e_summary_tasks_free (ESummary *summary) g_free (tasks->overdue_colour); g_free (tasks->default_uri); - g_object_unref (tasks->config_listener); + g_object_unref (tasks->gconf_client); g_free (tasks); summary->tasks = NULL; diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c index 286a910220..4628d3edbc 100644 --- a/my-evolution/e-summary-weather.c +++ b/my-evolution/e-summary-weather.c @@ -599,7 +599,7 @@ e_summary_weather_init (ESummary *summary) g_strfreev (stations_v); timeout = 600; } else { - GList *p; + GSList *p; for (p = prefs->stations; p; p = p->next) { e_summary_weather_add_location (summary, p->data); @@ -637,7 +637,7 @@ e_summary_weather_code_to_name (const char *code) static gboolean is_weather_shown (const char *code) { - GList *p; + GSList *p; ESummaryPrefs *global_preferences; global_preferences = e_summary_preferences_get_global (); @@ -759,8 +759,9 @@ void e_summary_weather_reconfigure (ESummary *summary) { ESummaryWeather *weather; - GList *old, *p; + GList *old; GList *weather_list; + GSList *p; g_return_if_fail (summary != NULL); g_return_if_fail (IS_E_SUMMARY (summary)); diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index 005c20b6ac..274b469cd6 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -65,11 +65,11 @@ #include <gtk/gtkmain.h> #include <gtk/gtkscrolledwindow.h> +#include <gconf/gconf-client.h> + #include <string.h> #include <unistd.h> -#include "e-util/e-config-listener.h" - #include "e-summary.h" #include "e-summary-preferences.h" #include "my-evolution-html.h" @@ -489,7 +489,7 @@ alarm_fn (gpointer alarm_id, static void e_summary_init (ESummary *summary) { - EConfigListener *config_listener; + GConfClient *gconf_client; ESummaryPrivate *priv; GdkColor bgcolor = {0, 0xffff, 0xffff, 0xffff}; time_t t, day_end; @@ -528,18 +528,16 @@ e_summary_init (ESummary *summary) priv->protocol_hash = NULL; priv->connections = NULL; - config_listener = e_config_listener_new (); + gconf_client = gconf_client_get_default (); - summary->timezone = e_config_listener_get_string_with_default (config_listener, - "/Calendar/Display/Timezone", "UTC", - NULL); + summary->timezone = gconf_client_get_string (gconf_client, "/apps/evolution/calendar/display/timezone", NULL); if (!summary->timezone || !summary->timezone[0]) { g_free (summary->timezone); summary->timezone = g_strdup ("UTC"); } summary->tz = icaltimezone_get_builtin_timezone (summary->timezone); - g_object_unref (config_listener); + g_object_unref (gconf_client); t = time (NULL); if (summary->tz == NULL) { diff --git a/my-evolution/e-summary.h b/my-evolution/e-summary.h index 1eda58bd0e..f787ca4814 100644 --- a/my-evolution/e-summary.h +++ b/my-evolution/e-summary.h @@ -86,16 +86,16 @@ struct _ESummaryPrefsFolder { struct _ESummaryPrefs { /* Mail */ - GList *display_folders; /* List of ESummaryPrefsFolder */ + GSList *display_folders; /* List of ESummaryPrefsFolder */ gboolean show_full_path; /* RDF */ - GList *rdf_urls; + GSList *rdf_urls; int rdf_refresh_time; int limit; /* Weather */ - GList *stations; + GSList *stations; ESummaryWeatherUnits units; int weather_refresh_time; |