aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/conduits/todo/todo-conduit.c2
-rw-r--r--calendar/gui/alarm-notify/config-data.c4
-rw-r--r--calendar/gui/alarm-notify/save.c133
-rw-r--r--calendar/gui/calendar-config.c123
-rw-r--r--calendar/gui/calendar-model.c25
-rw-r--r--calendar/gui/dialogs/event-editor.c18
-rw-r--r--calendar/gui/dialogs/meeting-page.c56
-rw-r--r--calendar/gui/dialogs/task-editor.c15
-rw-r--r--calendar/gui/e-itip-control.c38
-rw-r--r--calendar/gui/itip-utils.c138
-rw-r--r--calendar/gui/itip-utils.h15
-rw-r--r--calendar/pcs/cal-backend-util.c74
-rw-r--r--calendar/pcs/cal-backend-util.h2
13 files changed, 224 insertions, 419 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 6c34db34ba..1633a03d4c 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -449,7 +449,7 @@ get_default_timezone (void)
listener = e_config_listener_new ();
location = e_config_listener_get_string_with_default (listener,
- "/apps/Evolution/Calendar/Display/Timezone", "UTC", NULL);
+ "/apps/evolution/calendar/display/timezone", "UTC", NULL);
if (!location || !location[0]) {
g_free (location);
location = g_strdup ("UTC");
diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c
index babb387e7a..ce179c9b92 100644
--- a/calendar/gui/alarm-notify/config-data.c
+++ b/calendar/gui/alarm-notify/config-data.c
@@ -88,7 +88,7 @@ config_data_get_timezone (void)
ensure_inited ();
location = e_config_listener_get_string_with_default (config,
- "/Calendar/Display/Timezone",
+ "/apps/evolution/calendar/display/timezone",
"UTC", NULL);
if (location && location[0]) {
local_timezone = icaltimezone_get_builtin_timezone (location);
@@ -109,7 +109,7 @@ config_data_get_24_hour_format (void)
if (locale_supports_12_hour_format ()) {
return e_config_listener_get_boolean_with_default (
config,
- "/Calendar/Display/Use24HourFormat", FALSE, NULL);
+ "/apps/evolution/calendar/display/use_24hour_format", FALSE, NULL);
}
return TRUE;
diff --git a/calendar/gui/alarm-notify/save.c b/calendar/gui/alarm-notify/save.c
index a3857cd16c..605b02c6b2 100644
--- a/calendar/gui/alarm-notify/save.c
+++ b/calendar/gui/alarm-notify/save.c
@@ -29,16 +29,15 @@
#include "evolution-calendar.h"
#include "config-data.h"
#include "save.h"
+#include <gconf/gconf-client.h>
/* Key names for the configuration values */
-#define KEY_LAST_NOTIFICATION_TIME "/Calendar/AlarmNotify/LastNotificationTime"
-#define KEY_NUM_CALENDARS_TO_LOAD "/Calendar/AlarmNotify/NumCalendarsToLoad"
-#define BASE_KEY_CALENDAR_TO_LOAD "/Calendar/AlarmNotify/CalendarToLoad"
-#define KEY_NUM_BLESSED_PROGRAMS "/Calendar/AlarmNotify/NumBlessedPrograms"
-#define BASE_KEY_BLESSED_PROGRAM "/Calendar/AlarmNotify/BlessedProgram"
+#define KEY_LAST_NOTIFICATION_TIME "/apps/evolution/calendar/notify/last_notification_time"
+#define KEY_CALENDARS "/apps/evolution/calendar/notify/calendars"
+#define KEY_PROGRAMS "/apps/evolution/calendar/notify/programs"
@@ -100,28 +99,18 @@ get_saved_notification_time (void)
void
save_calendars_to_load (GPtrArray *uris)
{
- EConfigListener *cl;
- int len, i;
+ int i;
+ GConfClient *gconf = gconf_client_get_default();
+ GSList *l = NULL;
g_return_if_fail (uris != NULL);
- if (!(cl = config_data_get_listener ()))
- return;
-
- len = uris->len;
+ for (i=0;i<uris->len;i++)
+ l = g_slist_append(l, uris->pdata[i]);
- e_config_listener_set_long (cl, KEY_NUM_CALENDARS_TO_LOAD, len);
+ gconf_client_set_list(gconf, KEY_CALENDARS, GCONF_VALUE_STRING, l, NULL);
- for (i = 0; i < len; i++) {
- const char *uri;
- char *key;
-
- uri = uris->pdata[i];
-
- key = g_strdup_printf ("%s%d", BASE_KEY_CALENDAR_TO_LOAD, i);
- e_config_listener_set_string (cl, key, uri);
- g_free (key);
- }
+ g_slist_free(l);
}
/**
@@ -135,32 +124,20 @@ save_calendars_to_load (GPtrArray *uris)
GPtrArray *
get_calendars_to_load (void)
{
- EConfigListener *cl;
+ GSList *l, *n;
GPtrArray *uris;
- int len, i;
-
- if (!(cl = config_data_get_listener ()))
- return NULL;
/* Getting the default value below is not necessarily an error, as we
* may not have saved the list of calendar yet.
*/
- len = e_config_listener_get_long_with_default (cl, KEY_NUM_CALENDARS_TO_LOAD, 0, NULL);
-
- uris = g_ptr_array_new ();
- g_ptr_array_set_size (uris, len);
-
- for (i = 0; i < len; i++) {
- char *key;
- gboolean used_default;
-
- key = g_strdup_printf ("%s%d", BASE_KEY_CALENDAR_TO_LOAD, i);
- uris->pdata[i] = e_config_listener_get_string_with_default (cl, key, "", &used_default);
- if (used_default)
- g_message ("get_calendars_to_load(): Could not read calendar name %d", i);
-
- g_free (key);
+ l = gconf_client_get_list(gconf_client_get_default(), KEY_CALENDARS, GCONF_VALUE_STRING, NULL);
+ while (l) {
+ n = l->next;
+ uris = g_ptr_array_new ();
+ g_ptr_array_add(uris, l->data);
+ g_slist_free_1(l);
+ l = n;
}
return uris;
@@ -175,25 +152,14 @@ get_calendars_to_load (void)
void
save_blessed_program (const char *program)
{
- EConfigListener *cl;
- char *key;
- int len;
-
- g_return_if_fail (program != NULL);
-
- if (!(cl = config_data_get_listener ()))
- return;
-
- /* Up the number saved */
- len = e_config_listener_get_long_with_default (cl, KEY_NUM_BLESSED_PROGRAMS, 0, NULL);
- len++;
-
- e_config_listener_set_long (cl, KEY_NUM_BLESSED_PROGRAMS, len);
-
- /* Save the program name */
- key = g_strdup_printf ("%s%d", BASE_KEY_BLESSED_PROGRAM, len - 1);
- e_config_listener_set_string (cl, key, program);
- g_free (key);
+ GConfClient *gconf = gconf_client_get_default();
+ GSList *l;
+
+ l = gconf_client_get_list(gconf, KEY_PROGRAMS, GCONF_VALUE_STRING, NULL);
+ l = g_slist_append(l, g_strdup(program));
+ gconf_client_set_list(gconf, KEY_PROGRAMS, GCONF_VALUE_STRING, l, NULL);
+ g_slist_foreach(l, (GFunc)g_free, NULL);
+ g_slist_free(l);
}
/**
@@ -207,38 +173,19 @@ save_blessed_program (const char *program)
gboolean
is_blessed_program (const char *program)
{
- EConfigListener *cl;
- int len, i;
-
- g_return_val_if_fail (program != NULL, FALSE);
-
- if (!(cl = config_data_get_listener ()))
- return FALSE;
-
- /* Getting the default value below is not necessarily an error, as we
- * may not have saved the list of calendar yet.
- */
-
- len = e_config_listener_get_long_with_default (cl, KEY_NUM_BLESSED_PROGRAMS, 0, NULL);
-
- for (i = 0; i < len; i++) {
- char *key, *value;
- gboolean used_default;
-
- key = g_strdup_printf ("%s%d", BASE_KEY_BLESSED_PROGRAM, i);
- value = e_config_listener_get_string_with_default (cl, key, "", &used_default);
- if (used_default)
- g_message ("get_calendars_to_load(): Could not read calendar name %d", i);
-
- if (value != NULL && !strcmp (value, program)) {
- g_free (key);
- g_free (value);
- return TRUE;
- }
-
- g_free (key);
- g_free (value);
+ GConfClient *gconf = gconf_client_get_default();
+ GSList *l, *n;
+ gboolean found = FALSE;
+
+ l = gconf_client_get_list(gconf, KEY_PROGRAMS, GCONF_VALUE_STRING, NULL);
+ while (l) {
+ n = l->next;
+ if (!found)
+ found = strcmp((char *)l->data, program) == 0;
+ g_free(l->data);
+ g_slist_free_1(l);
+ l = n;
}
- return FALSE;
+ return found;
}
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 0b3d5377d0..9147ef8f16 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -118,7 +118,7 @@ calendar_config_get_timezone (void)
g_free (timezone);
timezone = e_config_listener_get_string_with_default (config,
- "/apps/Evolution/Calendar/Display/Timezone",
+ "/apps/evolution/calendar/display/timezone",
"UTC", NULL);
if (!timezone)
timezone = g_strdup ("UTC");
@@ -133,9 +133,9 @@ void
calendar_config_set_timezone (gchar *timezone)
{
if (timezone && timezone[0])
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Display/Timezone", timezone);
+ e_config_listener_set_string (config, "/apps/evolution/calendar/display/timezone", timezone);
else
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Display/Timezone", "UTC");
+ e_config_listener_set_string (config, "/apps/evolution/calendar/display/timezone", "UTC");
}
@@ -149,7 +149,7 @@ calendar_config_get_24_hour_format (void)
to use 24-hour format, or strftime()/strptime() won't work. */
if (calendar_config_locale_supports_12_hour_format ()) {
return e_config_listener_get_boolean_with_default (
- config, "/apps/Evolution/Calendar/Display/Use24HourFormat", FALSE, NULL);
+ config, "/apps/evolution/calendar/display/use_24hour_format", FALSE, NULL);
}
return TRUE;
@@ -159,7 +159,7 @@ calendar_config_get_24_hour_format (void)
void
calendar_config_set_24_hour_format (gboolean use_24_hour)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Display/Use24HourFormat", use_24_hour);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/display/use_24hour_format", use_24_hour);
}
@@ -167,14 +167,14 @@ calendar_config_set_24_hour_format (gboolean use_24_hour)
gint
calendar_config_get_week_start_day (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/WeekStartDay", 1, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/week_start_day", 1, NULL);
}
void
calendar_config_set_week_start_day (gint week_start_day)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/WeekStartDay", week_start_day);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/week_start_day", week_start_day);
}
@@ -182,56 +182,56 @@ calendar_config_set_week_start_day (gint week_start_day)
gint
calendar_config_get_day_start_hour (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/DayStartHour", 9, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/day_start_hour", 9, NULL);
}
void
calendar_config_set_day_start_hour (gint day_start_hour)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayStartHour", day_start_hour);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/day_start_hour", day_start_hour);
}
gint
calendar_config_get_day_start_minute (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/DayStartMinute", 0, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/day_start_minute", 0, NULL);
}
void
calendar_config_set_day_start_minute (gint day_start_min)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayStartMinute", day_start_min);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/day_start_minute", day_start_min);
}
gint
calendar_config_get_day_end_hour (void)
{
- return e_config_listener_get_long_with_default (config, "/Calendar/Display/DayEndHour", 17, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/day_end_hour", 17, NULL);
}
void
calendar_config_set_day_end_hour (gint day_end_hour)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayEndHour", day_end_hour);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/day_end_hour", day_end_hour);
}
gint
calendar_config_get_day_end_minute (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/DayEndMinute", 0, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/day_end_minute", 0, NULL);
}
void
calendar_config_set_day_end_minute (gint day_end_min)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayEndMinute", day_end_min);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/day_end_minute", day_end_min);
}
@@ -239,14 +239,14 @@ calendar_config_set_day_end_minute (gint day_end_min)
gint
calendar_config_get_time_divisions (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/TimeDivisions", 30, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/time_divisions", 30, NULL);
}
void
calendar_config_set_time_divisions (gint divisions)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/TimeDivisions", divisions);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/time_divisions", divisions);
}
@@ -254,14 +254,14 @@ calendar_config_set_time_divisions (gint divisions)
gboolean
calendar_config_get_dnav_show_week_no (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/DateNavigator/ShowWeekNumbers", FALSE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/date_navigator/show_week_numbers", FALSE, NULL);
}
void
calendar_config_set_dnav_show_week_no (gboolean show_week_no)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/DateNavigator/ShowWeekNumbers", show_week_no);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/date_navigator/show_week_numbers", show_week_no);
}
@@ -269,14 +269,14 @@ calendar_config_set_dnav_show_week_no (gboolean show_week_no)
gint
calendar_config_get_default_view (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/View", 0, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/view", 0, NULL);
}
void
calendar_config_set_default_view (gint view)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/View", view);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/default_view", view);
}
@@ -285,7 +285,7 @@ gfloat
calendar_config_get_hpane_pos (void)
{
return e_config_listener_get_float_with_default (config,
- "/apps/Evolution/Calendar/Display/HPanePosition",
+ "/apps/evolution/calendar/display/hpane_position",
1.0, NULL);
}
@@ -293,49 +293,49 @@ calendar_config_get_hpane_pos (void)
void
calendar_config_set_hpane_pos (gfloat hpane_pos)
{
- e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/HPanePosition", hpane_pos);
+ e_config_listener_set_float (config, "/apps/evolution/calendar/display/hpane_position", hpane_pos);
}
gfloat
calendar_config_get_vpane_pos (void)
{
- return e_config_listener_get_float_with_default (config, "/apps/Evolution/Calendar/Display/VPanePosition", 1.0, NULL);
+ return e_config_listener_get_float_with_default (config, "/apps/evolution/calendar/display/vpane_position", 1.0, NULL);
}
void
calendar_config_set_vpane_pos (gfloat vpane_pos)
{
- e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/VPanePosition", vpane_pos);
+ e_config_listener_set_float (config, "/apps/evolution/calendar/display/vpane_position", vpane_pos);
}
gfloat
calendar_config_get_month_hpane_pos (void)
{
- return e_config_listener_get_float_with_default (config, "/apps/Evolution/Calendar/Display/MonthHPanePosition", 0.0, NULL);
+ return e_config_listener_get_float_with_default (config, "/apps/evolution/calendar/display/month_hpane_position", 0.0, NULL);
}
void
calendar_config_set_month_hpane_pos (gfloat hpane_pos)
{
- e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/MonthHPanePosition", hpane_pos);
+ e_config_listener_set_float (config, "/apps/evolution/calendar/display/month_hpane_position", hpane_pos);
}
gfloat
calendar_config_get_month_vpane_pos (void)
{
- return e_config_listener_get_float_with_default (config, "/apps/Evolution/Calendar/Display/MonthVPanePosition", 1.0, NULL);
+ return e_config_listener_get_float_with_default (config, "/apps/evolution/calendar/display/month_vpane_position", 1.0, NULL);
}
void
calendar_config_set_month_vpane_pos (gfloat vpane_pos)
{
- e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/MonthVPanePosition", vpane_pos);
+ e_config_listener_set_float (config, "/apps/evolution/calendar/display/month_vpane_position", vpane_pos);
}
@@ -343,14 +343,14 @@ calendar_config_set_month_vpane_pos (gfloat vpane_pos)
gboolean
calendar_config_get_compress_weekend (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Display/CompressWeekend", TRUE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/display/compress_weekend", TRUE, NULL);
}
void
calendar_config_set_compress_weekend (gboolean compress)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Display/CompressWeekend", compress);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/display/compress_weekend", compress);
}
@@ -358,14 +358,14 @@ calendar_config_set_compress_weekend (gboolean compress)
gboolean
calendar_config_get_show_event_end (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Display/ShowEventEndTime", TRUE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/display/show_event_end", TRUE, NULL);
}
void
calendar_config_set_show_event_end (gboolean show_end)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Display/ShowEventEndTime", show_end);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/display/show_event_end", show_end);
}
@@ -374,7 +374,7 @@ CalWeekdays
calendar_config_get_working_days (void)
{
return e_config_listener_get_long_with_default (config,
- "/Calendar/Display/WorkingDays", CAL_MONDAY | CAL_TUESDAY |
+ "/apps/evolution/calendar/display/working_days", CAL_MONDAY | CAL_TUESDAY |
CAL_WEDNESDAY | CAL_THURSDAY | CAL_FRIDAY, NULL);
}
@@ -382,7 +382,7 @@ calendar_config_get_working_days (void)
void
calendar_config_set_working_days (CalWeekdays days)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/WorkingDays", days);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/display/working_days", days);
}
@@ -390,14 +390,14 @@ calendar_config_set_working_days (CalWeekdays days)
gboolean
calendar_config_get_hide_completed_tasks (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasks", FALSE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/tasks/hide_completed", FALSE, NULL);
}
void
calendar_config_set_hide_completed_tasks (gboolean hide)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasks", hide);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/tasks/hide_completed", hide);
}
@@ -407,7 +407,7 @@ calendar_config_get_hide_completed_tasks_units (void)
char *units;
CalUnits cu;
- units = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksUnits", "days", NULL);
+ units = e_config_listener_get_string_with_default (config, "/apps/evolution/calendar/tasks/hide_completed_units", "days", NULL);
if (!strcmp (units, "minutes"))
cu = CAL_MINUTES;
@@ -438,7 +438,7 @@ calendar_config_set_hide_completed_tasks_units (CalUnits cu)
units = g_strdup ("days");
}
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksUnits", units);
+ e_config_listener_set_string (config, "/apps/evolution/calendar/tasks/hide_completed_sunits", units);
g_free (units);
}
@@ -447,14 +447,14 @@ calendar_config_set_hide_completed_tasks_units (CalUnits cu)
gint
calendar_config_get_hide_completed_tasks_value (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksValue", 1, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/tasks/hide_completed_value", 1, NULL);
}
void
calendar_config_set_hide_completed_tasks_value (gint value)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksValue", value);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/tasks/hide_completed_value", value);
}
/**
@@ -468,7 +468,7 @@ calendar_config_set_hide_completed_tasks_value (gint value)
gboolean
calendar_config_get_confirm_delete (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Other/ConfirmDelete", TRUE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/prompts/confirm_delete", TRUE, NULL);
}
/**
@@ -481,7 +481,7 @@ calendar_config_get_confirm_delete (void)
void
calendar_config_set_confirm_delete (gboolean confirm)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Other/ConfirmDelete", confirm);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/prompts/confirm_delete", confirm);
}
/**
@@ -495,7 +495,7 @@ calendar_config_set_confirm_delete (gboolean confirm)
gboolean
calendar_config_get_confirm_expunge (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Other/ConfirmExpunge", TRUE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/prompts/confirm_expunge", TRUE, NULL);
}
/**
@@ -508,7 +508,7 @@ calendar_config_get_confirm_expunge (void)
void
calendar_config_set_confirm_expunge (gboolean confirm)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Other/ConfirmExpunge", confirm);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/prompts/confirm_expunge", confirm);
}
/* This sets all the common config settings for an ECalendar widget.
@@ -720,7 +720,7 @@ calendar_config_get_tasks_due_today_color (void)
if (color)
g_free (color);
- color = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksDueToday", "blue", NULL);
+ color = e_config_listener_get_string_with_default (config, "/apps/evolution/calendar/tasks/colors/due_today", "blue", NULL);
return color;
}
@@ -735,7 +735,7 @@ calendar_config_set_tasks_due_today_color (const char *color)
{
g_return_if_fail (color != NULL);
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksDueToday", color);
+ e_config_listener_set_string (config, "/apps/evolution/calendar/tasks/colors/due_today", color);
}
/**
@@ -753,7 +753,7 @@ calendar_config_get_tasks_overdue_color (void)
if (color)
g_free (color);
- color = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksOverdue", "red", NULL);
+ color = e_config_listener_get_string_with_default (config, "/apps/evolution/calendar/tasks/colors/overdue", "red", NULL);
return color;
}
@@ -768,7 +768,7 @@ calendar_config_set_tasks_overdue_color (const char *color)
{
g_return_if_fail (color != NULL);
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksOverdue", color);
+ e_config_listener_set_string (config, "/apps/evolution/calendar/tasks/colors/overdue", color);
}
/**
@@ -784,7 +784,7 @@ calendar_config_set_tasks_overdue_color (const char *color)
gboolean
calendar_config_get_use_default_reminder (void)
{
- return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Other/UseDefaultReminder", FALSE, NULL);
+ return e_config_listener_get_boolean_with_default (config, "/apps/evolution/calendar/other/use_default_reminder", FALSE, NULL);
}
/**
@@ -797,7 +797,7 @@ calendar_config_get_use_default_reminder (void)
void
calendar_config_set_use_default_reminder (gboolean value)
{
- e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Other/UseDefaultReminder", value);
+ e_config_listener_set_boolean (config, "/apps/evolution/calendar/other/use_default_reminder", value);
}
/**
@@ -811,7 +811,7 @@ calendar_config_set_use_default_reminder (gboolean value)
int
calendar_config_get_default_reminder_interval (void)
{
- return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Other/DefaultReminderInterval", 15, NULL);
+ return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/other/default_reminder_interval", 15, NULL);
}
/**
@@ -824,7 +824,7 @@ calendar_config_get_default_reminder_interval (void)
void
calendar_config_set_default_reminder_interval (int interval)
{
- e_config_listener_set_long (config, "/apps/Evolution/Calendar/Other/DefaultReminderInterval", interval);
+ e_config_listener_set_long (config, "/apps/evolution/calendar/other/default_reminder_interval", interval);
}
/**
@@ -841,7 +841,7 @@ calendar_config_get_default_reminder_units (void)
char *units;
CalUnits cu;
- units = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "minutes", NULL);
+ units = e_config_listener_get_string_with_default (config, "/apps/evolution/calendar/other/default_reminder_units", "minutes", NULL);
if (!strcmp (units, "days"))
cu = CAL_DAYS;
@@ -866,16 +866,7 @@ calendar_config_get_default_reminder_units (void)
void
calendar_config_set_default_reminder_units (CalUnits units)
{
- switch (units) {
- case CAL_DAYS :
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "days");
- break;
- case CAL_HOURS :
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "hours");
- break;
- default :
- e_config_listener_set_string (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "minutes");
- }
+ e_config_listener_set_string (config, "/apps/evolution/calendar/other/default_reminder_units", units_to_string(units));
}
/**
@@ -943,7 +934,7 @@ calendar_config_default_calendar_folder (void)
{
char *uri;
- uri = e_config_listener_get_string_with_default (config, "/apps/Evolution/DefaultFolders/calendar_uri", NULL, NULL);
+ uri = e_config_listener_get_string_with_default (config, "/apps/evolution/shell/default_folders/calendar_uri", NULL, NULL);
return uri;
}
@@ -952,7 +943,7 @@ calendar_config_default_tasks_folder (void)
{
char *uri;
- uri = e_config_listener_get_string_with_default (config, "/apps/Evolution/DefaultFolders/tasks_uri", NULL, NULL);
+ uri = e_config_listener_get_string_with_default (config, "/apps/evolution/shell/default_folders/tasks_uri", NULL, NULL);
return uri;
}
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 94cc4e6219..05d402f139 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -97,7 +97,7 @@ struct _CalendarModelPrivate {
gchar *default_category;
/* Addresses for determining icons */
- GList *addresses;
+ EAccountList *accounts;
/* The current timezone. */
icaltimezone *zone;
@@ -215,7 +215,7 @@ calendar_model_init (CalendarModel *model)
priv->timeout_id = g_timeout_add (CALENDAR_MODEL_REFRESH_TIMEOUT,
calendar_model_timeout_cb, model);
- priv->addresses = itip_addresses_get ();
+ priv->accounts = itip_addresses_get ();
priv->zone = NULL;
@@ -340,8 +340,6 @@ calendar_model_finalize (GObject *object)
g_free (priv->default_category);
- itip_addresses_free (priv->addresses);
-
if (priv->activity) {
g_object_unref (priv->activity);
priv->activity = NULL;
@@ -828,7 +826,6 @@ calendar_model_value_at (ETableModel *etm, int col, int row)
case CAL_COMPONENT_FIELD_ICON:
{
- ItipAddress *ia;
GSList *attendees = NULL, *sl;
gint retval = 0;
@@ -842,23 +839,17 @@ calendar_model_value_at (ETableModel *etm, int col, int row)
for (sl = attendees; sl != NULL; sl = sl->next) {
CalComponentAttendee *ca = sl->data;
const char *text;
- GList *l;
text = itip_strip_mailto (ca->value);
- for (l = priv->addresses; l != NULL; l = l->next) {
- ia = l->data;
-
- if (!strcmp (text, ia->address)) {
- if (ca->delto != NULL)
- retval = 3;
- else
- retval = 2;
- goto cleanup;
- }
+ if (e_account_list_find(priv->accounts, E_ACCOUNT_FIND_ID_ADDRESS, text) != NULL) {
+ if (ca->delto != NULL)
+ retval = 3;
+ else
+ retval = 2;
+ break;
}
}
- cleanup:
cal_component_free_attendee_list (attendees);
return GINT_TO_POINTER (retval);
break;
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 462ce43c3f..cc89bd9683 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -303,20 +303,22 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
if (organizer.value != NULL) {
- GList *addresses, *l;
+ EAccountList *accounts;
+ EAccount *account;
+ EIterator *it;
const char *strip;
int row;
strip = itip_strip_mailto (organizer.value);
- addresses = itip_addresses_get ();
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (e_meeting_model_find_attendee (priv->model, a->address, &row))
- e_meeting_model_restricted_add (priv->model, row);
+ accounts = itip_addresses_get ();
+ for (it = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(it);e_iterator_next(it)) {
+ account = (EAccount*)e_iterator_get(it);
+
+ if (e_meeting_model_find_attendee (priv->model, account->id->address, &row))
+ e_meeting_model_restricted_add (priv->model, row);
}
- itip_addresses_free (addresses);
+ g_object_unref(it);
}
if (comp_editor_get_user_org (editor))
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 3a6b0d77bf..d7c1320704 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -77,7 +77,7 @@ struct _MeetingPagePrivate {
CalComponent *comp;
/* List of identities */
- GList *addresses;
+ EAccountList *accounts;
GList *address_strings;
gchar *default_address;
@@ -168,7 +168,7 @@ meeting_page_init (MeetingPage *mpage)
priv->comp = NULL;
- priv->addresses = NULL;
+ priv->accounts = NULL;
priv->address_strings = NULL;
priv->xml = NULL;
@@ -232,8 +232,6 @@ meeting_page_finalize (GObject *object)
cleanup_attendees (priv->deleted_attendees);
g_ptr_array_free (priv->deleted_attendees, FALSE);
- itip_addresses_free (priv->addresses);
-
g_object_unref((priv->model));
if (priv->xml) {
@@ -369,18 +367,22 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
if (!priv->existing) {
gchar *addr = NULL, *cn = NULL, *sentby = NULL, *str;
- GList *l;
+ EIterator *it;
str = e_dialog_editable_get (GTK_COMBO (priv->organizer)->entry);
/* Find the identity for the organizer or sentby field */
- for (l = priv->addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (!strcmp (a->full, str)) {
- addr = g_strdup (a->address);
- cn = g_strdup (a->name);
+ for (it = e_list_get_iterator((EList *)priv->accounts); e_iterator_is_valid(it); e_iterator_next(it)) {
+ EAccount *a = (EAccount *)e_iterator_get(it);
+ char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+
+ if (!strcmp (full, str)) {
+ addr = g_strdup (a->id->address);
+ cn = g_strdup (a->id->name);
+ g_free(full);
+ break;
}
+ g_free(full);
}
g_free (str);
@@ -716,8 +718,9 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
ETable *real_table;
gchar *filename;
const char *backend_address;
- GList *l;
-
+ EIterator *it;
+ EAccount *def_account;
+
priv = mpage->priv;
priv->xml = glade_xml_new (EVOLUTION_GLADEDIR
@@ -737,21 +740,28 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
/* Address information */
backend_address = cal_client_get_email_address (client);
- priv->addresses = itip_addresses_get ();
- for (l = priv->addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- priv->address_strings = g_list_append (priv->address_strings, g_strdup (a->full));
+ priv->accounts = itip_addresses_get ();
+ def_account = itip_addresses_get_default();
+ for (it = e_list_get_iterator((EList *)priv->accounts);
+ e_iterator_is_valid(it);
+ e_iterator_next(it)) {
+ EAccount *a = (EAccount *)e_iterator_get(it);
+ char *full;
+
+ full = g_strdup_printf("%s <%s>", a->id->name, a->id->address);
+
+ priv->address_strings = g_list_append(priv->address_strings, full);
/* Note that the address specified by the backend gets
* precedence over the default mail address.
*/
- if (backend_address && !strcmp (backend_address, a->address))
- priv->default_address = a->full;
- else if (a->default_address && !priv->default_address)
- priv->default_address = a->full;
+ if (backend_address && !strcmp (backend_address, a->id->address))
+ priv->default_address = full;
+ else if (a == def_account && !priv->default_address)
+ priv->default_address = full;
}
-
+ g_object_unref(it);
+
/* The etable displaying attendees and their status */
g_object_ref((emm));
priv->model = emm;
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 73f0c5bf43..5b76c68c75 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -255,20 +255,21 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
if (organizer.value != NULL) {
- GList *addresses, *l;
const char *strip;
int row;
+ EIterator *it;
strip = itip_strip_mailto (organizer.value);
- addresses = itip_addresses_get ();
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (e_meeting_model_find_attendee (priv->model, a->address, &row))
+ for (it = e_list_get_iterator((EList *)itip_addresses_get ());
+ e_iterator_is_valid(it);
+ e_iterator_next(it)) {
+ EAccount *a = (EAccount *)e_iterator_get(it);
+
+ if (e_meeting_model_find_attendee (priv->model, a->id->address, &row))
e_meeting_model_restricted_add (priv->model, row);
}
- itip_addresses_free (addresses);
+ g_object_unref(it);
}
if (comp_editor_get_user_org (editor))
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 42dc7612df..a540a65bef 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -76,7 +76,8 @@ struct _EItipControlPrivate {
gchar *calendar_uri;
- GList *addresses;
+ EAccountList *accounts;
+
gchar *from_address;
gchar *delegator_address;
gchar *delegator_name;
@@ -287,7 +288,7 @@ init (EItipControl *itip)
itip->priv = priv;
/* Addresses */
- priv->addresses = itip_addresses_get ();
+ priv->accounts = itip_addresses_get ();
/* Initialize the cal clients */
priv->event_clients = NULL;
@@ -370,8 +371,7 @@ destroy (GtkObject *obj)
clean_up (itip);
- itip_addresses_free (priv->addresses);
- priv->addresses = NULL;
+ priv->accounts = NULL;
if (priv->event_clients) {
for (i = 0; i < priv->event_clients->len; i++)
@@ -420,7 +420,7 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp)
icalparameter *param;
const char *attendee, *name;
char *attendee_clean, *name_clean;
- GList *l;
+ EIterator *it;
value = icalproperty_get_value (prop);
if (value != NULL) {
@@ -441,26 +441,32 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp)
name = NULL;
name_clean = NULL;
}
-
- for (l = priv->addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
+
+ it = e_list_get_iterator((EList *)priv->accounts);
+ while (e_iterator_is_valid(it)) {
+ const EAccount *account = e_iterator_get(it);
+
/* Check for a matching address */
if (attendee_clean != NULL
- && !g_strcasecmp (a->address, attendee_clean)) {
- priv->my_address = g_strdup (a->address);
+ && !g_ascii_strcasecmp (account->id->address, attendee_clean)) {
+ priv->my_address = g_strdup (account->id->address);
g_free (attendee_clean);
g_free (name_clean);
+ g_free (my_alt_address);
+ g_object_unref(it);
return;
}
/* Check for a matching cname to fall back on */
if (name_clean != NULL
- && !g_strcasecmp (a->name, name_clean))
+ && !g_ascii_strcasecmp (account->id->name, name_clean))
my_alt_address = g_strdup (attendee_clean);
+
+ e_iterator_next(it);
}
g_free (attendee_clean);
g_free (name_clean);
+ g_object_unref(it);
}
priv->my_address = my_alt_address;
@@ -1720,14 +1726,14 @@ change_status (icalcomponent *ical_comp, const char *address, icalparameter_part
param = icalparameter_new_partstat (status);
icalproperty_add_parameter (prop, param);
} else {
- ItipAddress *a;
+ EAccount *a;
a = itip_addresses_get_default ();
- prop = icalproperty_new_attendee (a->address);
+ prop = icalproperty_new_attendee (a->id->address);
icalcomponent_add_property (ical_comp, prop);
- param = icalparameter_new_cn (a->name);
+ param = icalparameter_new_cn (a->id->name);
icalproperty_add_parameter (prop, param);
param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
@@ -1735,8 +1741,6 @@ change_status (icalcomponent *ical_comp, const char *address, icalparameter_part
param = icalparameter_new_partstat (status);
icalproperty_add_parameter (prop, param);
-
- itip_address_free (a);
}
}
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 92e35e6209..d64b86ca9c 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -35,7 +35,6 @@
#include <ical.h>
#include <Evolution-Composer.h>
#include <e-util/e-time-utils.h>
-#include <e-util/e-config-listener.h>
#include <cal-util/timeutil.h>
#include <cal-util/cal-util.h>
#include "calendar-config.h"
@@ -65,99 +64,27 @@ static icalproperty_method itip_methods_enum[] = {
ICAL_METHOD_DECLINECOUNTER,
};
-static EConfigListener *config = NULL;
+static EAccountList *accounts = NULL;
-static ItipAddress *
-get_address (long num)
-{
- ItipAddress *a;
- gchar *path;
-
- a = g_new0 (ItipAddress, 1);
-
- /* get the identity info */
- path = g_strdup_printf ("/Mail/Accounts/identity_name_%ld", num);
- 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 = e_config_listener_get_string_with_default (config, path, NULL, NULL);
- a->address = g_strstrip (a->address);
- g_free (path);
-
- a->full = g_strdup_printf ("%s <%s>", a->name, a->address);
-
- return a;
-}
-
-GList *
+EAccountList *
itip_addresses_get (void)
{
- GList *addresses = NULL;
- glong len, def, i;
-
- if (config == NULL)
- config = e_config_listener_new ();
-
- 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);
+ if (accounts == NULL)
+ accounts = e_account_list_new(gconf_client_get_default());
- for (i = 0; i < len; i++) {
- ItipAddress *a;
-
- a = get_address (i);
- if (i == def)
- a->default_address = TRUE;
-
- addresses = g_list_append (addresses, a);
- }
-
- return addresses;
+ return accounts;
}
-ItipAddress *
+EAccount *
itip_addresses_get_default (void)
{
- ItipAddress *a;
- glong def;
-
- if (config == NULL)
- config = e_config_listener_new ();
-
- def = e_config_listener_get_long_with_default (config, "/Mail/Accounts/default_account", 0, NULL);
-
- a = get_address (def);
- a->default_address = TRUE;
-
- return a;
-}
-
-void
-itip_address_free (ItipAddress *address)
-{
- g_free (address->name);
- g_free (address->address);
- g_free (address->full);
- g_free (address);
-}
-
-void
-itip_addresses_free (GList *addresses)
-{
- GList *l;
-
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
- itip_address_free (a);
- }
- g_list_free (addresses);
+ return (EAccount *)e_account_list_get_default(itip_addresses_get());
}
gboolean
itip_organizer_is_user (CalComponent *comp)
{
CalComponentOrganizer organizer;
- GList *addresses, *l;
const char *strip;
gboolean user_org = FALSE;
@@ -167,17 +94,7 @@ itip_organizer_is_user (CalComponent *comp)
cal_component_get_organizer (comp, &organizer);
if (organizer.value != NULL) {
strip = itip_strip_mailto (organizer.value);
-
- addresses = itip_addresses_get ();
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (!g_strcasecmp (a->address, strip)) {
- user_org = TRUE;
- break;
- }
- }
- itip_addresses_free (addresses);
+ user_org = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
}
return user_org;
@@ -187,7 +104,6 @@ gboolean
itip_sentby_is_user (CalComponent *comp)
{
CalComponentOrganizer organizer;
- GList *addresses, *l;
const char *strip;
gboolean user_sentby = FALSE;
@@ -197,17 +113,7 @@ itip_sentby_is_user (CalComponent *comp)
cal_component_get_organizer (comp, &organizer);
if (organizer.sentby != NULL) {
strip = itip_strip_mailto (organizer.sentby);
-
- addresses = itip_addresses_get ();
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (!g_strcasecmp (a->address, strip)) {
- user_sentby = TRUE;
- break;
- }
- }
- itip_addresses_free (addresses);
+ user_sentby = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
}
return user_sentby;
@@ -631,13 +537,11 @@ static gboolean
comp_limit_attendees (CalComponent *comp)
{
icalcomponent *icomp;
- GList *addresses;
icalproperty *prop;
gboolean found = FALSE, match = FALSE;
GSList *l, *list = NULL;
icomp = cal_component_get_icalcomponent (comp);
- addresses = itip_addresses_get ();
for (prop = icalcomponent_get_first_property (icomp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
@@ -646,7 +550,6 @@ comp_limit_attendees (CalComponent *comp)
icalvalue *value;
const char *attendee;
char *text;
- GList *l;
/* If we've already found something, just erase the rest */
if (found) {
@@ -662,12 +565,7 @@ comp_limit_attendees (CalComponent *comp)
text = g_strdup (itip_strip_mailto (attendee));
text = g_strstrip (text);
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (!g_strcasecmp (a->address, text))
- found = match = TRUE;
- }
+ found = match = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, text) != NULL;
g_free (text);
if (!match)
@@ -683,8 +581,6 @@ comp_limit_attendees (CalComponent *comp)
}
g_slist_free (list);
- itip_addresses_free (addresses);
-
return found;
}
@@ -695,25 +591,25 @@ comp_sentby (CalComponent *comp)
cal_component_get_organizer (comp, &organizer);
if (!organizer.value) {
- ItipAddress *a = itip_addresses_get_default ();
+ EAccount *a = itip_addresses_get_default ();
- organizer.value = g_strdup_printf ("MAILTO:%s", a->address);
+ organizer.value = g_strdup_printf ("MAILTO:%s", a->id->address);
organizer.sentby = NULL;
- organizer.cn = a->name;
+ organizer.cn = a->id->name;
organizer.language = NULL;
cal_component_set_organizer (comp, &organizer);
g_free ((char *) organizer.value);
- itip_address_free (a);
+ g_object_unref(a);
return;
}
if (!itip_organizer_is_user (comp) && !itip_sentby_is_user (comp)) {
- ItipAddress *a = itip_addresses_get_default ();
+ EAccount *a = itip_addresses_get_default ();
organizer.value = g_strdup (organizer.value);
- organizer.sentby = g_strdup_printf ("MAILTO:%s", a->address);
+ organizer.sentby = g_strdup_printf ("MAILTO:%s", a->id->address);
organizer.cn = g_strdup (organizer.cn);
organizer.language = g_strdup (organizer.language);
@@ -723,7 +619,7 @@ comp_sentby (CalComponent *comp)
g_free ((char *)organizer.sentby);
g_free ((char *)organizer.cn);
g_free ((char *)organizer.language);
- itip_address_free (a);
+ g_object_unref(a);
}
}
static CalComponent *
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index f7a06ac9b0..89ad445431 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -7,6 +7,7 @@
#include <glib.h>
#include <cal-client/cal-client.h>
#include <cal-util/cal-component.h>
+#include <e-util/e-account-list.h>
typedef enum {
CAL_COMPONENT_METHOD_PUBLISH,
@@ -19,18 +20,8 @@ typedef enum {
CAL_COMPONENT_METHOD_DECLINECOUNTER
} CalComponentItipMethod;
-typedef struct {
- gchar *name;
- gchar *address;
- gchar *full;
-
- gboolean default_address;
-} ItipAddress;
-
-GList *itip_addresses_get (void);
-ItipAddress *itip_addresses_get_default (void);
-void itip_address_free (ItipAddress *address);
-void itip_addresses_free (GList *addresses);
+EAccountList *itip_addresses_get (void);
+EAccount *itip_addresses_get_default (void);
gboolean itip_organizer_is_user (CalComponent *comp);
gboolean itip_sentby_is_user (CalComponent *comp);
diff --git a/calendar/pcs/cal-backend-util.c b/calendar/pcs/cal-backend-util.c
index a5b6d1adc8..ad39bfcc38 100644
--- a/calendar/pcs/cal-backend-util.c
+++ b/calendar/pcs/cal-backend-util.c
@@ -22,6 +22,9 @@
#include <string.h>
#include "cal-backend-util.h"
+#include <e-util/e-account-list.h>
+
+static EAccountList *accounts;
void
cal_backend_util_fill_alarm_instances_seq (GNOME_Evolution_Calendar_CalAlarmInstanceSeq *seq,
@@ -53,65 +56,36 @@ cal_backend_util_fill_alarm_instances_seq (GNOME_Evolution_Calendar_CalAlarmInst
}
}
-void
-cal_backend_mail_account_get (EConfigListener *db,
- gint def,
- char **address,
- char **name)
-{
- gchar *path;
-
- *address = NULL;
- *name = NULL;
-
- /* get the identity info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_name_%d", def);
- *name = e_config_listener_get_string_with_default (db, path, NULL, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_address_%d", def);
- *address = e_config_listener_get_string_with_default (db, path, NULL, NULL);
- g_free (path);
-}
-
gboolean
cal_backend_mail_account_get_default (EConfigListener *db,
char **address,
char **name)
{
- glong def, len;
-
- *address = NULL;
- *name = NULL;
-
- len = e_config_listener_get_long_with_default (db, "/apps/Evolution/Mail/Accounts/num", 0, NULL);
- def = e_config_listener_get_long_with_default (db, "/apps/Evolution/Mail/Accounts/default_account", 0, NULL);
-
- if (def < len)
- cal_backend_mail_account_get (db, def, address, name);
- else
- return FALSE;
-
- return TRUE;
+ const EAccount *account;
+
+ if (accounts == NULL)
+ accounts = e_account_list_new(gconf_client_get_default());
+
+ account = e_account_list_get_default(accounts);
+ if (account) {
+ *address = g_strdup(account->id->address);
+ *name = g_strdup(account->id->name);
+ }
+
+ return account != NULL;
}
gboolean
cal_backend_mail_account_is_valid (EConfigListener *db, char *user, char **name)
{
- gchar *address;
- glong len, i;
-
- len = e_config_listener_get_long_with_default (db, "/apps/Evolution/Mail/Accounts/num", 0, NULL);
-
- for (i = 0; i < len; i++) {
- cal_backend_mail_account_get (db, i, &address, name);
- if (address != NULL && !strcmp (address, user)) {
- g_free (address);
- return TRUE;
- }
- g_free (address);
- g_free (*name);
- }
+ const EAccount *account;
+
+ if (accounts == NULL)
+ accounts = e_account_list_new(gconf_client_get_default());
+
+ account = e_account_list_find(accounts, E_ACCOUNT_FIND_ID_ADDRESS, user);
+ if (account)
+ *name = g_strdup(account->id->name);
- return FALSE;
+ return account != NULL;
}
diff --git a/calendar/pcs/cal-backend-util.h b/calendar/pcs/cal-backend-util.h
index 20c07f0799..6ce9d59807 100644
--- a/calendar/pcs/cal-backend-util.h
+++ b/calendar/pcs/cal-backend-util.h
@@ -39,8 +39,6 @@ void cal_backend_util_fill_alarm_instances_seq (
* Functions for accessing mail configuration
*/
-void cal_backend_mail_account_get (EConfigListener *db, gint def,
- char **address, char **name);
gboolean cal_backend_mail_account_get_default (EConfigListener *db,
char **address, char **name);
gboolean cal_backend_mail_account_is_valid (EConfigListener *db,