[evolution/account-mgmt: 18/48] Adapt calendar/gui to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 18/48] Adapt calendar/gui to the new ESource API.
- Date: Fri, 11 Nov 2011 01:26:54 +0000 (UTC)
commit 092a537d7ab9620e8ab1e8223e4f11f84c4e6ca3
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Dec 13 16:05:32 2010 -0500
Adapt calendar/gui to the new ESource API.
calendar/gui/alarm-notify/config-data.h | 1 -
calendar/gui/dialogs/Makefile.am | 3 -
calendar/gui/dialogs/alarm-dialog.c | 7 +-
calendar/gui/dialogs/alarm-dialog.h | 2 +
calendar/gui/dialogs/alarm-list-dialog.c | 13 +-
calendar/gui/dialogs/alarm-list-dialog.h | 5 +-
calendar/gui/dialogs/calendar-setup.c | 697 ---------------------------
calendar/gui/dialogs/calendar-setup.h | 44 --
calendar/gui/dialogs/comp-editor.c | 40 ++-
calendar/gui/dialogs/copy-source-dialog.c | 14 +-
calendar/gui/dialogs/copy-source-dialog.h | 3 +-
calendar/gui/dialogs/e-delegate-dialog.c | 11 +-
calendar/gui/dialogs/e-delegate-dialog.h | 5 +-
calendar/gui/dialogs/e-send-options-utils.c | 60 ++-
calendar/gui/dialogs/e-send-options-utils.h | 2 +-
calendar/gui/dialogs/event-editor.c | 15 +-
calendar/gui/dialogs/event-page.c | 128 +++---
calendar/gui/dialogs/event-page.ui | 1 +
calendar/gui/dialogs/memo-page.c | 130 +++---
calendar/gui/dialogs/memo-page.ui | 1 +
calendar/gui/dialogs/select-source-dialog.c | 62 +--
calendar/gui/dialogs/select-source-dialog.h | 3 +-
calendar/gui/dialogs/task-editor.c | 14 +-
calendar/gui/dialogs/task-page.c | 113 ++---
calendar/gui/dialogs/task-page.ui | 1 +
calendar/gui/e-cal-component-preview.c | 2 +-
calendar/gui/e-cal-config.c | 2 +
calendar/gui/e-cal-event.c | 4 -
calendar/gui/e-cal-event.h | 4 -
calendar/gui/e-cal-model-calendar.c | 16 +-
calendar/gui/e-cal-model-calendar.h | 2 +-
calendar/gui/e-cal-model-memos.c | 9 +-
calendar/gui/e-cal-model-memos.h | 2 +-
calendar/gui/e-cal-model-tasks.c | 8 +-
calendar/gui/e-cal-model-tasks.h | 2 +-
calendar/gui/e-cal-model.c | 138 ++++--
calendar/gui/e-cal-model.h | 8 +-
calendar/gui/e-cal-source-config.c | 42 +-
calendar/gui/e-cal-source-config.h | 7 +-
calendar/gui/e-calendar-selector.c | 9 +-
calendar/gui/e-calendar-selector.h | 3 +-
calendar/gui/e-calendar-view.c | 59 ++-
calendar/gui/e-day-view.c | 54 ++-
calendar/gui/e-meeting-list-view.c | 17 +-
calendar/gui/e-meeting-store.c | 37 +-
calendar/gui/e-memo-list-selector.c | 24 +-
calendar/gui/e-memo-list-selector.h | 3 +-
calendar/gui/e-task-list-selector.c | 24 +-
calendar/gui/e-task-list-selector.h | 3 +-
calendar/gui/gnome-cal.c | 62 +++-
calendar/gui/gnome-cal.h | 5 +-
calendar/gui/itip-utils.c | 219 ++++++---
calendar/gui/itip-utils.h | 24 +-
53 files changed, 878 insertions(+), 1286 deletions(-)
---
diff --git a/calendar/gui/alarm-notify/config-data.h b/calendar/gui/alarm-notify/config-data.h
index 705e69e..2bdbd99 100644
--- a/calendar/gui/alarm-notify/config-data.h
+++ b/calendar/gui/alarm-notify/config-data.h
@@ -29,7 +29,6 @@
#include <libical/ical.h>
#include <libecal/e-cal-client.h>
#include <gconf/gconf-client.h>
-#include <libedataserver/e-source-list.h>
GConfClient * config_data_get_conf_client (void);
icaltimezone * config_data_get_timezone (void);
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index b7235ed..02af20b 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -24,7 +24,6 @@ ecalendarinclude_HEADERS = \
comp-editor.h \
alarm-dialog.h \
alarm-list-dialog.h \
- calendar-setup.h \
cancel-comp.h \
changed-comp.h \
comp-editor-util.h \
@@ -59,8 +58,6 @@ libcal_dialogs_la_SOURCES = \
alarm-dialog.h \
alarm-list-dialog.c \
alarm-list-dialog.h \
- calendar-setup.c \
- calendar-setup.h \
cancel-comp.c \
cancel-comp.h \
changed-comp.c \
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index 4576f3d..d324a5c 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -55,6 +55,8 @@ typedef struct {
/* The client */
ECalClient *cal_client;
+ ESourceRegistry *registry;
+
/* Toplevel */
GtkWidget *toplevel;
@@ -914,7 +916,7 @@ setup_select_names (Dialog *dialog)
ENameSelectorModel *name_selector_model;
ENameSelectorDialog *name_selector_dialog;
- dialog->name_selector = e_name_selector_new ();
+ dialog->name_selector = e_name_selector_new (dialog->registry);
e_name_selector_load_books (dialog->name_selector);
name_selector_model = e_name_selector_peek_model (dialog->name_selector);
@@ -1213,6 +1215,7 @@ init_widgets (Dialog *dialog)
gboolean
alarm_dialog_run (GtkWidget *parent,
+ ESourceRegistry *registry,
ECalClient *cal_client,
ECalComponentAlarm *alarm)
{
@@ -1220,10 +1223,12 @@ alarm_dialog_run (GtkWidget *parent,
GtkWidget *container;
gint response_id;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
g_return_val_if_fail (alarm != NULL, FALSE);
dialog.alarm = alarm;
dialog.cal_client = cal_client;
+ dialog.registry = registry;
dialog.builder = gtk_builder_new ();
e_load_ui_builder_definition (dialog.builder, "alarm-dialog.ui");
diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h
index 42c72d6..6e6d658 100644
--- a/calendar/gui/dialogs/alarm-dialog.h
+++ b/calendar/gui/dialogs/alarm-dialog.h
@@ -32,10 +32,12 @@
#include <libecal/e-cal-client.h>
#include <libecal/e-cal-component.h>
+#include <libedataserver/e-source-registry.h>
G_BEGIN_DECLS
gboolean alarm_dialog_run (GtkWidget *parent,
+ ESourceRegistry *registry,
ECalClient *cal_client,
ECalComponentAlarm *alarm);
diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c
index 4fb5884..1579096 100644
--- a/calendar/gui/dialogs/alarm-list-dialog.c
+++ b/calendar/gui/dialogs/alarm-list-dialog.c
@@ -45,6 +45,7 @@
typedef struct {
GtkBuilder *builder;
+ ESourceRegistry *registry;
/* The client */
ECalClient *cal_client;
@@ -128,7 +129,7 @@ add_clicked_cb (GtkButton *button,
icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
icalcomponent_add_property (icalcomp, icalprop);
- if (alarm_dialog_run (dialog->toplevel, dialog->cal_client, alarm)) {
+ if (alarm_dialog_run (dialog->toplevel, dialog->registry, dialog->cal_client, alarm)) {
e_alarm_list_append (dialog->list_store, &iter, alarm);
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (view), &iter);
} else {
@@ -161,7 +162,7 @@ edit_clicked_cb (GtkButton *button,
alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (dialog->list_store, &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->list_store), &iter);
- if (alarm_dialog_run (dialog->toplevel, dialog->cal_client, alarm)) {
+ if (alarm_dialog_run (dialog->toplevel, dialog->registry, dialog->cal_client, alarm)) {
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (view), &iter);
gtk_tree_model_row_changed (GTK_TREE_MODEL (dialog->list_store), path, &iter);
}
@@ -267,6 +268,7 @@ init_widgets (Dialog *dialog)
gboolean
alarm_list_dialog_run (GtkWidget *parent,
+ ESourceRegistry *registry,
ECalClient *cal_client,
EAlarmList *list_store)
{
@@ -274,6 +276,9 @@ alarm_list_dialog_run (GtkWidget *parent,
GtkWidget *container;
gint response_id;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
+ dialog.registry = registry;
dialog.cal_client = cal_client;
dialog.list_store = list_store;
@@ -314,12 +319,14 @@ alarm_list_dialog_run (GtkWidget *parent,
}
GtkWidget *
-alarm_list_dialog_peek (ECalClient *cal_client,
+alarm_list_dialog_peek (ESourceRegistry *registry,
+ ECalClient *cal_client,
EAlarmList *list_store)
{
Dialog *dialog;
dialog = (Dialog *) g_new (Dialog, 1);
+ dialog->registry = registry;
dialog->cal_client = cal_client;
dialog->list_store = list_store;
diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h
index 5746664..1717d12 100644
--- a/calendar/gui/dialogs/alarm-list-dialog.h
+++ b/calendar/gui/dialogs/alarm-list-dialog.h
@@ -32,14 +32,17 @@
#include <libecal/e-cal-client.h>
#include <libecal/e-cal-component.h>
+#include <libedataserver/e-source-registry.h>
#include "../e-alarm-list.h"
G_BEGIN_DECLS
gboolean alarm_list_dialog_run (GtkWidget *parent,
+ ESourceRegistry *registry,
ECalClient *cal_client,
EAlarmList *list_store);
-GtkWidget * alarm_list_dialog_peek (ECalClient *cal_client,
+GtkWidget * alarm_list_dialog_peek (ESourceRegistry *registry,
+ ECalClient *cal_client,
EAlarmList *list_store);
void alarm_list_dialog_set_client (GtkWidget *dlg_box,
ECalClient *cal_client);
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 4fa0250..c880473 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -474,6 +474,8 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CompEditorFlags flags;
ECalComponent *clone;
+ ESourceRegistry *registry;
+ EShell *shell;
GList *l;
gboolean result;
GError *error = NULL;
@@ -488,6 +490,9 @@ save_comp (CompEditor *editor)
return TRUE;
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
/* Stop listening because we are about to change things */
if (priv->view) {
@@ -521,8 +526,8 @@ save_comp (CompEditor *editor)
/* If we are not the organizer, we don't update the sequence number */
if (!e_cal_component_has_organizer (clone) ||
- itip_organizer_is_user (clone, priv->cal_client) ||
- itip_sentby_is_user (clone, priv->cal_client))
+ itip_organizer_is_user (registry, clone, priv->cal_client) ||
+ itip_sentby_is_user (registry, clone, priv->cal_client))
e_cal_component_commit_sequence (clone);
else
e_cal_component_abort_sequence (clone);
@@ -576,8 +581,8 @@ save_comp (CompEditor *editor)
if (priv->mod == CALOBJ_MOD_THIS) {
if (result && ((flags & COMP_EDITOR_DELEGATE) ||
!e_cal_component_has_organizer (clone) ||
- itip_organizer_is_user (clone, priv->cal_client) ||
- itip_sentby_is_user (clone, priv->cal_client)))
+ itip_organizer_is_user (registry, clone, priv->cal_client) ||
+ itip_sentby_is_user (registry, clone, priv->cal_client)))
e_cal_component_commit_sequence (clone);
else
e_cal_component_abort_sequence (clone);
@@ -674,6 +679,8 @@ save_comp_with_send (CompEditor *editor)
{
CompEditorPrivate *priv;
CompEditorFlags flags;
+ ESourceRegistry *registry;
+ EShell *shell;
gboolean send, delegated, only_new_attendees = FALSE;
gboolean delegate;
gboolean strip_alarms = TRUE;
@@ -681,6 +688,10 @@ save_comp_with_send (CompEditor *editor)
priv = editor->priv;
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
+
send = priv->changed && priv->needs_send;
delegate = flags & COMP_EDITOR_DELEGATE;
@@ -710,8 +721,8 @@ save_comp_with_send (CompEditor *editor)
(only_new_attendees ?
COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY : 0));
- if ((itip_organizer_is_user (priv->comp, priv->cal_client) ||
- itip_sentby_is_user (priv->comp, priv->cal_client))) {
+ if ((itip_organizer_is_user (registry, priv->comp, priv->cal_client) ||
+ itip_sentby_is_user (registry, priv->comp, priv->cal_client))) {
if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL)
return comp_editor_send_comp (
editor, E_CAL_COMPONENT_METHOD_PUBLISH,
@@ -952,7 +963,7 @@ action_save_cb (GtkAction *action,
e_alert_submit (
E_ALERT_SINK (editor),
"calendar:prompt-read-only-cal-editor",
- e_source_peek_name (
+ e_source_get_display_name (
e_client_get_source (E_CLIENT (priv->cal_client))),
NULL);
return;
@@ -964,7 +975,7 @@ action_save_cb (GtkAction *action,
e_alert_submit (
E_ALERT_SINK (editor),
"calendar:prompt-no-task-assignment-editor",
- e_source_peek_name (
+ e_source_get_display_name (
e_client_get_source (E_CLIENT (priv->cal_client))),
NULL);
return;
@@ -2217,7 +2228,7 @@ prompt_and_save_changes (CompEditor *editor,
e_alert_submit (
E_ALERT_SINK (editor),
"calendar:prompt-read-only-cal-editor",
- e_source_peek_name (
+ e_source_get_display_name (
e_client_get_source (E_CLIENT (priv->cal_client))),
NULL);
/* don't discard changes when selected readonly calendar */
@@ -2230,7 +2241,7 @@ prompt_and_save_changes (CompEditor *editor,
e_alert_submit (
E_ALERT_SINK (editor),
"calendar:prompt-no-task-assignment-editor",
- e_source_peek_name (
+ e_source_get_display_name (
e_client_get_source (E_CLIENT (priv->cal_client))),
NULL);
return FALSE;
@@ -3236,6 +3247,8 @@ real_send_comp (CompEditor *editor,
{
CompEditorPrivate *priv;
CompEditorFlags flags;
+ EShell *shell;
+ ESourceRegistry *registry;
ECalComponent *send_comp = NULL;
gchar *address = NULL;
GSList *users = NULL;
@@ -3245,6 +3258,9 @@ real_send_comp (CompEditor *editor,
priv = editor->priv;
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
if (priv->mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (priv->comp)) {
/* Ensure we send the master object, not the instance only */
@@ -3283,7 +3299,7 @@ real_send_comp (CompEditor *editor,
e_client_check_capability (E_CLIENT (priv->cal_client),
CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) {
if (itip_send_comp (
- method, send_comp, priv->cal_client,
+ registry, method, send_comp, priv->cal_client,
NULL, NULL, users, strip_alarms,
priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) {
g_object_unref (send_comp);
@@ -3313,7 +3329,7 @@ real_send_comp (CompEditor *editor,
}
if (itip_send_comp (
- method, send_comp, priv->cal_client,
+ registry, method, send_comp, priv->cal_client,
NULL, mime_attach_list, users, strip_alarms,
priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) {
gboolean saved = save_comp (editor);
diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c
index e247f13..dd9e20a 100644
--- a/calendar/gui/dialogs/copy-source-dialog.c
+++ b/calendar/gui/dialogs/copy-source-dialog.c
@@ -121,8 +121,8 @@ dest_source_opened_cb (GObject *source_object,
csdd->dest_client = E_CAL_CLIENT (client);
- e_client_utils_open_new (csdd->selected_source, csdd->obj_type, FALSE, NULL,
- e_client_utils_authenticate_handler, csdd->parent,
+ e_client_utils_open_new (
+ csdd->selected_source, csdd->obj_type, FALSE, NULL,
dest_source_opened_cb, csdd);
/* check if the destination is read only */
@@ -202,7 +202,6 @@ orig_source_opened_cb (GObject *source_object,
e_client_utils_open_new (
csdd->selected_source, csdd->obj_type, FALSE, NULL,
- e_client_utils_authenticate_handler, csdd->parent,
dest_source_opened_cb, csdd);
}
@@ -222,8 +221,8 @@ copy_source (const CopySourceDialogData *const_csdd)
csdd->obj_type = const_csdd->obj_type;
csdd->selected_source = g_object_ref (const_csdd->selected_source);
- e_client_utils_open_new (csdd->orig_source, csdd->obj_type, FALSE, NULL,
- e_client_utils_authenticate_handler, csdd->parent,
+ e_client_utils_open_new (
+ csdd->orig_source, csdd->obj_type, FALSE, NULL,
orig_source_opened_cb, csdd);
}
@@ -235,11 +234,13 @@ copy_source (const CopySourceDialogData *const_csdd)
*/
void
copy_source_dialog (GtkWindow *parent,
+ ESourceRegistry *registry,
ESource *source,
ECalClientSourceType obj_type)
{
CopySourceDialogData csdd;
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
g_return_if_fail (E_IS_SOURCE (source));
g_return_if_fail (obj_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ||
obj_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS ||
@@ -253,7 +254,8 @@ copy_source_dialog (GtkWindow *parent,
obj_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS ? E_CLIENT_SOURCE_TYPE_MEMOS :
E_CLIENT_SOURCE_TYPE_LAST;
- csdd.selected_source = select_source_dialog (parent, obj_type, source);
+ csdd.selected_source = select_source_dialog (
+ parent, registry, obj_type, source);
if (csdd.selected_source) {
copy_source (&csdd);
diff --git a/calendar/gui/dialogs/copy-source-dialog.h b/calendar/gui/dialogs/copy-source-dialog.h
index 5ac5140..01124d4 100644
--- a/calendar/gui/dialogs/copy-source-dialog.h
+++ b/calendar/gui/dialogs/copy-source-dialog.h
@@ -29,9 +29,10 @@
#include <gtk/gtk.h>
#include <libecal/e-cal-util.h>
#include <libecal/e-cal-client.h>
-#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-registry.h>
void copy_source_dialog (GtkWindow *parent,
+ ESourceRegistry *registry,
ESource *source,
ECalClientSourceType type);
diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c
index fc7ae7d..040e19b 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.c
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -115,6 +115,7 @@ e_delegate_dialog_finalize (GObject *object)
EDelegateDialog *
e_delegate_dialog_construct (EDelegateDialog *edd,
+ ESourceRegistry *registry,
const gchar *name,
const gchar *address)
{
@@ -125,6 +126,7 @@ e_delegate_dialog_construct (EDelegateDialog *edd,
ENameSelectorDialog *name_selector_dialog;
g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
priv = edd->priv;
@@ -138,7 +140,7 @@ e_delegate_dialog_construct (EDelegateDialog *edd,
goto error;
}
- priv->name_selector = e_name_selector_new ();
+ priv->name_selector = e_name_selector_new (registry);
e_name_selector_load_books (priv->name_selector);
name_selector_model = e_name_selector_peek_model (priv->name_selector);
e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL);
@@ -222,15 +224,18 @@ addressbook_response_cb (GtkWidget *widget,
* editor could not be created.
**/
EDelegateDialog *
-e_delegate_dialog_new (const gchar *name,
+e_delegate_dialog_new (ESourceRegistry *registry,
+ const gchar *name,
const gchar *address)
{
EDelegateDialog *edd;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
edd = g_object_new (E_TYPE_DELEGATE_DIALOG, NULL);
return e_delegate_dialog_construct (
- E_DELEGATE_DIALOG (edd), name, address);
+ E_DELEGATE_DIALOG (edd), registry, name, address);
}
gchar *
diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h
index 5fb672b..85a0613 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.h
+++ b/calendar/gui/dialogs/e-delegate-dialog.h
@@ -25,6 +25,7 @@
#define E_DELEGATE_DIALOG_H
#include <gtk/gtk.h>
+#include <libedataserver/e-source-registry.h>
/* Standard GObject macros */
#define E_TYPE_DELEGATE_DIALOG \
@@ -63,10 +64,12 @@ struct _EDelegateDialogClass {
GType e_delegate_dialog_get_type (void);
EDelegateDialog *
e_delegate_dialog_construct (EDelegateDialog *etd,
+ ESourceRegistry *registry,
const gchar *name,
const gchar *address);
EDelegateDialog *
- e_delegate_dialog_new (const gchar *name,
+ e_delegate_dialog_new (ESourceRegistry *registry,
+ const gchar *name,
const gchar *address);
gchar * e_delegate_dialog_get_delegate (EDelegateDialog *etd);
gchar * e_delegate_dialog_get_delegate_name
diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c
index 7805548..d438f16 100644
--- a/calendar/gui/dialogs/e-send-options-utils.c
+++ b/calendar/gui/dialogs/e-send-options-utils.c
@@ -31,6 +31,8 @@
#include <stdlib.h>
#include <string.h>
+#include <libedataserver/e-source-extension.h>
+
void
e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
ESource *source,
@@ -38,24 +40,25 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
{
ESendOptionsGeneral *gopts = NULL;
ESendOptionsStatusTracking *sopts;
- GConfClient *gconf = gconf_client_get_default ();
- ESourceList *source_list;
- const gchar *uid;
- const gchar *value;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+ gchar *value;
- gopts = sod->data->gopts;
- sopts = sod->data->sopts;
+ /* FIXME These is all GroupWise-specific settings.
+ * They absolutely do not belong here. */
- if (!strcmp (type, "calendar"))
- source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources");
- else
- source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");
+ extension_name = "GroupWise Backend";
- uid = e_source_peek_uid (source);
- source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (!e_source_has_extension (source, extension_name))
+ return;
+
+ extension = e_source_get_extension (source, extension_name);
+
+ gopts = sod->data->gopts;
+ sopts = sod->data->sopts;
/* priority */
- value = e_source_get_property (source, "priority");
+ g_object_get (extension, "priority", &value, NULL);
if (value) {
if (!strcmp (value, "high"))
gopts->priority = E_PRIORITY_HIGH;
@@ -66,8 +69,10 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
else
gopts->priority = E_PRIORITY_UNDEFINED;
}
+ g_free (value);
+
/* Reply requested */
- value = e_source_get_property (source, "reply-requested");
+ g_object_get (extension, "reply-requested", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
gopts->reply_enabled = FALSE;
@@ -79,8 +84,10 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
gopts->reply_within = i;
}
}
+ g_free (value);
+
/* Delay delivery */
- value = e_source_get_property (source, "delay-delivery");
+ g_object_get (extension, "delivery-delay", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
gopts->delay_enabled = FALSE;
@@ -89,8 +96,10 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
gopts->delay_until = icaltime_as_timet (icaltime_from_string (value));
}
}
+ g_free (value);
+
/* Expiration Date */
- value = e_source_get_property (source, "expiration");
+ g_object_get (extension, "expiration", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
gopts->expiration_enabled = FALSE;
@@ -103,8 +112,10 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
gopts->expire_after = i;
}
}
+ g_free (value);
+
/* status tracking */
- value = e_source_get_property (source, "status-tracking");
+ g_object_get (extension, "status-tracking", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
sopts->tracking_enabled = FALSE;
@@ -118,42 +129,45 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
sopts->track_when = E_ALL;
}
}
+ g_free (value);
/* Return Notifications */
- value = e_source_get_property (source, "return-open");
+ g_object_get (extension, "return-open", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
sopts->opened = E_RETURN_NOTIFY_NONE;
else
sopts->opened = E_RETURN_NOTIFY_MAIL;
}
+ g_free (value);
- value = e_source_get_property (source, "return-accept");
+ g_object_get (extension, "return-accept", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
sopts->accepted = E_RETURN_NOTIFY_NONE;
else
sopts->accepted = E_RETURN_NOTIFY_MAIL;
}
+ g_free (value);
- value = e_source_get_property (source, "return-decline");
+ g_object_get (extension, "return-decline", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
sopts->declined = E_RETURN_NOTIFY_NONE;
else
sopts->declined = E_RETURN_NOTIFY_MAIL;
}
+ g_free (value);
- value = e_source_get_property (source, "return-complete");
+ g_object_get (extension, "return-complete", &value, NULL);
if (value) {
if (!strcmp (value, "none"))
sopts->completed = E_RETURN_NOTIFY_NONE;
else
sopts->completed = E_RETURN_NOTIFY_MAIL;
}
-
- g_object_unref (gconf);
+ g_free (value);
}
void
diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h
index c1a63a2..3ec7542 100644
--- a/calendar/gui/dialogs/e-send-options-utils.h
+++ b/calendar/gui/dialogs/e-send-options-utils.h
@@ -27,7 +27,7 @@
#include "misc/e-send-options.h"
#include <libecal/e-cal-component.h>
-#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source.h>
void e_send_options_utils_set_default_data
(ESendOptionsDialog *sod,
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 2935264..bc3d723 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -606,6 +606,8 @@ event_editor_edit_comp (CompEditor *editor,
ECalComponentDateTime dtstart, dtend;
ECalClient *client;
GSList *attendees = NULL;
+ ESourceRegistry *registry;
+ EShell *shell;
priv = EVENT_EDITOR (editor)->priv;
@@ -625,8 +627,11 @@ event_editor_edit_comp (CompEditor *editor,
if (COMP_EDITOR_CLASS (event_editor_parent_class)->edit_comp)
COMP_EDITOR_CLASS (event_editor_parent_class)->edit_comp (editor, comp);
+ shell = comp_editor_get_shell (editor);
client = comp_editor_get_client (editor);
+ registry = e_shell_get_registry (shell);
+
/* Get meeting related stuff */
e_cal_component_get_organizer (comp, &organizer);
e_cal_component_get_attendee_list (comp, &attendees);
@@ -704,7 +709,8 @@ event_editor_edit_comp (CompEditor *editor,
comp_editor_set_needs_send (
editor, priv->meeting_shown && (itip_organizer_is_user (
- comp, client) || itip_sentby_is_user (comp, client)));
+ registry, comp, client) || itip_sentby_is_user (registry,
+ comp, client)));
priv->updating = FALSE;
}
@@ -715,6 +721,8 @@ event_editor_send_comp (CompEditor *editor,
gboolean strip_alarms)
{
EventEditorPrivate *priv;
+ EShell *shell;
+ ESourceRegistry *registry;
ECalComponent *comp = NULL;
priv = EVENT_EDITOR (editor)->priv;
@@ -724,6 +732,9 @@ event_editor_send_comp (CompEditor *editor,
method == E_CAL_COMPONENT_METHOD_CANCEL)
goto parent;
+ shell = comp_editor_get_shell (editor);
+ registry = e_shell_get_registry (shell);
+
comp = event_page_get_cancel_comp (priv->event_page);
if (comp != NULL) {
ECalClient *client;
@@ -731,7 +742,7 @@ event_editor_send_comp (CompEditor *editor,
client = e_meeting_store_get_client (priv->model);
result = itip_send_comp (
- E_CAL_COMPONENT_METHOD_CANCEL, comp,
+ registry, E_CAL_COMPONENT_METHOD_CANCEL, comp,
client, NULL, NULL, NULL, strip_alarms, FALSE);
g_object_unref (comp);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 8ec1911..737c2d9 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -34,6 +34,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-category-completion.h>
#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-combo-box.h>
@@ -44,7 +46,6 @@
#include "../e-timezone-entry.h"
#include "e-util/e-util.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-dialog-widgets.h"
@@ -103,7 +104,6 @@ struct _EventPagePrivate {
GtkWidget *info_hbox;
GtkWidget *info_icon;
GtkWidget *info_string;
- gchar *subscriber_info_text;
GtkWidget *summary;
GtkWidget *summary_label;
@@ -215,9 +215,12 @@ get_current_identity (EventPage *page,
gchar **name,
gchar **mailto)
{
- EAccountList *account_list;
- EIterator *iterator;
+ EShell *shell;
+ CompEditor *editor;
+ ESourceRegistry *registry;
+ GList *list, *iter;
GtkWidget *entry;
+ const gchar *extension_name;
const gchar *text;
gboolean match = FALSE;
@@ -227,28 +230,26 @@ get_current_identity (EventPage *page,
if (text == NULL || *text == '\0')
return FALSE;
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+
+ list = e_source_registry_list_sources (registry, extension_name);
- while (!match && e_iterator_is_valid (iterator)) {
- EAccount *account;
+ for (iter = list; !match && iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceMailIdentity *extension;
const gchar *id_name;
const gchar *id_address;
gchar *identity;
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
-<<<<<<< HEAD
+ extension = e_source_get_extension (source, extension_name);
- id_name = account->id->name;
- id_address = account->id->address;
+ id_name = e_source_mail_identity_get_name (extension);
+ id_address = e_source_mail_identity_get_address (extension);
-=======
-
- id_name = account->id->name;
- id_address = account->id->address;
-
->>>>>>> Refactor CompEditor pages to isolate EAccount usage.
identity = g_strdup_printf ("%s <%s>", id_name, id_address);
match = (g_ascii_strcasecmp (text, identity) == 0);
g_free (identity);
@@ -258,11 +259,9 @@ get_current_identity (EventPage *page,
if (match && mailto != NULL)
*mailto = g_strdup_printf ("MAILTO:%s", id_address);
-
- e_iterator_next (iterator);
}
- g_object_unref (iterator);
+ g_list_free (list);
return match;
}
@@ -647,7 +646,7 @@ sensitize_widgets (EventPage *epage)
event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, tmp);
g_free (tmp);
} else if (!check_starts_in_the_past (epage)) {
- event_page_set_info_string (epage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text);
+ event_page_set_info_string (epage, NULL, NULL);
}
alarm = e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE;
@@ -1097,6 +1096,8 @@ event_page_fill_widgets (CompEditorPage *page,
ECalComponentClassification cl;
ECalComponentTransparency transparency;
ECalComponentDateTime start_date, end_date;
+ ESourceRegistry *registry;
+ EShell *shell;
const gchar *location, *uid = NULL;
const gchar *categories;
gchar *backend_addr = NULL;
@@ -1109,6 +1110,9 @@ event_page_fill_widgets (CompEditorPage *page,
editor = comp_editor_page_get_editor (page);
client = comp_editor_get_client (editor);
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
if (!e_cal_component_has_organizer (comp)) {
flags |= COMP_EDITOR_USER_ORG;
@@ -1175,7 +1179,8 @@ event_page_fill_widgets (CompEditorPage *page,
const gchar *strip = itip_strip_mailto (organizer.value);
gchar *string;
- if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) {
+ if (itip_organizer_is_user (registry, comp, client) ||
+ itip_sentby_is_user (registry, comp, client)) {
if (e_client_check_capability (
E_CLIENT (client),
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
@@ -2574,8 +2579,6 @@ get_widgets (EventPage *epage)
priv->source_selector = GW ("source");
- e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/calendar/sources");
-
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
g_object_unref (completion);
@@ -2927,7 +2930,7 @@ epage_client_opened_cb (GObject *source_object,
NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("Unable to open the calendar '%s': %s"),
- e_source_peek_name (source),
+ e_source_get_display_name (source),
error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -2983,35 +2986,17 @@ source_changed_cb (ESourceComboBox *source_combo_box,
}
priv->open_cancellable = g_cancellable_new ();
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, priv->open_cancellable,
- e_client_utils_authenticate_handler, NULL,
- epage_client_opened_cb, epage);
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, priv->open_cancellable,
+ epage_client_opened_cb, epage);
}
static void
set_subscriber_info_string (EventPage *epage,
const gchar *backend_address)
{
- CompEditor *editor;
- ECalClient *client;
- ESource *source;
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
- client = comp_editor_get_client (editor);
- source = e_client_get_source (E_CLIENT (client));
-
- if (e_source_get_property (source, "subscriber")) {
- g_free (epage->priv->subscriber_info_text);
- /* Translators: This string is used when we are creating an Event
- * (meeting or appointment) on behalf of some other user */
- epage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address);
- } else {
- g_free (epage->priv->subscriber_info_text);
- epage->priv->subscriber_info_text = NULL;
- }
-
if (!check_starts_in_the_past (epage))
- event_page_set_info_string (epage, epage->priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, epage->priv->subscriber_info_text);
+ event_page_set_info_string (epage, NULL, NULL);
}
static void
@@ -3156,7 +3141,9 @@ static gboolean
init_widgets (EventPage *epage)
{
EventPagePrivate *priv = epage->priv;
+ EShell *shell;
CompEditor *editor;
+ ESourceRegistry *registry;
GtkTextBuffer *text_buffer;
icaltimezone *zone;
gchar *combo_label = NULL;
@@ -3168,8 +3155,12 @@ init_widgets (EventPage *epage)
GtkListStore *store;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+
+ shell = comp_editor_get_shell (editor);
client = comp_editor_get_client (editor);
+ registry = e_shell_get_registry (shell);
+
/* Make sure the EDateEdit widgets use our timezones to get the
* current time. */
e_date_edit_set_get_time_callback (
@@ -3286,7 +3277,8 @@ init_widgets (EventPage *epage)
g_signal_connect (
priv->alarm_dialog, "delete-event",
G_CALLBACK (gtk_widget_hide), priv->alarm_dialog);
- priv->alarm_list_dlg_widget = alarm_list_dialog_peek (client, priv->alarm_list_store);
+ priv->alarm_list_dlg_widget = alarm_list_dialog_peek (
+ registry, client, priv->alarm_list_store);
gtk_widget_reparent (priv->alarm_list_dlg_widget, priv->alarm_box);
gtk_widget_show_all (priv->alarm_list_dlg_widget);
gtk_widget_hide (priv->alarm_dialog);
@@ -3421,32 +3413,18 @@ event_page_select_organizer (EventPage *epage,
const gchar *backend_address)
{
EventPagePrivate *priv = epage->priv;
- CompEditor *editor;
- ECalClient *client;
const gchar *default_address;
- gboolean subscribed_cal = FALSE;
- ESource *source = NULL;
- const gchar *user_addr = NULL;
gint ii;
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
- client = comp_editor_get_client (editor);
-
- if (client)
- source = e_client_get_source (E_CLIENT (client));
- if (source)
- user_addr = e_source_get_property (source, "subscriber");
-
- if (user_addr)
- subscribed_cal = TRUE;
- else
- user_addr = (backend_address && *backend_address) ? backend_address : NULL;
+ /* Treat an empty backend address as NULL. */
+ if (backend_address != NULL && *backend_address == '\0')
+ backend_address = NULL;
default_address = priv->fallback_address;
- if (user_addr) {
+ if (backend_address != NULL) {
for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
- if (g_strrstr (priv->address_strings[ii], user_addr) != NULL) {
+ if (g_strrstr (priv->address_strings[ii], backend_address) != NULL) {
default_address = priv->address_strings[ii];
break;
}
@@ -3459,7 +3437,6 @@ event_page_select_organizer (EventPage *epage,
g_signal_handlers_block_by_func (entry, organizer_changed_cb, epage);
gtk_entry_set_text (entry, default_address);
- gtk_widget_set_sensitive (priv->organizer, !subscribed_cal);
g_signal_handlers_unblock_by_func (entry, organizer_changed_cb, epage);
}
} else
@@ -3480,10 +3457,16 @@ event_page_construct (EventPage *epage,
EMeetingStore *meeting_store)
{
EventPagePrivate *priv;
+ CompEditor *editor;
GtkTreeModel *model;
GtkListStore *store;
+ ESourceRegistry *registry;
+ EShell *shell;
gint ii;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ shell = comp_editor_get_shell (editor);
+
priv = epage->priv;
priv->meeting_store = g_object_ref (meeting_store);
@@ -3514,8 +3497,9 @@ event_page_construct (EventPage *epage,
model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer));
- priv->address_strings = itip_get_user_identities ();
- priv->fallback_address = itip_get_fallback_identity ();
+ registry = e_shell_get_registry (shell);
+ priv->address_strings = itip_get_user_identities (registry);
+ priv->fallback_address = itip_get_fallback_identity (registry);
for (ii = 0; priv->address_strings[ii] != NULL; ii++)
e_dialog_append_list_store_text (
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index 9377c83..f738c09 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -779,6 +779,7 @@
</child>
<child>
<object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
+ <property name="extension-name">Calendar</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index cf1e879..75b8ab1 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -33,6 +33,8 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-category-completion.h>
#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-combo-box.h>
@@ -43,7 +45,6 @@
#include "misc/e-buffer-tagger.h"
#include "e-util/e-util.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-dialog-widgets.h"
@@ -68,7 +69,6 @@ struct _MemoPagePrivate {
GtkWidget *info_hbox;
GtkWidget *info_icon;
GtkWidget *info_string;
- gchar *subscriber_info_text;
/* Organizer */
GtkWidget *org_label;
@@ -113,32 +113,40 @@ get_current_identity (MemoPage *page,
gchar **name,
gchar **mailto)
{
- EAccountList *account_list;
- EIterator *iterator;
+ EShell *shell;
+ CompEditor *editor;
+ ESourceRegistry *registry;
+ GList *list, *iter;
GtkWidget *entry;
+ const gchar *extension_name;
const gchar *text;
gboolean match = FALSE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ shell = comp_editor_get_shell (editor);
+
entry = gtk_bin_get_child (GTK_BIN (page->priv->org_combo));
text = gtk_entry_get_text (GTK_ENTRY (entry));
if (text == NULL || *text == '\0')
return FALSE;
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ registry = e_shell_get_registry (shell);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
- while (!match && e_iterator_is_valid (iterator)) {
- EAccount *account;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (iter = list; !match && iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceMailIdentity *extension;
const gchar *id_name;
const gchar *id_address;
gchar *identity;
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ extension = e_source_get_extension (source, extension_name);
- id_name = account->id->name;
- id_address = account->id->address;
+ id_name = e_source_mail_identity_get_name (extension);
+ id_address = e_source_mail_identity_get_address (extension);
identity = g_strdup_printf ("%s <%s>", id_name, id_address);
match = (g_ascii_strcasecmp (text, identity) == 0);
@@ -149,11 +157,9 @@ get_current_identity (MemoPage *page,
if (match && mailto != NULL)
*mailto = g_strdup_printf ("MAILTO:%s", id_address);
-
- e_iterator_next (iterator);
}
- g_object_unref (iterator);
+ g_list_free (list);
return match;
}
@@ -229,8 +235,6 @@ memo_page_finalize (GObject *object)
priv->builder = NULL;
}
- g_free (priv->subscriber_info_text);
-
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (memo_page_parent_class)->finalize (object);
}
@@ -263,6 +267,8 @@ memo_page_fill_widgets (CompEditorPage *page,
ECalComponentClassification cl;
ECalComponentText text;
ECalComponentDateTime d;
+ ESourceRegistry *registry;
+ EShell *shell;
GSList *l;
const gchar *categories;
gchar *backend_addr = NULL;
@@ -273,6 +279,9 @@ memo_page_fill_widgets (CompEditorPage *page,
editor = comp_editor_page_get_editor (page);
client = comp_editor_get_client (editor);
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
/* Clean the screen */
clear_widgets (mpage);
@@ -330,7 +339,8 @@ memo_page_fill_widgets (CompEditorPage *page,
else
string = g_strdup (strip);
- if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) {
+ if (itip_organizer_is_user (registry, comp, client) ||
+ itip_sentby_is_user (registry, comp, client)) {
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), string);
} else {
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo));
@@ -402,12 +412,11 @@ check_starts_in_the_past (MemoPage *mpage)
start_tt.is_date = TRUE;
if (e_date_edit_get_date (E_DATE_EDIT (priv->start_date), &start_tt.year, &start_tt.month, &start_tt.day) &&
comp_editor_test_time_in_the_past (start_tt)) {
- gchar *tmp = g_strconcat ("<b>", _("Memo's start date is in the past"), "</b>",
- priv->subscriber_info_text ? "\n" : "", priv->subscriber_info_text, NULL);
+ gchar *tmp = g_strconcat ("<b>", _("Memo's start date is in the past"), "</b>", NULL);
memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_WARNING, tmp);
g_free (tmp);
} else {
- memo_page_set_info_string (mpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text);
+ memo_page_set_info_string (mpage, NULL, NULL);
}
return TRUE;
@@ -447,7 +456,7 @@ sensitize_widgets (MemoPage *mpage)
memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, tmp);
g_free (tmp);
} else if (!check_starts_in_the_past (mpage)) {
- memo_page_set_info_string (mpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text);
+ memo_page_set_info_string (mpage, NULL, NULL);
}
/* The list of organizers is set to be non-editable. Otherwise any
@@ -534,7 +543,7 @@ fill_comp_with_recipients (ENameSelector *name_selector,
ENameSelectorModel *model;
EContactStore *c_store;
GSList *clients, *l;
- gchar *uri = e_contact_get (contact, E_CONTACT_BOOK_URI);
+ gchar *uid = e_contact_get (contact, E_CONTACT_BOOK_URI);
dialog = e_name_selector_peek_dialog (name_selector);
model = e_name_selector_dialog_peek_model (dialog);
@@ -543,7 +552,11 @@ fill_comp_with_recipients (ENameSelector *name_selector,
for (l = clients; l; l = l->next) {
EBookClient *b = l->data;
- if (g_str_equal (uri, e_client_get_uri (E_CLIENT (b)))) {
+ ESource *source;
+
+ source = e_client_get_source (E_CLIENT (b));
+
+ if (g_strcmp0 (uid, e_source_get_uid (source)) == 0) {
book_client = b;
break;
}
@@ -874,8 +887,6 @@ get_widgets (MemoPage *mpage)
priv->source_selector = GW ("source");
#undef GW
- e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/memos/sources");
-
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
g_object_unref (completion);
@@ -934,7 +945,7 @@ mpage_client_opened_cb (GObject *source_object,
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("Unable to open memos in '%s': %s"),
- e_source_peek_name (source),
+ e_source_get_display_name (source),
error ? error->message : _("Unknown error"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -988,35 +999,17 @@ source_changed_cb (ESourceComboBox *source_combo_box,
}
priv->open_cancellable = g_cancellable_new ();
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, priv->open_cancellable,
- e_client_utils_authenticate_handler, NULL,
- mpage_client_opened_cb, mpage);
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, priv->open_cancellable,
+ mpage_client_opened_cb, mpage);
}
static void
set_subscriber_info_string (MemoPage *mpage,
const gchar *backend_address)
{
- CompEditor *editor;
- ECalClient *client;
- ESource *source;
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
- client = comp_editor_get_client (editor);
- source = e_client_get_source (E_CLIENT (client));
-
- if (e_source_get_property (source, "subscriber")) {
- g_free (mpage->priv->subscriber_info_text);
- /* Translators: This string is used when we are creating a Memo
- * on behalf of some other user */
- mpage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address);
- } else {
- g_free (mpage->priv->subscriber_info_text);
- mpage->priv->subscriber_info_text = NULL;
- }
-
if (!check_starts_in_the_past (mpage))
- memo_page_set_info_string (mpage, mpage->priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, mpage->priv->subscriber_info_text);
+ memo_page_set_info_string (mpage, NULL, NULL);
}
static void
@@ -1151,36 +1144,24 @@ static void
memo_page_select_organizer (MemoPage *mpage,
const gchar *backend_address)
{
- MemoPagePrivate *priv;
+ MemoPagePrivate *priv = mpage->priv;
CompEditor *editor;
CompEditorFlags flags;
- ECalClient *client;
const gchar *default_address;
- gboolean subscribed_cal = FALSE;
- ESource *source = NULL;
- const gchar *user_addr = NULL;
gint ii;
- priv = mpage->priv;
+ /* Treat an empty backend address as NULL. */
+ if (backend_address != NULL && *backend_address == '\0')
+ backend_address = NULL;
+
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
- client = comp_editor_get_client (editor);
flags = comp_editor_get_flags (editor);
- if (client)
- source = e_client_get_source (E_CLIENT (client));
- if (source)
- user_addr = e_source_get_property (source, "subscriber");
-
- if (user_addr)
- subscribed_cal = TRUE;
- else
- user_addr = (backend_address && *backend_address) ? backend_address : NULL;
-
default_address = priv->fallback_address;
- if (user_addr) {
+ if (backend_address != NULL) {
for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
- if (g_strrstr (priv->address_strings[ii], user_addr) != NULL) {
+ if (g_strrstr (priv->address_strings[ii], backend_address) != NULL) {
default_address = priv->address_strings[ii];
break;
}
@@ -1190,7 +1171,6 @@ memo_page_select_organizer (MemoPage *mpage,
if (default_address != NULL) {
if (flags & COMP_EDITOR_NEW_ITEM) {
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), default_address);
- gtk_widget_set_sensitive (priv->org_combo, !subscribed_cal);
}
} else
g_warning ("No potential organizers!");
@@ -1209,13 +1189,19 @@ MemoPage *
memo_page_construct (MemoPage *mpage)
{
MemoPagePrivate *priv;
+ EShell *shell;
CompEditor *editor;
CompEditorFlags flags;
+ ESourceRegistry *registry;
priv = mpage->priv;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
priv->builder = gtk_builder_new ();
e_load_ui_builder_definition (priv->builder, "memo-page.ui");
@@ -1231,8 +1217,8 @@ memo_page_construct (MemoPage *mpage)
gint ii;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo));
- priv->address_strings = itip_get_user_identities ();
- priv->fallback_address = itip_get_fallback_identity ();
+ priv->address_strings = itip_get_user_identities (registry);
+ priv->fallback_address = itip_get_fallback_identity (registry);
for (ii = 0; priv->address_strings[ii] != NULL; ii++)
e_dialog_append_list_store_text (
@@ -1243,7 +1229,7 @@ memo_page_construct (MemoPage *mpage)
gtk_widget_show (priv->org_label);
gtk_widget_show (priv->org_combo);
- priv->name_selector = e_name_selector_new ();
+ priv->name_selector = e_name_selector_new (registry);
priv->to_entry = get_to_entry (priv->name_selector);
gtk_container_add ((GtkContainer *) priv->to_hbox, priv->to_entry);
gtk_widget_show (priv->to_hbox);
diff --git a/calendar/gui/dialogs/memo-page.ui b/calendar/gui/dialogs/memo-page.ui
index c4206e2..c222e0c 100644
--- a/calendar/gui/dialogs/memo-page.ui
+++ b/calendar/gui/dialogs/memo-page.ui
@@ -184,6 +184,7 @@
<property name="spacing">0</property>
<child>
<object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
+ <property name="extension-name">Memo List</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c
index 6a768e5..76ef27a 100644
--- a/calendar/gui/dialogs/select-source-dialog.c
+++ b/calendar/gui/dialogs/select-source-dialog.c
@@ -26,6 +26,7 @@
#endif
#include <glib/gi18n.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserverui/e-source-selector-dialog.h>
#include "select-source-dialog.h"
@@ -36,37 +37,31 @@
*/
ESource *
select_source_dialog (GtkWindow *parent,
+ ESourceRegistry *registry,
ECalClientSourceType obj_type,
ESource *except_source)
{
GtkWidget *dialog;
- ESourceList *source_list;
ESource *selected_source = NULL;
- const gchar *gconf_key;
- GConfClient *conf_client;
- const gchar *icon_name = NULL;
+ const gchar *extension_name;
+ const gchar *icon_name;
- if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
- gconf_key = "/apps/evolution/calendar/sources";
- else if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
- gconf_key = "/apps/evolution/tasks/sources";
- else if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
- gconf_key = "/apps/evolution/memos/sources";
- else
- return NULL;
-
- conf_client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (conf_client, gconf_key);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
- /* create the dialog */
- dialog = e_source_selector_dialog_new (parent, source_list);
-
- if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
+ if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS) {
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
icon_name = "x-office-calendar";
- else if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
+ } else if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS) {
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
icon_name = "stock_todo";
- else if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
- icon_name = "stock_journal";
+ } else if (obj_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ icon_name = "stock_journal";
+ } else
+ return NULL;
+
+ /* create the dialog */
+ dialog = e_source_selector_dialog_new (parent, registry, extension_name);
if (icon_name)
gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);
@@ -74,24 +69,15 @@ select_source_dialog (GtkWindow *parent,
if (except_source)
g_object_set_data (G_OBJECT (dialog), "except-source", except_source);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog));
- if (selected_source) {
- gchar *absolute_uri;
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
- /* set the absolute URI on the source we keep around, since the group
- * will be unrefed */
- absolute_uri = e_source_build_absolute_uri (selected_source);
- e_source_set_absolute_uri (selected_source, (const gchar *) absolute_uri);
-
- g_object_ref (selected_source);
- g_free (absolute_uri);
- }
- } else
- selected_source = NULL;
+ selected_source = e_source_selector_dialog_peek_primary_selection (
+ E_SOURCE_SELECTOR_DIALOG (dialog));
+ if (selected_source != NULL)
+ g_object_ref (selected_source);
- g_object_unref (conf_client);
- g_object_unref (source_list);
+exit:
gtk_widget_destroy (dialog);
return selected_source;
diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h
index 2ef8e0e..77864e8 100644
--- a/calendar/gui/dialogs/select-source-dialog.h
+++ b/calendar/gui/dialogs/select-source-dialog.h
@@ -27,10 +27,11 @@
#define SELECT_SOURCE_DIALOG_H
#include <gtk/gtk.h>
-#include <libedataserver/e-source.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-registry.h>
ESource * select_source_dialog (GtkWindow *parent,
+ ESourceRegistry *registry,
ECalClientSourceType type,
ESource *except_source);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 1942224..2baf553 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -384,6 +384,8 @@ task_editor_edit_comp (CompEditor *editor,
ECalComponentOrganizer organizer;
ECalClient *client;
GSList *attendees = NULL;
+ ESourceRegistry *registry;
+ EShell *shell;
priv = TASK_EDITOR_GET_PRIVATE (editor);
@@ -392,8 +394,11 @@ task_editor_edit_comp (CompEditor *editor,
if (COMP_EDITOR_CLASS (task_editor_parent_class)->edit_comp)
COMP_EDITOR_CLASS (task_editor_parent_class)->edit_comp (editor, comp);
+ shell = comp_editor_get_shell (editor);
client = comp_editor_get_client (editor);
+ registry = e_shell_get_registry (shell);
+
/* Get meeting related stuff */
e_cal_component_get_organizer (comp, &organizer);
e_cal_component_get_attendee_list (comp, &attendees);
@@ -446,7 +451,7 @@ task_editor_edit_comp (CompEditor *editor,
comp_editor_set_needs_send (
editor, priv->assignment_shown &&
- itip_organizer_is_user (comp, client));
+ itip_organizer_is_user (registry, comp, client));
priv->updating = FALSE;
}
@@ -457,6 +462,8 @@ task_editor_send_comp (CompEditor *editor,
gboolean strip_alarms)
{
TaskEditorPrivate *priv;
+ EShell *shell;
+ ESourceRegistry *registry;
ECalComponent *comp = NULL;
priv = TASK_EDITOR_GET_PRIVATE (editor);
@@ -466,6 +473,9 @@ task_editor_send_comp (CompEditor *editor,
method == E_CAL_COMPONENT_METHOD_CANCEL)
goto parent;
+ shell = comp_editor_get_shell (editor);
+ registry = e_shell_get_registry (shell);
+
comp = task_page_get_cancel_comp (priv->task_page);
if (comp != NULL) {
ECalClient *client;
@@ -473,7 +483,7 @@ task_editor_send_comp (CompEditor *editor,
client = e_meeting_store_get_client (priv->model);
result = itip_send_comp (
- E_CAL_COMPONENT_METHOD_CANCEL, comp,
+ registry, E_CAL_COMPONENT_METHOD_CANCEL, comp,
client, NULL, NULL, NULL, strip_alarms, FALSE);
g_object_unref (comp);
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index a533505..a04d311 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -33,6 +33,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-category-completion.h>
#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-combo-box.h>
@@ -46,7 +48,6 @@
#include "task-page.h"
#include "e-util/e-util.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-dialog-widgets.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-util-private.h"
@@ -83,7 +84,6 @@ struct _TaskPagePrivate {
GtkWidget *info_hbox;
GtkWidget *info_icon;
GtkWidget *info_string;
- gchar *subscriber_info_text;
GtkWidget *summary;
GtkWidget *summary_label;
@@ -146,32 +146,40 @@ get_current_identity (TaskPage *page,
gchar **name,
gchar **mailto)
{
- EAccountList *account_list;
- EIterator *iterator;
+ EShell *shell;
+ CompEditor *editor;
+ ESourceRegistry *registry;
+ GList *list, *iter;
GtkWidget *entry;
+ const gchar *extension_name;
const gchar *text;
gboolean match = FALSE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ shell = comp_editor_get_shell (editor);
+
entry = gtk_bin_get_child (GTK_BIN (page->priv->organizer));
text = gtk_entry_get_text (GTK_ENTRY (entry));
if (text == NULL || *text == '\0')
return FALSE;
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ registry = e_shell_get_registry (shell);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+
+ list = e_source_registry_list_sources (registry, extension_name);
- while (!match && e_iterator_is_valid (iterator)) {
- EAccount *account;
+ for (iter = list; !match && iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceMailIdentity *extension;
const gchar *id_name;
const gchar *id_address;
gchar *identity;
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ extension = e_source_get_extension (source, extension_name);
- id_name = account->id->name;
- id_address = account->id->address;
+ id_name = e_source_mail_identity_get_name (extension);
+ id_address = e_source_mail_identity_get_address (extension);
identity = g_strdup_printf ("%s <%s>", id_name, id_address);
match = (g_ascii_strcasecmp (text, identity) == 0);
@@ -182,11 +190,9 @@ get_current_identity (TaskPage *page,
if (match && mailto != NULL)
*mailto = g_strdup_printf ("MAILTO:%s", id_address);
-
- e_iterator_next (iterator);
}
- g_object_unref (iterator);
+ g_list_free (list);
return match;
}
@@ -249,12 +255,11 @@ check_starts_in_the_past (TaskPage *tpage)
if (start_in_past || due_in_past) {
gchar *tmp = g_strconcat ("<b>", start_in_past ? _("Task's start date is in the past") : "",
- start_in_past && due_in_past ? "\n" : "", due_in_past ? _("Task's due date is in the past") : "", "</b>",
- priv->subscriber_info_text ? "\n" : "", priv->subscriber_info_text, NULL);
+ start_in_past && due_in_past ? "\n" : "", due_in_past ? _("Task's due date is in the past") : "", "</b>", NULL);
task_page_set_info_string (tpage, GTK_STOCK_DIALOG_WARNING, tmp);
g_free (tmp);
} else {
- task_page_set_info_string (tpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text);
+ task_page_set_info_string (tpage, NULL, NULL);
}
return TRUE;
@@ -297,7 +302,7 @@ sensitize_widgets (TaskPage *tpage)
sens = FALSE;
read_only = TRUE;
} else if (!check_starts_in_the_past (tpage)) {
- task_page_set_info_string (tpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text);
+ task_page_set_info_string (tpage, NULL, NULL);
}
/* The list of organizers is set to be non-editable. Otherwise any
@@ -483,10 +488,12 @@ task_page_fill_widgets (CompEditorPage *page,
ECalComponentText text;
ECalComponentDateTime d;
ECalComponentClassification cl;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorFlags flags;
GtkAction *action;
ECalClient *client;
+ EShell *shell;
GSList *l;
icalcomponent *icalcomp;
const gchar *categories, *uid;
@@ -500,6 +507,9 @@ task_page_fill_widgets (CompEditorPage *page,
editor = comp_editor_page_get_editor (page);
client = comp_editor_get_client (editor);
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+
+ registry = e_shell_get_registry (shell);
/* Clean out old data */
if (priv->comp != NULL)
@@ -641,7 +651,8 @@ task_page_fill_widgets (CompEditorPage *page,
const gchar *strip = itip_strip_mailto (organizer.value);
gchar *string;
- if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) {
+ if (itip_organizer_is_user (registry, comp, client) ||
+ itip_sentby_is_user (registry, comp, client)) {
if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
priv->user_org = TRUE;
} else {
@@ -1494,7 +1505,6 @@ get_widgets (TaskPage *tpage)
gtk_box_pack_start (GTK_BOX (priv->list_box), sw, TRUE, TRUE, 0);
priv->source_selector = e_builder_get_widget (priv->builder, "source");
- e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/tasks/sources");
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->source_selector);
@@ -1762,7 +1772,7 @@ tpage_client_opened_cb (GObject *source_object,
NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("Unable to open tasks in '%s': %s"),
- e_source_peek_name (source),
+ e_source_get_display_name (source),
error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -1822,7 +1832,6 @@ source_changed_cb (ESourceComboBox *source_combo_box,
e_client_utils_open_new (
source, E_CLIENT_SOURCE_TYPE_TASKS,
FALSE, priv->open_cancellable,
- e_client_utils_authenticate_handler, NULL,
tpage_client_opened_cb, tpage);
}
@@ -1830,26 +1839,8 @@ static void
set_subscriber_info_string (TaskPage *tpage,
const gchar *backend_address)
{
- CompEditor *editor;
- ECalClient *client;
- ESource *source;
-
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
- client = comp_editor_get_client (editor);
- source = e_client_get_source (E_CLIENT (client));
-
- if (e_source_get_property (source, "subscriber")) {
- g_free (tpage->priv->subscriber_info_text);
- /* Translators: This string is used when we are creating a Task
- * on behalf of some other user */
- tpage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address);
- } else {
- g_free (tpage->priv->subscriber_info_text);
- tpage->priv->subscriber_info_text = NULL;
- }
-
if (!check_starts_in_the_past (tpage))
- task_page_set_info_string (tpage, tpage->priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, tpage->priv->subscriber_info_text);
+ task_page_set_info_string (tpage, NULL, NULL);
}
void
@@ -2032,45 +2023,30 @@ task_page_select_organizer (TaskPage *tpage,
const gchar *backend_address)
{
TaskPagePrivate *priv = tpage->priv;
- CompEditor *editor;
const gchar *default_address;
- gboolean subscribed_cal = FALSE;
- ESource *source = NULL;
- ECalClient *client;
- const gchar *user_addr = NULL;
gint ii;
- editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
- client = comp_editor_get_client (editor);
-
- if (client)
- source = e_client_get_source (E_CLIENT (client));
- if (source)
- user_addr = e_source_get_property (source, "subscriber");
-
- if (user_addr)
- subscribed_cal = TRUE;
- else
- user_addr = (backend_address && *backend_address) ? backend_address : NULL;
+ /* Treat an empty backend address as NULL. */
+ if (backend_address == NULL && *backend_address == '\0')
+ backend_address = NULL;
default_address = priv->fallback_address;
- if (user_addr) {
+ if (backend_address != NULL) {
for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
- if (g_strrstr (priv->address_strings[ii], user_addr) != NULL) {
+ if (g_strrstr (priv->address_strings[ii], backend_address) != NULL) {
default_address = priv->address_strings[ii];
break;
}
}
}
- if (default_address) {
+ if (default_address != NULL) {
if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) {
GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer)));
g_signal_handlers_block_by_func (entry, organizer_changed_cb, tpage);
gtk_entry_set_text (entry, default_address);
- gtk_widget_set_sensitive (priv->organizer, !subscribed_cal);
g_signal_handlers_unblock_by_func (entry, organizer_changed_cb, tpage);
}
} else
@@ -2091,10 +2067,16 @@ task_page_construct (TaskPage *tpage,
EMeetingStore *meeting_store,
ECalClient *client)
{
+ EShell *shell;
+ CompEditor *editor;
+ ESourceRegistry *registry;
TaskPagePrivate *priv;
GtkTreeModel *model;
gint ii;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
+ shell = comp_editor_get_shell (editor);
+
priv = tpage->priv;
priv->meeting_store = g_object_ref (meeting_store);
priv->client = client;
@@ -2116,8 +2098,9 @@ task_page_construct (TaskPage *tpage,
model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer));
- priv->address_strings = itip_get_user_identities ();
- priv->fallback_address = itip_get_fallback_identity ();
+ registry = e_shell_get_registry (shell);
+ priv->address_strings = itip_get_user_identities (registry);
+ priv->fallback_address = itip_get_fallback_identity (registry);
for (ii = 0; priv->address_strings[ii] != NULL; ii++)
e_dialog_append_list_store_text (
diff --git a/calendar/gui/dialogs/task-page.ui b/calendar/gui/dialogs/task-page.ui
index cdc6955..d5896f9 100644
--- a/calendar/gui/dialogs/task-page.ui
+++ b/calendar/gui/dialogs/task-page.ui
@@ -439,6 +439,7 @@
</child>
<child>
<object class="ESourceComboBox" id="source">
+ <property name="extension-name">Task List</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index ec4f817..1851146 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -94,7 +94,7 @@ update_comp_info (ECalComponentPreview *preview,
gint comp_sequence;
source = e_client_get_source (E_CLIENT (client));
- cal_uid = g_strdup (e_source_peek_uid (source));
+ cal_uid = g_strdup (e_source_get_uid (source));
e_cal_component_get_uid (comp, &uid);
comp_uid = g_strdup (uid);
e_cal_component_get_last_modified (comp, &itm);
diff --git a/calendar/gui/e-cal-config.c b/calendar/gui/e-cal-config.c
index 8269a10..42baece 100644
--- a/calendar/gui/e-cal-config.c
+++ b/calendar/gui/e-cal-config.c
@@ -25,6 +25,8 @@
#endif
#include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
+
#include "e-cal-config.h"
static GObjectClass *ecp_parent_class;
diff --git a/calendar/gui/e-cal-event.c b/calendar/gui/e-cal-event.c
index 176e292..e65e819 100644
--- a/calendar/gui/e-cal-event.c
+++ b/calendar/gui/e-cal-event.c
@@ -48,8 +48,6 @@ ece_target_free (EEvent *ev,
ECalEventTargetBackend *s = (ECalEventTargetBackend *) t;
if (s->shell_backend)
g_object_unref (s->shell_backend);
- if (s->source_list)
- g_object_unref (s->source_list);
break; }
}
@@ -101,7 +99,6 @@ e_cal_event_peek (void)
ECalEventTargetBackend *
e_cal_event_target_new_module (ECalEvent *ece,
EShellBackend *shell_backend,
- ESourceList *source_list,
guint32 flags)
{
ECalEventTargetBackend *t;
@@ -110,7 +107,6 @@ e_cal_event_target_new_module (ECalEvent *ece,
&ece->event, E_CAL_EVENT_TARGET_BACKEND, sizeof (*t));
t->shell_backend = g_object_ref (shell_backend);
- t->source_list = g_object_ref (source_list);
t->target.mask = ~flags;
return t;
diff --git a/calendar/gui/e-cal-event.h b/calendar/gui/e-cal-event.h
index d67342e..447f1fd 100644
--- a/calendar/gui/e-cal-event.h
+++ b/calendar/gui/e-cal-event.h
@@ -24,8 +24,6 @@
#ifndef __E_CAL_EVENT_H__
#define __E_CAL_EVENT_H__
-#include <libedataserver/e-source-list.h>
-
#include "e-util/e-event.h"
#include "shell/e-shell-backend.h"
@@ -48,7 +46,6 @@ typedef struct _ECalEventTargetBackend ECalEventTargetBackend;
struct _ECalEventTargetBackend {
EEventTarget target;
EShellBackend *shell_backend;
- ESourceList *source_list;
};
struct _ECalEvent {
@@ -66,7 +63,6 @@ ECalEvent * e_cal_event_peek (void);
ECalEventTargetBackend *
e_cal_event_target_new_module (ECalEvent *ece,
EShellBackend *shell_backend,
- ESourceList *source_list,
guint32 flags);
G_END_DECLS
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 6a1493f..4f27161 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -305,12 +305,15 @@ ecmc_set_value_at (ETableModel *etm,
CalObjModType mod = CALOBJ_MOD_ALL;
ECalComponent *comp;
ECalModelCalendar *model = (ECalModelCalendar *) etm;
+ ESourceRegistry *registry;
GError *error = NULL;
g_return_if_fail (E_IS_CAL_MODEL_CALENDAR (model));
g_return_if_fail (col >= 0 && col < E_CAL_MODEL_CALENDAR_FIELD_LAST);
g_return_if_fail (row >= 0 && row < e_table_model_row_count (etm));
+ registry = e_cal_model_get_registry (E_CAL_MODEL (model));
+
if (col < E_CAL_MODEL_FIELD_LAST) {
E_TABLE_MODEL_CLASS (e_cal_model_calendar_parent_class)->set_value_at (etm, col, row, value);
return;
@@ -349,7 +352,7 @@ ecmc_set_value_at (ETableModel *etm,
if (e_cal_client_modify_object_sync (comp_data->client, comp_data->icalcomp, mod, NULL, &error)) {
gboolean strip_alarms = TRUE;
- if (itip_organizer_is_user (comp, comp_data->client) &&
+ if (itip_organizer_is_user (registry, comp, comp_data->client) &&
send_component_dialog (NULL, comp_data->client, comp, FALSE, &strip_alarms, NULL)) {
ECalComponent *send_comp = NULL;
@@ -370,7 +373,7 @@ ecmc_set_value_at (ETableModel *etm,
}
itip_send_comp (
- E_CAL_COMPONENT_METHOD_REQUEST,
+ registry, E_CAL_COMPONENT_METHOD_REQUEST,
send_comp ? send_comp : comp, comp_data->client,
NULL, NULL, NULL, strip_alarms, FALSE);
@@ -553,7 +556,12 @@ ecmc_fill_component_from_model (ECalModel *model,
* e_cal_model_calendar_new
*/
ECalModel *
-e_cal_model_calendar_new (void)
+e_cal_model_calendar_new (ESourceRegistry *registry)
{
- return g_object_new (E_TYPE_CAL_MODEL_CALENDAR, NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_MODEL_CALENDAR,
+ "registry", registry, NULL);
}
+
diff --git a/calendar/gui/e-cal-model-calendar.h b/calendar/gui/e-cal-model-calendar.h
index f29d7d4..9dd9aee 100644
--- a/calendar/gui/e-cal-model-calendar.h
+++ b/calendar/gui/e-cal-model-calendar.h
@@ -72,7 +72,7 @@ struct _ECalModelCalendarClass {
};
GType e_cal_model_calendar_get_type (void);
-ECalModel * e_cal_model_calendar_new (void);
+ECalModel * e_cal_model_calendar_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c
index 261cdda..c7f3708 100644
--- a/calendar/gui/e-cal-model-memos.c
+++ b/calendar/gui/e-cal-model-memos.c
@@ -282,7 +282,12 @@ ecmm_fill_component_from_model (ECalModel *model,
* e_cal_model_memos_new
*/
ECalModel *
-e_cal_model_memos_new (void)
+e_cal_model_memos_new (ESourceRegistry *registry)
{
- return g_object_new (E_TYPE_CAL_MODEL_MEMOS, NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_MODEL_MEMOS,
+ "registry", registry, NULL);
}
+
diff --git a/calendar/gui/e-cal-model-memos.h b/calendar/gui/e-cal-model-memos.h
index 2be1e4d..4490d0b 100644
--- a/calendar/gui/e-cal-model-memos.h
+++ b/calendar/gui/e-cal-model-memos.h
@@ -71,7 +71,7 @@ struct _ECalModelMemosClass {
};
GType e_cal_model_memos_get_type (void);
-ECalModel * e_cal_model_memos_new (void);
+ECalModel * e_cal_model_memos_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 8602ce5..2853143 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -1162,9 +1162,13 @@ ecmt_fill_component_from_model (ECalModel *model,
}
ECalModel *
-e_cal_model_tasks_new (void)
+e_cal_model_tasks_new (ESourceRegistry *registry)
{
- return g_object_new (E_TYPE_CAL_MODEL_TASKS, NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_MODEL_TASKS,
+ "registry", registry, NULL);
}
const gchar *
diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h
index f35f8dd..5e448f3 100644
--- a/calendar/gui/e-cal-model-tasks.h
+++ b/calendar/gui/e-cal-model-tasks.h
@@ -79,7 +79,7 @@ struct _ECalModelTasksClass {
};
GType e_cal_model_tasks_get_type (void);
-ECalModel * e_cal_model_tasks_new (void);
+ECalModel * e_cal_model_tasks_new (ESourceRegistry *registry);
const gchar * e_cal_model_tasks_get_color_due_today
(ECalModelTasks *model);
void e_cal_model_tasks_set_color_due_today
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 4428d31..f0fdefd 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -31,14 +31,15 @@
#include <libebackend/e-extensible.h>
#include <libedataserver/e-flag.h>
#include <libedataserver/e-time-utils.h>
+#include <libedataserver/e-source-selectable.h>
#include <libecal/e-cal-client-view.h>
#include <libecal/e-cal-time-util.h>
+#include <libecal/e-source-calendar.h>
#include "comp-util.h"
#include "e-cal-model.h"
#include "itip-utils.h"
#include "misc.h"
#include "e-util/e-util.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-util-enumtypes.h"
typedef struct {
@@ -50,6 +51,8 @@ typedef struct {
} ECalModelClient;
struct _ECalModelPrivate {
+ ESourceRegistry *registry;
+
/* The list of clients we are managing. Each element is of type ECalModelClient */
GList *clients;
@@ -76,9 +79,6 @@ struct _ECalModelPrivate {
/* The default category */
gchar *default_category;
- /* Addresses for determining icons */
- EAccountList *accounts;
-
/* Whether we display dates in 24-hour format. */
gboolean use_24_hour_format;
@@ -146,6 +146,7 @@ enum {
PROP_DEFAULT_CLIENT,
PROP_DEFAULT_REMINDER_INTERVAL,
PROP_DEFAULT_REMINDER_UNITS,
+ PROP_REGISTRY,
PROP_TIMEZONE,
PROP_USE_24_HOUR_FORMAT,
PROP_USE_DEFAULT_REMINDER,
@@ -175,6 +176,16 @@ G_DEFINE_TYPE_WITH_CODE (
G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
static void
+cal_model_set_registry (ECalModel *model,
+ ESourceRegistry *registry)
+{
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+ g_return_if_fail (model->priv->registry == NULL);
+
+ model->priv->registry = g_object_ref (registry);
+}
+
+static void
cal_model_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -211,6 +222,12 @@ cal_model_set_property (GObject *object,
g_value_get_enum (value));
return;
+ case PROP_REGISTRY:
+ cal_model_set_registry (
+ E_CAL_MODEL (object),
+ g_value_get_object (value));
+ return;
+
case PROP_TIMEZONE:
e_cal_model_set_timezone (
E_CAL_MODEL (object),
@@ -305,6 +322,13 @@ cal_model_get_property (GObject *object,
E_CAL_MODEL (object)));
return;
+ case PROP_REGISTRY:
+ g_value_set_object (
+ value,
+ e_cal_model_get_registry (
+ E_CAL_MODEL (object)));
+ return;
+
case PROP_TIMEZONE:
g_value_set_pointer (
value,
@@ -381,6 +405,11 @@ cal_model_dispose (GObject *object)
priv = E_CAL_MODEL (object)->priv;
+ if (priv->registry != NULL) {
+ g_object_unref (priv->registry);
+ priv->registry = NULL;
+ }
+
if (priv->loading_clients) {
g_cancellable_cancel (priv->loading_clients);
g_object_unref (priv->loading_clients);
@@ -539,6 +568,17 @@ e_cal_model_class_init (ECalModelClass *class)
g_object_class_install_property (
object_class,
+ PROP_REGISTRY,
+ g_param_spec_object (
+ "registry",
+ "Registry",
+ "Data source registry",
+ E_TYPE_SOURCE_REGISTRY,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
PROP_TIMEZONE,
g_param_spec_pointer (
"timezone",
@@ -708,8 +748,6 @@ e_cal_model_init (ECalModel *model)
model->priv->kind = ICAL_NO_COMPONENT;
model->priv->flags = 0;
- model->priv->accounts = e_get_account_list ();
-
model->priv->use_24_hour_format = TRUE;
model->priv->in_added = FALSE;
@@ -931,11 +969,14 @@ ecm_value_at (ETableModel *etm,
ECalModelPrivate *priv;
ECalModelComponent *comp_data;
ECalModel *model = (ECalModel *) etm;
+ ESourceRegistry *registry;
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
priv = model->priv;
+ registry = e_cal_model_get_registry (model);
+
g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_FIELD_LAST, NULL);
g_return_val_if_fail (row >= 0 && row < priv->objects->len, NULL);
@@ -979,7 +1020,7 @@ ecm_value_at (ETableModel *etm,
if (e_cal_component_has_recurrences (comp))
retval = 1;
- else if (itip_organizer_is_user (comp, comp_data->client))
+ else if (itip_organizer_is_user (registry, comp, comp_data->client))
retval = 3;
else {
GSList *attendees = NULL, *sl;
@@ -990,7 +1031,7 @@ ecm_value_at (ETableModel *etm,
const gchar *text;
text = itip_strip_mailto (ca->value);
- if (itip_address_is_user (text)) {
+ if (itip_address_is_user (registry, text)) {
if (ca->delto != NULL)
retval = 3;
else
@@ -1599,7 +1640,7 @@ ecm_value_to_string (ETableModel *etm,
typedef struct {
const gchar *color;
- GList *uris;
+ GList *uids;
} AssignedColorData;
static const gchar *
@@ -1607,7 +1648,10 @@ ecm_get_color_for_component (ECalModel *model,
ECalModelComponent *comp_data)
{
ESource *source;
+ ESourceSelectable *extension;
const gchar *color_spec;
+ const gchar *extension_name;
+ const gchar *uid;
gint i, first_empty = 0;
static AssignedColorData assigned_colors[] = {
@@ -1625,35 +1669,48 @@ ecm_get_color_for_component (ECalModel *model,
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+ switch (e_cal_client_get_source_type (comp_data->client)) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ break;
+ default:
+ g_return_val_if_reached (NULL);
+ }
+
source = e_client_get_source (E_CLIENT (comp_data->client));
- color_spec = e_source_peek_color_spec (source);
+ extension = e_source_get_extension (source, extension_name);
+ color_spec = e_source_selectable_get_color (extension);
+
if (color_spec != NULL) {
g_free (comp_data->color);
comp_data->color = g_strdup (color_spec);
return comp_data->color;
}
+ uid = e_source_get_uid (source);
+
for (i = 0; i < G_N_ELEMENTS (assigned_colors); i++) {
GList *l;
- if (assigned_colors[i].uris == NULL) {
+ if (assigned_colors[i].uids == NULL) {
first_empty = i;
continue;
}
- for (l = assigned_colors[i].uris; l != NULL; l = l->next) {
- if (!strcmp ((const gchar *) l->data,
- e_client_get_uri (E_CLIENT (comp_data->client))))
- {
+ for (l = assigned_colors[i].uids; l != NULL; l = l->next)
+ if (g_strcmp0 (l->data, uid) == 0)
return assigned_colors[i].color;
- }
- }
}
/* return the first unused color */
- assigned_colors[first_empty].uris = g_list_append (
- assigned_colors[first_empty].uris,
- g_strdup (e_client_get_uri (E_CLIENT (comp_data->client))));
+ assigned_colors[first_empty].uids = g_list_append (
+ assigned_colors[first_empty].uids, g_strdup (uid));
return assigned_colors[first_empty].color;
}
@@ -1711,6 +1768,14 @@ e_cal_model_set_flags (ECalModel *model,
model->priv->flags = flags;
}
+ESourceRegistry *
+e_cal_model_get_registry (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
+ return model->priv->registry;
+}
+
icaltimezone *
e_cal_model_get_timezone (ECalModel *model)
{
@@ -2040,23 +2105,29 @@ e_cal_model_get_client_list (ECalModel *model)
}
/**
- * e_cal_model_get_client_for_uri:
+ * e_cal_model_get_client_for_source:
* @model: an #ECalModel
- * @uri: Uri for the client to get.
+ * @source: an #ESource
*/
ECalClient *
-e_cal_model_get_client_for_uri (ECalModel *model,
- const gchar *uri)
+e_cal_model_get_client_for_source (ECalModel *model,
+ ESource *source)
{
- GList *l;
+ GList *link;
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
- g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- for (l = model->priv->clients; l != NULL; l = l->next) {
- ECalModelClient *client_data = (ECalModelClient *) l->data;
+ for (link = model->priv->clients; link != NULL; link = link->next) {
+ ECalModelClient *client_data;
+ ESource *client_source;
+ EClient *client;
- if (!strcmp (uri, e_client_get_uri (E_CLIENT (client_data->client))))
+ client_data = (ECalModelClient *) link->data;
+ client = E_CLIENT (client_data->client);
+ client_source = e_client_get_source (client);
+
+ if (e_source_equal (source, client_source))
return client_data->client;
}
@@ -2892,7 +2963,7 @@ client_opened_cb (GObject *source_object,
g_warning (
"%s: Failed to open '%s': %s",
G_STRFUNC,
- e_source_peek_name (source),
+ e_source_get_display_name (source),
error->message);
g_error_free (error);
e_cal_model_update_status_message (model, NULL, -1.0);
@@ -2967,7 +3038,7 @@ add_new_client (ECalModel *model,
gchar *msg;
source = e_client_get_source (E_CLIENT (client));
- display_name = e_source_peek_name (source);
+ display_name = e_source_get_display_name (source);
msg = g_strdup_printf (_("Opening %s"), display_name);
e_cal_model_update_status_message (model, msg, -1.0);
g_free (msg);
@@ -3422,6 +3493,7 @@ e_cal_model_get_attendees_status_info (ECalModel *model,
{ ICAL_PARTSTAT_X, NULL, -1 }
};
+ ESourceRegistry *registry;
GSList *attendees = NULL, *a;
gboolean have = FALSE;
gchar *res = NULL;
@@ -3429,8 +3501,10 @@ e_cal_model_get_attendees_status_info (ECalModel *model,
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+ registry = e_cal_model_get_registry (model);
+
if (!comp || !e_cal_component_has_attendees (comp) ||
- !itip_organizer_is_user_ex (comp, cal_client, TRUE))
+ !itip_organizer_is_user_ex (registry, comp, cal_client, TRUE))
return NULL;
e_cal_component_get_attendee_list (comp, &attendees);
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index 6dd0467..d3cfac9 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -29,6 +29,7 @@
#include <e-util/e-util-enums.h>
#include <table/e-table-model.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-registry.h>
#include "e-cell-date-edit-text.h"
/* Standard GObject macros */
@@ -186,6 +187,8 @@ void e_cal_model_set_confirm_delete (ECalModel *model,
ECalModelFlags e_cal_model_get_flags (ECalModel *model);
void e_cal_model_set_flags (ECalModel *model,
ECalModelFlags flags);
+ESourceRegistry *
+ e_cal_model_get_registry (ECalModel *model);
icaltimezone * e_cal_model_get_timezone (ECalModel *model);
void e_cal_model_set_timezone (ECalModel *model,
icaltimezone *zone);
@@ -244,8 +247,9 @@ ECalClient * e_cal_model_get_default_client (ECalModel *model);
void e_cal_model_set_default_client (ECalModel *model,
ECalClient *client);
GList * e_cal_model_get_client_list (ECalModel *model);
-ECalClient * e_cal_model_get_client_for_uri (ECalModel *model,
- const gchar *uri);
+ECalClient * e_cal_model_get_client_for_source
+ (ECalModel *model,
+ ESource *source);
void e_cal_model_add_client (ECalModel *model,
ECalClient *cal_client);
void e_cal_model_remove_client (ECalModel *model,
diff --git a/calendar/gui/e-cal-source-config.c b/calendar/gui/e-cal-source-config.c
index a8e33e3..8931f0e 100644
--- a/calendar/gui/e-cal-source-config.c
+++ b/calendar/gui/e-cal-source-config.c
@@ -31,7 +31,7 @@
((obj), E_TYPE_CAL_SOURCE_CONFIG, ECalSourceConfigPrivate))
struct _ECalSourceConfigPrivate {
- ECalSourceType source_type;
+ ECalClientSourceType source_type;
GtkWidget *color_button;
GtkWidget *default_button;
};
@@ -55,11 +55,11 @@ cal_source_config_get_default (ESourceConfig *config)
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
registry = e_source_config_get_registry (config);
- if (priv->source_type == E_CAL_SOURCE_TYPE_EVENT)
+ if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
return e_source_registry_get_default_calendar (registry);
- else if (priv->source_type == E_CAL_SOURCE_TYPE_JOURNAL)
+ else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
return e_source_registry_get_default_memo_list (registry);
- else if (priv->source_type == E_CAL_SOURCE_TYPE_TODO)
+ else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
return e_source_registry_get_default_task_list (registry);
g_return_val_if_reached (NULL);
@@ -75,17 +75,17 @@ cal_source_config_set_default (ESourceConfig *config,
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
registry = e_source_config_get_registry (config);
- if (priv->source_type == E_CAL_SOURCE_TYPE_EVENT)
+ if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
e_source_registry_set_default_calendar (registry, source);
- else if (priv->source_type == E_CAL_SOURCE_TYPE_JOURNAL)
+ else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
e_source_registry_set_default_memo_list (registry, source);
- else if (priv->source_type == E_CAL_SOURCE_TYPE_TODO)
+ else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
e_source_registry_set_default_task_list (registry, source);
}
static void
cal_source_config_set_source_type (ECalSourceConfig *config,
- ECalSourceType source_type)
+ ECalClientSourceType source_type)
{
config->priv->source_type = source_type;
}
@@ -169,13 +169,13 @@ cal_source_config_constructed (GObject *object)
gtk_widget_show (widget);
switch (priv->source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
label = _("Mark as default calendar");
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
label = _("Mark as default task list");
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
label = _("Mark as default memo list");
break;
default:
@@ -287,8 +287,8 @@ e_cal_source_config_class_init (ECalSourceConfigClass *class)
"source-type",
"Source Type",
"The iCalendar object type",
- E_TYPE_CAL_SOURCE_TYPE,
- E_CAL_SOURCE_TYPE_EVENT,
+ E_TYPE_CAL_CLIENT_SOURCE_TYPE,
+ E_CAL_CLIENT_SOURCE_TYPE_EVENTS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -303,7 +303,7 @@ e_cal_source_config_init (ECalSourceConfig *config)
GtkWidget *
e_cal_source_config_new (ESourceRegistry *registry,
ESource *original_source,
- ECalSourceType source_type)
+ ECalClientSourceType source_type)
{
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
@@ -325,13 +325,13 @@ e_cal_source_config_get_selectable (ECalSourceConfig *config,
g_return_val_if_fail (E_IS_CAL_SOURCE_CONFIG (config), NULL);
switch (e_cal_source_config_get_source_type (config)) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
extension_name = E_SOURCE_EXTENSION_CALENDAR;
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
extension_name = E_SOURCE_EXTENSION_TASK_LIST;
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
break;
default:
@@ -341,7 +341,7 @@ e_cal_source_config_get_selectable (ECalSourceConfig *config,
return e_source_get_extension (scratch_source, extension_name);
}
-ECalSourceType
+ECalClientSourceType
e_cal_source_config_get_source_type (ECalSourceConfig *config)
{
g_return_val_if_fail (E_IS_CAL_SOURCE_CONFIG (config), 0);
@@ -365,15 +365,15 @@ e_cal_source_config_add_offline_toggle (ECalSourceConfig *config,
extension = e_source_get_extension (scratch_source, extension_name);
switch (e_cal_source_config_get_source_type (config)) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
label = _("Copy calendar contents locally "
"for offline operation");
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
label = _("Copy task list contents locally "
"for offline operation");
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
label = _("Copy memo list contents locally "
"for offline operation");
break;
diff --git a/calendar/gui/e-cal-source-config.h b/calendar/gui/e-cal-source-config.h
index ce4e11d..5ae01e1 100644
--- a/calendar/gui/e-cal-source-config.h
+++ b/calendar/gui/e-cal-source-config.h
@@ -19,7 +19,7 @@
#ifndef E_CAL_SOURCE_CONFIG_H
#define E_CAL_SOURCE_CONFIG_H
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <misc/e-source-config.h>
#include <libedataserver/e-source-extension.h>
@@ -60,12 +60,13 @@ struct _ECalSourceConfigClass {
GType e_cal_source_config_get_type (void) G_GNUC_CONST;
GtkWidget * e_cal_source_config_new (ESourceRegistry *registry,
ESource *original_source,
- ECalSourceType source_type);
+ ECalClientSourceType source_type);
ESourceExtension *
e_cal_source_config_get_selectable
(ECalSourceConfig *config,
ESource *scratch_source);
-ECalSourceType e_cal_source_config_get_source_type
+ECalClientSourceType
+ e_cal_source_config_get_source_type
(ECalSourceConfig *config);
void e_cal_source_config_add_offline_toggle
(ECalSourceConfig *config,
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index 9893916..76ac7b6 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -25,6 +25,7 @@
#include "e-calendar-selector.h"
#include <libecal/e-cal-client.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-selection.h"
@@ -176,7 +177,6 @@ calendar_selector_data_dropped (ESourceSelector *selector,
e_client_utils_open_new (
destination, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
- e_client_utils_authenticate_handler, NULL,
client_opened_cb, icalcomp);
success = TRUE;
@@ -216,11 +216,12 @@ e_calendar_selector_init (ECalendarSelector *selector)
}
GtkWidget *
-e_calendar_selector_new (ESourceList *source_list)
+e_calendar_selector_new (ESourceRegistry *registry)
{
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_CALENDAR_SELECTOR,
- "source-list", source_list, NULL);
+ "extension-name", E_SOURCE_EXTENSION_CALENDAR,
+ "registry", registry, NULL);
}
diff --git a/calendar/gui/e-calendar-selector.h b/calendar/gui/e-calendar-selector.h
index 65d9a2f..d8aec73 100644
--- a/calendar/gui/e-calendar-selector.h
+++ b/calendar/gui/e-calendar-selector.h
@@ -21,7 +21,6 @@
#ifndef E_CALENDAR_SELECTOR_H
#define E_CALENDAR_SELECTOR_H
-#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
@@ -59,7 +58,7 @@ struct _ECalendarSelectorClass {
};
GType e_calendar_selector_get_type (void);
-GtkWidget * e_calendar_selector_new (ESourceList *source_list);
+GtkWidget * e_calendar_selector_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index ebaede4..12461e6 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -164,6 +164,7 @@ calendar_view_delete_event (ECalendarView *cal_view,
ECalModel *model;
ECalComponent *comp;
ECalComponentVType vtype;
+ ESourceRegistry *registry;
gboolean delete = TRUE;
GError *error = NULL;
@@ -171,6 +172,7 @@ calendar_view_delete_event (ECalendarView *cal_view,
return;
model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -218,13 +220,13 @@ calendar_view_delete_event (ECalendarView *cal_view,
const gchar *uid;
gchar *rid = NULL;
- if ((itip_organizer_is_user (comp, event->comp_data->client) ||
- itip_sentby_is_user (comp, event->comp_data->client))
+ if ((itip_organizer_is_user (registry, comp, event->comp_data->client) ||
+ itip_sentby_is_user (registry, comp, event->comp_data->client))
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client,
comp, TRUE))
itip_send_comp (
- E_CAL_COMPONENT_METHOD_CANCEL,
+ registry, E_CAL_COMPONENT_METHOD_CANCEL,
comp, event->comp_data->client, NULL, NULL,
NULL, TRUE, FALSE);
@@ -446,11 +448,15 @@ calendar_view_update_actions (ESelectable *selectable,
static void
calendar_view_cut_clipboard (ESelectable *selectable)
{
+ ECalModel *model;
ECalendarView *cal_view;
+ ESourceRegistry *registry;
GList *selected, *l;
const gchar *uid;
cal_view = E_CALENDAR_VIEW (selectable);
+ model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
@@ -476,12 +482,12 @@ calendar_view_cut_clipboard (ESelectable *selectable)
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- if ((itip_organizer_is_user (comp, event->comp_data->client) ||
- itip_sentby_is_user (comp, event->comp_data->client))
+ if ((itip_organizer_is_user (registry, comp, event->comp_data->client) ||
+ itip_sentby_is_user (registry, comp, event->comp_data->client))
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client, comp, TRUE))
itip_send_comp (
- E_CAL_COMPONENT_METHOD_CANCEL,
+ registry, E_CAL_COMPONENT_METHOD_CANCEL,
comp, event->comp_data->client, NULL, NULL,
NULL, TRUE, FALSE);
@@ -959,7 +965,9 @@ e_calendar_view_add_event (ECalendarView *cal_view,
icalcomponent *icalcomp,
gboolean in_top_canvas)
{
+ ECalModel *model;
ECalComponent *comp;
+ ESourceRegistry *registry;
struct icaltimetype itime, old_dtstart, old_dtend;
time_t tt_start, tt_end, new_dtstart = 0;
struct icaldurationtype ic_dur, ic_oneday;
@@ -969,6 +977,9 @@ e_calendar_view_add_event (ECalendarView *cal_view,
GnomeCalendarViewType view_type;
GError *error = NULL;
+ model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
+
start_offset = 0;
end_offset = 0;
@@ -1064,14 +1075,14 @@ e_calendar_view_add_event (ECalendarView *cal_view,
g_free (uid);
}
- if ((itip_organizer_is_user (comp, client) ||
- itip_sentby_is_user (comp, client)) &&
+ if ((itip_organizer_is_user (registry, comp, client) ||
+ itip_sentby_is_user (registry, comp, client)) &&
send_component_dialog (
(GtkWindow *) gtk_widget_get_toplevel (
GTK_WIDGET (cal_view)),
client, comp, TRUE, &strip_alarms, NULL)) {
itip_send_comp (
- E_CAL_COMPONENT_METHOD_REQUEST,
+ registry, E_CAL_COMPONENT_METHOD_REQUEST,
comp, client, NULL, NULL, NULL, strip_alarms,
FALSE);
}
@@ -1275,10 +1286,12 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
ECalComponent *comp;
ECalendarViewEvent *event;
ECalComponentVType vtype;
+ ESourceRegistry *registry;
gboolean delete = TRUE;
GError *error = NULL;
model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
@@ -1350,8 +1363,8 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
e_cal_component_free_datetime (&dt);
- if ((itip_organizer_is_user (comp, event->comp_data->client) ||
- itip_sentby_is_user (comp, event->comp_data->client))
+ if ((itip_organizer_is_user (registry, comp, event->comp_data->client) ||
+ itip_sentby_is_user (registry, comp, event->comp_data->client))
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client,
comp, TRUE) && !e_cal_client_check_save_schedules (event->comp_data->client)) {
@@ -1368,7 +1381,7 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
}
itip_send_comp (
- E_CAL_COMPONENT_METHOD_CANCEL,
+ registry, E_CAL_COMPONENT_METHOD_CANCEL,
comp, event->comp_data->client, NULL, NULL,
NULL, TRUE, FALSE);
}
@@ -1459,7 +1472,7 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view,
widget = e_alert_dialog_new_for_args (
parent, "calendar:prompt-read-only-cal",
- e_source_peek_name (source),
+ e_source_get_display_name (source),
NULL);
g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy),
@@ -1664,19 +1677,24 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view,
icalcomponent *icalcomp,
EEditEventMode mode)
{
+ ECalModel *model;
+ ESourceRegistry *registry;
guint32 flags = 0;
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
g_return_if_fail (E_IS_CAL_CLIENT (client));
g_return_if_fail (icalcomp != NULL);
+ model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
+
if ((mode == EDIT_EVENT_AUTODETECT && icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY) != NULL)
|| mode == EDIT_EVENT_FORCE_MEETING) {
ECalComponent *comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
flags |= COMP_EDITOR_MEETING;
- if (itip_organizer_is_user (comp, client) ||
- itip_sentby_is_user (comp, client) ||
+ if (itip_organizer_is_user (registry, comp, client) ||
+ itip_sentby_is_user (registry, comp, client) ||
!e_cal_component_has_attendees (comp))
flags |= COMP_EDITOR_USER_ORG;
g_object_unref (comp);
@@ -1693,18 +1711,23 @@ e_calendar_view_modify_and_send (ECalendarView *cal_view,
GtkWindow *toplevel,
gboolean new)
{
+ ECalModel *model;
+ ESourceRegistry *registry;
gboolean only_new_attendees = FALSE;
GError *error = NULL;
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+ model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
+
e_cal_component_commit_sequence (comp);
if (e_cal_client_modify_object_sync (client, e_cal_component_get_icalcomponent (comp), mod, NULL, &error)) {
gboolean strip_alarms = TRUE;
- if ((itip_organizer_is_user (comp, client) ||
- itip_sentby_is_user (comp, client)) &&
+ if ((itip_organizer_is_user (registry, comp, client) ||
+ itip_sentby_is_user (registry, comp, client)) &&
send_component_dialog (toplevel, client, comp, new, &strip_alarms, &only_new_attendees)) {
ECalComponent *send_comp = NULL;
@@ -1728,7 +1751,7 @@ e_calendar_view_modify_and_send (ECalendarView *cal_view,
}
itip_send_comp (
- E_CAL_COMPONENT_METHOD_REQUEST,
+ registry, E_CAL_COMPONENT_METHOD_REQUEST,
send_comp ? send_comp : comp, client, NULL,
NULL, NULL, strip_alarms, only_new_attendees);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 8af5ffb..080b67e 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -295,7 +295,8 @@ static void e_day_view_foreach_event_with_uid (EDayView *day_view,
static void e_day_view_free_events (EDayView *day_view);
static void e_day_view_free_event_array (EDayView *day_view,
GArray *array);
-static gint e_day_view_add_event (ECalComponent *comp,
+static gint e_day_view_add_event (ESourceRegistry *registry,
+ ECalComponent *comp,
time_t start,
time_t end,
gpointer data);
@@ -714,9 +715,14 @@ process_component (EDayView *day_view,
{
const gchar *uid;
gchar *rid = NULL;
+ ECalModel *model;
ECalComponent *comp;
+ ESourceRegistry *registry;
AddEventData add_event_data;
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ registry = e_cal_model_get_registry (model);
+
/* If our time hasn't been set yet, just return. */
if (day_view->lower == 0 && day_view->upper == 0)
return;
@@ -740,7 +746,7 @@ process_component (EDayView *day_view,
add_event_data.day_view = day_view;
add_event_data.comp_data = comp_data;
e_day_view_add_event (
- comp, comp_data->instance_start,
+ registry, comp, comp_data->instance_start,
comp_data->instance_end, &add_event_data);
g_object_unref (comp);
@@ -4203,11 +4209,16 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
ECalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
+ ECalModel *model;
ECalClient *client;
+ ESourceRegistry *registry;
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
gint is_date;
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ registry = e_cal_model_get_registry (model);
+
event_num = day_view->resize_event_num;
if (!is_array_index_in_bounds (day_view->long_events, event_num))
@@ -4228,7 +4239,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (e_cal_component_has_attendees (comp) &&
- !itip_organizer_is_user (comp, client)) {
+ !itip_organizer_is_user (registry, comp, client)) {
g_object_unref (comp);
e_day_view_abort_resize (day_view);
return;
@@ -4322,10 +4333,15 @@ e_day_view_finish_resize (EDayView *day_view)
ECalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
+ ECalModel *model;
ECalClient *client;
+ ESourceRegistry *registry;
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ registry = e_cal_model_get_registry (model);
+
if (day_view->resize_event_num == -1)
return;
@@ -4350,7 +4366,7 @@ e_day_view_finish_resize (EDayView *day_view)
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (e_cal_component_has_attendees (comp) &&
- !itip_organizer_is_user (comp, client)) {
+ !itip_organizer_is_user (registry, comp, client)) {
g_object_unref (comp);
e_day_view_abort_resize (day_view);
return;
@@ -4503,7 +4519,8 @@ e_day_view_free_event_array (EDayView *day_view,
/* This adds one event to the view, adding it to the appropriate array. */
static gboolean
-e_day_view_add_event (ECalComponent *comp,
+e_day_view_add_event (ESourceRegistry *registry,
+ ECalComponent *comp,
time_t start,
time_t end,
gpointer data)
@@ -4570,8 +4587,8 @@ e_day_view_add_event (ECalComponent *comp,
event.different_timezone = TRUE;
if (!e_cal_component_has_attendees (comp) ||
- itip_organizer_is_user (comp, event.comp_data->client) ||
- itip_sentby_is_user (comp, event.comp_data->client))
+ itip_organizer_is_user (registry, comp, event.comp_data->client) ||
+ itip_sentby_is_user (registry, comp, event.comp_data->client))
event.is_editable = TRUE;
else
event.is_editable = FALSE;
@@ -5111,9 +5128,11 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view,
struct icaltimetype start_tt, end_tt;
const gchar *uid;
AddEventData add_event_data;
+ ESourceRegistry *registry;
model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ registry = e_cal_model_get_registry (model);
client = e_cal_model_get_default_client (model);
/* Check if the client is read only */
@@ -5164,7 +5183,7 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view,
* to the server until the user finishes editing it. */
add_event_data.day_view = day_view;
add_event_data.comp_data = NULL;
- e_day_view_add_event (comp, dtstart, dtend, &add_event_data);
+ e_day_view_add_event (registry, comp, dtstart, dtend, &add_event_data);
e_day_view_check_layout (day_view);
gtk_widget_queue_draw (day_view->top_canvas);
gtk_widget_queue_draw (day_view->main_canvas);
@@ -6479,13 +6498,18 @@ e_day_view_change_event_time (EDayView *day_view,
ECalComponent *comp;
ECalComponentDateTime date;
struct icaltimetype itt;
+ ECalModel *model;
ECalClient *client;
+ ESourceRegistry *registry;
CalObjModType mod = CALOBJ_MOD_ALL;
GtkWindow *toplevel;
day = day_view->editing_event_day;
event_num = day_view->editing_event_num;
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ registry = e_cal_model_get_registry (model);
+
if (!is_array_index_in_bounds (day_view->events[day], event_num))
return;
@@ -6504,7 +6528,7 @@ e_day_view_change_event_time (EDayView *day_view,
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (e_cal_component_has_attendees (comp) &&
- !itip_organizer_is_user (comp, client)) {
+ !itip_organizer_is_user (registry, comp, client)) {
g_object_unref (comp);
return;
}
@@ -7891,7 +7915,7 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
gchar *tmp;
source = e_client_get_source (E_CLIENT (event->comp_data->client));
- source_uid = e_source_peek_uid (source);
+ source_uid = e_source_get_uid (source);
tmp = g_strconcat (source_uid, "\n", comp_str, NULL);
target = gtk_selection_data_get_target (selection_data);
@@ -7922,6 +7946,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
gint start_offset, end_offset;
ECalComponent *comp;
ECalComponentDateTime date;
+ ESourceRegistry *registry;
struct icaltimetype itt;
time_t dt;
gboolean all_day_event;
@@ -7943,6 +7968,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
cal_view = E_CALENDAR_VIEW (day_view);
model = e_calendar_view_get_model (cal_view);
+
+ registry = e_cal_model_get_registry (model);
client = e_cal_model_get_default_client (model);
/* Note that we only support DnD within the EDayView at present. */
@@ -8007,7 +8034,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (e_cal_component_has_attendees (comp) &&
- !itip_organizer_is_user (comp, client)) {
+ !itip_organizer_is_user (registry, comp, client)) {
g_object_unref (comp);
return;
}
@@ -8173,6 +8200,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
ECalModel *model;
ECalComponent *comp;
ECalComponentDateTime date;
+ ESourceRegistry *registry;
struct icaltimetype itt;
time_t dt;
ECalClient *client;
@@ -8184,6 +8212,8 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
model = e_calendar_view_get_model (cal_view);
time_divisions = e_calendar_view_get_time_divisions (cal_view);
+ registry = e_cal_model_get_registry (model);
+
data = gtk_selection_data_get_data (selection_data);
format = gtk_selection_data_get_format (selection_data);
length = gtk_selection_data_get_length (selection_data);
@@ -8261,7 +8291,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (e_cal_component_has_attendees (comp) &&
- !itip_organizer_is_user (comp, client)) {
+ !itip_organizer_is_user (registry, comp, client)) {
g_object_unref (comp);
return;
}
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index c27697b..0efab1d 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -39,6 +39,7 @@
#include "itip-utils.h"
#include <misc/e-cell-renderer-combo.h>
#include <libebook/e-destination.h>
+#include <shell/e-shell.h>
#include "e-select-names-renderer.h"
struct _EMeetingListViewPrivate {
@@ -144,6 +145,8 @@ e_meeting_list_view_init (EMeetingListView *view)
{
EMeetingListViewPrivate *priv;
ENameSelectorDialog *name_selector_dialog;
+ ESourceRegistry *registry;
+ EShell *shell;
gint i;
priv = g_new0 (EMeetingListViewPrivate, 1);
@@ -152,7 +155,11 @@ e_meeting_list_view_init (EMeetingListView *view)
priv->renderers = g_hash_table_new (g_direct_hash, g_int_equal);
- priv->name_selector = e_name_selector_new ();
+ /* FIXME Refactor this so we don't need e_shell_get_default(). */
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+
+ priv->name_selector = e_name_selector_new (registry);
for (i = 0; sections[i]; i++)
add_section (priv->name_selector, sections[i]);
@@ -825,7 +832,7 @@ process_section (EMeetingListView *view,
ENameSelectorModel *model;
EContactStore *c_store;
GSList *clients, *l;
- gchar *uri = e_contact_get (contact, E_CONTACT_BOOK_URI);
+ gchar *uid = e_contact_get (contact, E_CONTACT_BOOK_URI);
dialog = e_name_selector_peek_dialog (view->priv->name_selector);
model = e_name_selector_dialog_peek_model (dialog);
@@ -834,7 +841,11 @@ process_section (EMeetingListView *view,
for (l = clients; l; l = l->next) {
EBookClient *b = l->data;
- if (g_str_equal (uri, e_client_get_uri (E_CLIENT (b)))) {
+ ESource *source;
+
+ source = e_client_get_source (E_CLIENT (b));
+
+ if (g_strcmp0 (uid, e_source_get_uid (source)) == 0) {
book_client = b;
break;
}
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index 833c6a8..8ceae27 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -34,9 +34,12 @@
#include <libebackend/e-extensible.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-proxy.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-password.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-passwords.h>
-#include <e-util/e-account-utils.h>
#include <e-util/e-util-enumtypes.h>
+#include <shell/e-shell.h>
#include "itip-utils.h"
#include "e-meeting-utils.h"
#include "e-meeting-attendee.h"
@@ -1136,31 +1139,37 @@ e_meeting_store_find_self (EMeetingStore *store,
gint *row)
{
EMeetingAttendee *attendee = NULL;
- EAccountList *account_list;
- EIterator *iterator;
+ ESourceRegistry *registry;
+ EShell *shell;
+ GList *list, *iter;
+ const gchar *extension_name;
g_return_val_if_fail (E_IS_MEETING_STORE (store), NULL);
- account_list = e_get_account_list ();
+ /* FIXME Refactor this so we don't need e_shell_get_default(). */
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
- iterator = e_list_get_iterator (E_LIST (account_list));
+ list = e_source_registry_list_sources (registry, extension_name);
- while (e_iterator_is_valid (iterator)) {
- EAccount *account;
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceMailIdentity *extension;
+ const gchar *address;
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ extension = e_source_get_extension (source, extension_name);
+ address = e_source_mail_identity_get_address (extension);
- attendee = e_meeting_store_find_attendee (
- store, account->id->address, row);
+ if (address != NULL)
+ attendee = e_meeting_store_find_attendee (
+ store, address, row);
if (attendee != NULL)
break;
-
- e_iterator_next (iterator);
}
- g_object_unref (iterator);
+ g_list_free (list);
return attendee;
}
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
index 4484f94..2ffc536 100644
--- a/calendar/gui/e-memo-list-selector.c
+++ b/calendar/gui/e-memo-list-selector.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <libecal/e-cal-client.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-selection.h"
#include "calendar/gui/comp-util.h"
@@ -159,8 +160,8 @@ memo_list_selector_process_data (ESourceSelector *selector,
icalcomponent *icalcomp,
GdkDragAction action)
{
- ESourceList *source_list;
ESource *source;
+ ESourceRegistry *registry;
icalcomponent *tmp_icalcomp = NULL;
const gchar *uid;
gchar *old_uid = NULL;
@@ -200,14 +201,14 @@ memo_list_selector_process_data (ESourceSelector *selector,
if (!success || action != GDK_ACTION_MOVE)
goto exit;
- source_list = e_source_selector_get_source_list (selector);
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
- if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
+ if (!E_IS_SOURCE (source))
goto exit;
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
client_opened_cb, g_strdup (old_uid));
exit:
@@ -297,8 +298,8 @@ memo_list_selector_data_dropped (ESourceSelector *selector,
dd->action = action;
dd->list = cal_comp_selection_get_string_list (selection_data);
- e_client_utils_open_new (destination, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
+ e_client_utils_open_new (
+ destination, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
client_opened_for_drop_cb, dd);
return TRUE;
@@ -329,11 +330,12 @@ e_memo_list_selector_init (EMemoListSelector *selector)
}
GtkWidget *
-e_memo_list_selector_new (ESourceList *source_list)
+e_memo_list_selector_new (ESourceRegistry *registry)
{
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_MEMO_LIST_SELECTOR,
- "source-list", source_list, NULL);
+ "extension-name", E_SOURCE_EXTENSION_MEMO_LIST,
+ "registry", registry, NULL);
}
diff --git a/calendar/gui/e-memo-list-selector.h b/calendar/gui/e-memo-list-selector.h
index c10cff2..62dc0e1 100644
--- a/calendar/gui/e-memo-list-selector.h
+++ b/calendar/gui/e-memo-list-selector.h
@@ -26,7 +26,6 @@
#ifndef E_MEMO_LIST_SELECTOR_H
#define E_MEMO_LIST_SELECTOR_H
-#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
@@ -64,7 +63,7 @@ struct _EMemoListSelectorClass {
};
GType e_memo_list_selector_get_type (void);
-GtkWidget * e_memo_list_selector_new (ESourceList *source_list);
+GtkWidget * e_memo_list_selector_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c
index ba210e8..ee2f72e 100644
--- a/calendar/gui/e-task-list-selector.c
+++ b/calendar/gui/e-task-list-selector.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <libecal/e-cal-client.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-selection.h"
#include "calendar/gui/comp-util.h"
@@ -160,8 +161,8 @@ task_list_selector_process_data (ESourceSelector *selector,
icalcomponent *icalcomp,
GdkDragAction action)
{
- ESourceList *source_list;
ESource *source;
+ ESourceRegistry *registry;
icalcomponent *tmp_icalcomp = NULL;
const gchar *uid;
gchar *old_uid = NULL;
@@ -202,14 +203,14 @@ task_list_selector_process_data (ESourceSelector *selector,
if (!success || action != GDK_ACTION_MOVE)
goto exit;
- source_list = e_source_selector_get_source_list (selector);
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
- if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
+ if (!E_IS_SOURCE (source))
goto exit;
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
client_opened_cb, g_strdup (old_uid));
exit:
@@ -299,8 +300,8 @@ task_list_selector_data_dropped (ESourceSelector *selector,
dd->action = action;
dd->list = cal_comp_selection_get_string_list (selection_data);
- e_client_utils_open_new (destination, E_CLIENT_SOURCE_TYPE_TASKS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
+ e_client_utils_open_new (
+ destination, E_CLIENT_SOURCE_TYPE_TASKS, TRUE, NULL,
client_opened_for_drop_cb, dd);
return TRUE;
@@ -331,11 +332,12 @@ e_task_list_selector_init (ETaskListSelector *selector)
}
GtkWidget *
-e_task_list_selector_new (ESourceList *source_list)
+e_task_list_selector_new (ESourceRegistry *registry)
{
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_TASK_LIST_SELECTOR,
- "source-list", source_list, NULL);
+ "extension-name", E_SOURCE_EXTENSION_TASK_LIST,
+ "registry", registry, NULL);
}
diff --git a/calendar/gui/e-task-list-selector.h b/calendar/gui/e-task-list-selector.h
index 847a221..735611a 100644
--- a/calendar/gui/e-task-list-selector.h
+++ b/calendar/gui/e-task-list-selector.h
@@ -26,7 +26,6 @@
#ifndef E_TASK_LIST_SELECTOR_H
#define E_TASK_LIST_SELECTOR_H
-#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
@@ -64,7 +63,7 @@ struct _ETaskListSelectorClass {
};
GType e_task_list_selector_get_type (void);
-GtkWidget * e_task_list_selector_new (ESourceList *source_list);
+GtkWidget * e_task_list_selector_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 66c90fb..a660367 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -72,6 +72,7 @@
/* Private part of the GnomeCalendar structure */
struct _GnomeCalendarPrivate {
+ ESourceRegistry *registry;
ECalModel *model;
/*
@@ -139,6 +140,7 @@ enum {
PROP_0,
PROP_DATE_NAVIGATOR,
PROP_MEMO_TABLE,
+ PROP_REGISTRY,
PROP_TASK_TABLE,
PROP_VIEW
};
@@ -329,6 +331,16 @@ gnome_calendar_update_time_range (GnomeCalendar *gcal)
}
static void
+gnome_calendar_set_registry (GnomeCalendar *gcal,
+ ESourceRegistry *registry)
+{
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+ g_return_if_fail (gcal->priv->registry == NULL);
+
+ gcal->priv->registry = g_object_ref (registry);
+}
+
+static void
gnome_calendar_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -347,6 +359,12 @@ gnome_calendar_set_property (GObject *object,
g_value_get_object (value));
return;
+ case PROP_REGISTRY:
+ gnome_calendar_set_registry (
+ GNOME_CALENDAR (object),
+ g_value_get_object (value));
+ return;
+
case PROP_TASK_TABLE:
gnome_calendar_set_task_table (
GNOME_CALENDAR (object),
@@ -382,6 +400,12 @@ gnome_calendar_get_property (GObject *object,
GNOME_CALENDAR (object)));
return;
+ case PROP_REGISTRY:
+ g_value_set_object (
+ value, gnome_calendar_get_registry (
+ GNOME_CALENDAR (object)));
+ return;
+
case PROP_TASK_TABLE:
g_value_set_object (
value, gnome_calendar_get_task_table (
@@ -403,11 +427,14 @@ gnome_calendar_constructed (GObject *object)
{
GnomeCalendar *gcal = GNOME_CALENDAR (object);
ECalendarView *calendar_view;
+ ESourceRegistry *registry;
ECalModel *model;
GtkAdjustment *adjustment;
+ registry = gnome_calendar_get_registry (gcal);
+
/* Create the model for the views. */
- model = e_cal_model_calendar_new ();
+ model = e_cal_model_calendar_new (registry);
e_cal_model_set_flags (model, E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
gcal->priv->model = model;
@@ -538,6 +565,18 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
g_object_class_install_property (
object_class,
+ PROP_REGISTRY,
+ g_param_spec_object (
+ "registry",
+ "Registry",
+ "Data source registry",
+ E_TYPE_SOURCE_REGISTRY,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_TASK_TABLE,
g_param_spec_object (
"task-table",
@@ -1492,6 +1531,11 @@ gnome_calendar_do_dispose (GObject *object)
gcal = GNOME_CALENDAR (object);
priv = gcal->priv;
+ if (priv->registry != NULL) {
+ g_object_unref (priv->registry);
+ priv->registry = NULL;
+ }
+
if (priv->model != NULL) {
g_signal_handlers_disconnect_by_func (
priv->model, view_progress_cb, gcal);
@@ -1910,9 +1954,21 @@ gnome_calendar_display_view (GnomeCalendar *gcal,
}
GtkWidget *
-gnome_calendar_new (void)
+gnome_calendar_new (ESourceRegistry *registry)
{
- return g_object_new (GNOME_TYPE_CALENDAR, NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ return g_object_new (
+ GNOME_TYPE_CALENDAR,
+ "registry", registry, NULL);
+}
+
+ESourceRegistry *
+gnome_calendar_get_registry (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+
+ return gcal->priv->registry;
}
ECalendar *
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index bc65fe2..c8cb5e8 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -31,6 +31,7 @@
#include <gtk/gtk.h>
#include <misc/e-calendar.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-registry.h>
#include "e-cal-model.h"
@@ -112,7 +113,9 @@ struct _GnomeCalendarClass {
};
GType gnome_calendar_get_type (void);
-GtkWidget * gnome_calendar_new (void);
+GtkWidget * gnome_calendar_new (ESourceRegistry *registry);
+ESourceRegistry *
+ gnome_calendar_get_registry (GnomeCalendar *gcal);
ECalendar * gnome_calendar_get_date_navigator
(GnomeCalendar *gcal);
void gnome_calendar_set_date_navigator
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 187757c..82cb8ac 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -26,9 +26,11 @@
#include <glib/gi18n.h>
#include <libedataserver/e-time-utils.h>
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-registry.h>
#include <gtk/gtk.h>
#include <libical/ical.h>
-#include <e-util/e-account-utils.h>
#include <e-util/e-dialog-utils.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-util.h>
@@ -65,6 +67,7 @@ static icalproperty_method itip_methods_enum[] = {
/**
* itip_get_user_identities:
+ * @registry: an #ESourceRegistry
*
* Returns a %NULL-terminated array of name + address strings based on
* registered mail identities. Free the returned array with g_strfreev().
@@ -72,41 +75,42 @@ static icalproperty_method itip_methods_enum[] = {
* Returns: an %NULL-terminated array of mail identity strings
**/
gchar **
-itip_get_user_identities (void)
+itip_get_user_identities (ESourceRegistry *registry)
{
- EAccountList *account_list;
- EIterator *iterator;
+ GList *list, *iter;
+ const gchar *extension_name;
gchar **identities;
- gint length, ii = 0;
+ guint ii = 0;
- account_list = e_get_account_list ();
- length = e_list_length (E_LIST (account_list));
- iterator = e_list_get_iterator (E_LIST (account_list));
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
- identities = g_new0 (gchar *, length + 1);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
- while (e_iterator_is_valid (iterator)) {
- EAccount *account;
+ list = e_source_registry_list_sources (registry, extension_name);
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ identities = g_new0 (gchar *, g_list_length (list) + 1);
- if (account->enabled)
- identities[ii++] = g_strdup_printf (
- "%s <%s>",
- account->id->name,
- account->id->address);
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceMailIdentity *extension;
+ const gchar *name, *address;
- e_iterator_next (iterator);
+ extension = e_source_get_extension (source, extension_name);
+
+ name = e_source_mail_identity_get_name (extension);
+ address = e_source_mail_identity_get_address (extension);
+
+ identities[ii++] = g_strdup_printf ("%s <%s>", name, address);
}
- g_object_unref (iterator);
+ g_list_free (list);
return identities;
}
/**
* itip_get_fallback_identity:
+ * @registry: an #ESourceRegistry
*
* Returns a name + address string taken from the default mail identity,
* but only if the corresponding account is enabled. If the account is
@@ -117,23 +121,42 @@ itip_get_user_identities (void)
* Returns: a fallback mail identity, or %NULL
**/
gchar *
-itip_get_fallback_identity (void)
+itip_get_fallback_identity (ESourceRegistry *registry)
{
- EAccount *account;
- gchar *identity = NULL;
+ ESource *source;
+ ESourceMailAccount *mail_account;
+ ESourceMailIdentity *mail_identity;
+ const gchar *extension_name;
+ const gchar *address;
+ const gchar *name;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ source = e_source_registry_get_default_mail_account (registry);
+
+ if (!e_source_get_enabled (source))
+ return NULL;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ mail_account = e_source_get_extension (source, extension_name);
+
+ source = e_source_mail_account_get_identity (mail_account);
+
+ if (source == NULL)
+ return NULL;
- account = e_get_default_account ();
- if (account != NULL && account->enabled)
- identity = g_strdup_printf (
- "%s <%s>",
- account->id->name,
- account->id->address);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ mail_identity = e_source_get_extension (source, extension_name);
- return identity;
+ name = e_source_mail_identity_get_name (mail_identity);
+ address = e_source_mail_identity_get_address (mail_identity);
+
+ return g_strdup_printf ("%s <%s>", name, address);
}
/**
* itip_address_is_user:
+ * @registry: an #ESourceRegistry
* @address: an email address
*
* Looks for a registered mail identity with a matching email address.
@@ -141,31 +164,53 @@ itip_get_fallback_identity (void)
* Returns: %TRUE if a match was found, %FALSE if not
**/
gboolean
-itip_address_is_user (const gchar *address)
+itip_address_is_user (ESourceRegistry *registry,
+ const gchar *address)
{
- EAccountList *account_list;
- EAccount *account;
+ GList *list, *iter;
+ const gchar *extension_name;
+ gboolean match = FALSE;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
g_return_val_if_fail (address != NULL, FALSE);
- account_list = e_get_account_list ();
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceMailIdentity *extension;
+ const gchar *id_address;
+
+ extension = e_source_get_extension (source, extension_name);
+ id_address = e_source_mail_identity_get_address (extension);
+
+ if (id_address == NULL)
+ continue;
+
+ if (g_ascii_strcasecmp (address, id_address) == 0) {
+ match = TRUE;
+ break;
+ }
+ }
- /* XXX EAccountList misuses const. */
- account = (EAccount *) e_account_list_find (
- account_list, E_ACCOUNT_FIND_ID_ADDRESS, address);
+ g_list_free (list);
- return (account != NULL);
+ return match;
}
gboolean
-itip_organizer_is_user (ECalComponent *comp,
+itip_organizer_is_user (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client)
{
- return itip_organizer_is_user_ex (comp, cal_client, FALSE);
+ return itip_organizer_is_user_ex (registry, comp, cal_client, FALSE);
}
gboolean
-itip_organizer_is_user_ex (ECalComponent *comp,
+itip_organizer_is_user_ex (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client,
gboolean skip_cap_test)
{
@@ -173,6 +218,8 @@ itip_organizer_is_user_ex (ECalComponent *comp,
const gchar *strip;
gboolean user_org = FALSE;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
if (!e_cal_component_has_organizer (comp) ||
(!skip_cap_test && e_client_check_capability (
E_CLIENT (cal_client), CAL_STATIC_CAPABILITY_NO_ORGANIZER)))
@@ -197,20 +244,23 @@ itip_organizer_is_user_ex (ECalComponent *comp,
return FALSE;
}
- user_org = itip_address_is_user (strip);
+ user_org = itip_address_is_user (registry, strip);
}
return user_org;
}
gboolean
-itip_sentby_is_user (ECalComponent *comp,
+itip_sentby_is_user (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client)
{
ECalComponentOrganizer organizer;
const gchar *strip;
gboolean user_sentby = FALSE;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
if (!e_cal_component_has_organizer (comp) ||
e_client_check_capability (
E_CLIENT (cal_client), CAL_STATIC_CAPABILITY_NO_ORGANIZER))
@@ -219,7 +269,7 @@ itip_sentby_is_user (ECalComponent *comp,
e_cal_component_get_organizer (comp, &organizer);
if (organizer.sentby != NULL) {
strip = itip_strip_mailto (organizer.sentby);
- user_sentby = itip_address_is_user (strip);
+ user_sentby = itip_address_is_user (registry, strip);
}
return user_sentby;
@@ -280,6 +330,7 @@ gchar *
itip_get_comp_attendee (ECalComponent *comp,
ECalClient *cal_client)
{
+#if 0 /* ACCOUNT_MGMT */
GSList *attendees;
EAccountList *al;
EAccount *a;
@@ -296,28 +347,31 @@ itip_get_comp_attendee (ECalComponent *comp,
CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
&address, NULL, NULL);
- if (address && *address) {
+ if (address != NULL && *address != '\0') {
attendee = get_attendee (attendees, address);
if (attendee) {
gchar *user_email;
- user_email = g_strdup (itip_strip_mailto (attendee->value));
-
+ user_email = g_strdup (
+ itip_strip_mailto (attendee->value));
e_cal_component_free_attendee_list (attendees);
g_free (address);
+
return user_email;
}
- attendee = get_attendee_if_attendee_sentby_is_user (attendees, address);
+ attendee = get_attendee_if_attendee_sentby_is_user (
+ attendees, address);
- if (attendee) {
+ if (attendee != NULL) {
gchar *user_email;
- user_email = g_strdup (itip_strip_mailto (attendee->sentby));
-
+ user_email = g_strdup (
+ itip_strip_mailto (attendee->sentby));
e_cal_component_free_attendee_list (attendees);
g_free (address);
+
return user_email;
}
@@ -334,21 +388,28 @@ itip_get_comp_attendee (ECalComponent *comp,
continue;
attendee = get_attendee (attendees, a->id->address);
- if (attendee) {
- gchar *user_email = g_strdup (itip_strip_mailto (attendee->value));
+ if (attendee != NULL) {
+ gchar *user_email;
+ user_email = g_strdup (
+ itip_strip_mailto (attendee->value));
e_cal_component_free_attendee_list (attendees);
+
return user_email;
}
/* If the account was not found in the attendees list, then
* let's check the 'sentby' fields of the attendees if we can
* find the account. */
- attendee = get_attendee_if_attendee_sentby_is_user (attendees, a->id->address);
+ attendee = get_attendee_if_attendee_sentby_is_user (
+ attendees, a->id->address);
if (attendee) {
- gchar *user_email = g_strdup (itip_strip_mailto (attendee->sentby));
+ gchar *user_email;
+ user_email = g_strdup (
+ itip_strip_mailto (attendee->sentby));
e_cal_component_free_attendee_list (attendees);
+
return user_email;
}
}
@@ -361,7 +422,11 @@ itip_get_comp_attendee (ECalComponent *comp,
address = g_strdup ((a != NULL) ? a->id->address : "");
e_cal_component_free_attendee_list (attendees);
+
return address;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
const gchar *
@@ -1007,7 +1072,8 @@ comp_server_send (ECalComponentItipMethod method,
}
static gboolean
-comp_limit_attendees (ECalComponent *comp)
+comp_limit_attendees (ESourceRegistry *registry,
+ ECalComponent *comp)
{
icalcomponent *icomp;
icalproperty *prop;
@@ -1039,7 +1105,7 @@ comp_limit_attendees (ECalComponent *comp)
attendee_text = g_strdup (itip_strip_mailto (attendee));
g_free (attendee);
attendee_text = g_strstrip (attendee_text);
- found = match = itip_address_is_user (attendee_text);
+ found = match = itip_address_is_user (registry, attendee_text);
if (!found) {
param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
@@ -1051,7 +1117,7 @@ comp_limit_attendees (ECalComponent *comp)
attendee_sentby_text =
g_strstrip (g_strdup (attendee_sentby));
found = match = itip_address_is_user (
- attendee_sentby_text);
+ registry, attendee_sentby_text);
}
}
@@ -1082,6 +1148,7 @@ comp_sentby (ECalComponent *comp,
gchar *user = NULL;
e_cal_component_get_organizer (comp, &organizer);
+#if 0 /* ACCOUNT_MGMT */
if (!organizer.value) {
EAccount *a = e_get_default_account ();
@@ -1095,6 +1162,7 @@ comp_sentby (ECalComponent *comp,
return;
}
+#endif /* ACCOUNT_MGMT */
e_cal_component_get_attendee_list (comp, &attendees);
user = itip_get_comp_attendee (comp, cal_client);
@@ -1110,6 +1178,7 @@ comp_sentby (ECalComponent *comp,
}
}
+#if 0 /* ACCOUNT_MGMT */
if (!itip_organizer_is_user (comp, cal_client) && !itip_sentby_is_user (comp, cal_client)) {
EAccount *a = e_get_default_account ();
@@ -1125,9 +1194,12 @@ comp_sentby (ECalComponent *comp,
g_free ((gchar *) organizer.cn);
g_free ((gchar *) organizer.language);
}
+#endif /* ACCOUNT_MGMT */
}
+
static ECalComponent *
-comp_minimal (ECalComponent *comp,
+comp_minimal (ESourceRegistry *registry,
+ ECalComponent *comp,
gboolean attendee)
{
ECalComponent *clone;
@@ -1148,7 +1220,7 @@ comp_minimal (ECalComponent *comp,
e_cal_component_get_attendee_list (comp, &attendees);
e_cal_component_set_attendee_list (clone, attendees);
- if (!comp_limit_attendees (clone)) {
+ if (!comp_limit_attendees (registry, clone)) {
e_notice (NULL, GTK_MESSAGE_ERROR,
_("You must be an attendee of the event."));
goto error;
@@ -1235,7 +1307,8 @@ strip_x_microsoft_props (ECalComponent *comp)
}
static ECalComponent *
-comp_compliant (ECalComponentItipMethod method,
+comp_compliant (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *comp,
ECalClient *client,
icalcomponent *zones,
@@ -1348,7 +1421,7 @@ comp_compliant (ECalComponentItipMethod method,
break;
case E_CAL_COMPONENT_METHOD_REFRESH:
/* Need to remove almost everything */
- temp_clone = comp_minimal (clone, TRUE);
+ temp_clone = comp_minimal (registry, clone, TRUE);
g_object_unref (clone);
clone = temp_clone;
break;
@@ -1356,7 +1429,7 @@ comp_compliant (ECalComponentItipMethod method,
break;
case E_CAL_COMPONENT_METHOD_DECLINECOUNTER:
/* Need to remove almost everything */
- temp_clone = comp_minimal (clone, FALSE);
+ temp_clone = comp_minimal (registry, clone, FALSE);
g_object_unref (clone);
clone = temp_clone;
break;
@@ -1413,6 +1486,7 @@ append_cal_attachments (EMsgComposer *composer,
g_slist_free (attach_list);
}
+#if 0 /* ACCOUNT_MGMT */
static EAccount *
find_enabled_account (EAccountList *accounts,
const gchar *id_address)
@@ -1442,6 +1516,7 @@ find_enabled_account (EAccountList *accounts,
return account;
}
+#endif /* ACCOUNT_MGMT */
static void
setup_from (ECalComponentItipMethod method,
@@ -1449,6 +1524,7 @@ setup_from (ECalComponentItipMethod method,
ECalClient *cal_client,
EComposerHeaderTable *table)
{
+#if 0 /* ACCOUNT_MGMT */
EAccountList *accounts;
accounts = e_composer_header_table_get_account_list (table);
@@ -1479,10 +1555,12 @@ setup_from (ECalComponentItipMethod method,
if (account)
e_composer_header_table_set_account (table, account);
}
+#endif /* ACCOUNT_MGMT */
}
gboolean
-itip_send_comp (ECalComponentItipMethod method,
+itip_send_comp (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
icalcomponent *zones,
@@ -1505,6 +1583,8 @@ itip_send_comp (ECalComponentItipMethod method,
gboolean use_24_hour_format;
gboolean retval = FALSE;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
/* FIXME Pass this in. */
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
@@ -1539,7 +1619,8 @@ itip_send_comp (ECalComponentItipMethod method,
/* Tidy up the comp */
comp = comp_compliant (
- method, send_comp, cal_client, zones, default_zone, strip_alarms);
+ registry, method, send_comp, cal_client,
+ zones, default_zone, strip_alarms);
if (comp == NULL)
goto cleanup;
@@ -1634,7 +1715,8 @@ cleanup:
}
gboolean
-reply_to_calendar_comp (ECalComponentItipMethod method,
+reply_to_calendar_comp (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
gboolean reply_all,
@@ -1654,6 +1736,8 @@ reply_to_calendar_comp (ECalComponentItipMethod method,
gchar *ical_string = NULL;
gboolean retval = FALSE;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
/* FIXME Pass this in. */
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
@@ -1663,7 +1747,8 @@ reply_to_calendar_comp (ECalComponentItipMethod method,
/* Tidy up the comp */
comp = comp_compliant (
- method, send_comp, cal_client, zones, default_zone, TRUE);
+ registry, method, send_comp, cal_client,
+ zones, default_zone, TRUE);
if (comp == NULL)
goto cleanup;
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 6da2519..99e060d 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -24,7 +24,7 @@
#include <string.h>
#include <libecal/e-cal-client.h>
#include <libecal/e-cal-component.h>
-#include <libedataserver/e-account-list.h>
+#include <libedataserver/e-source-registry.h>
G_BEGIN_DECLS
@@ -49,20 +49,25 @@ struct CalMimeAttach {
guint length;
};
-gchar ** itip_get_user_identities (void);
-gchar * itip_get_fallback_identity (void);
-gboolean itip_address_is_user (const gchar *address);
-gboolean itip_organizer_is_user (ECalComponent *comp,
+gchar ** itip_get_user_identities (ESourceRegistry *registry);
+gchar * itip_get_fallback_identity (ESourceRegistry *registry);
+gboolean itip_address_is_user (ESourceRegistry *registry,
+ const gchar *address);
+gboolean itip_organizer_is_user (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client);
-gboolean itip_organizer_is_user_ex (ECalComponent *comp,
+gboolean itip_organizer_is_user_ex (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client,
gboolean skip_cap_test);
-gboolean itip_sentby_is_user (ECalComponent *comp,
+gboolean itip_sentby_is_user (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client);
const gchar * itip_strip_mailto (const gchar *address);
gchar * itip_get_comp_attendee (ECalComponent *comp,
ECalClient *cal_client);
-gboolean itip_send_comp (ECalComponentItipMethod method,
+gboolean itip_send_comp (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *comp,
ECalClient *cal_client,
icalcomponent *zones,
@@ -79,7 +84,8 @@ gboolean itip_publish_begin (ECalComponent *pub_comp,
ECalClient *cal_client,
gboolean cloned,
ECalComponent **clone);
-gboolean reply_to_calendar_comp (ECalComponentItipMethod method,
+gboolean reply_to_calendar_comp (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
gboolean reply_all,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]