aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-12-14 05:05:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-03 11:00:40 +0800
commit68c35c4bedc4cd36cf2396121921f2e781b631fb (patch)
tree3a705b4c5776881d1d3899de674fdacea2440133 /calendar
parentebed1366e5d62a4fd0912abe2c725f31e8901444 (diff)
downloadgsoc2013-evolution-68c35c4bedc4cd36cf2396121921f2e781b631fb.tar.gz
gsoc2013-evolution-68c35c4bedc4cd36cf2396121921f2e781b631fb.tar.zst
gsoc2013-evolution-68c35c4bedc4cd36cf2396121921f2e781b631fb.zip
Adapt calendar/gui to the new ESource API.
Diffstat (limited to 'calendar')
-rw-r--r--calendar/alarm-notify/config-data.h1
-rw-r--r--calendar/gui/dialogs/Makefile.am3
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c7
-rw-r--r--calendar/gui/dialogs/alarm-dialog.h2
-rw-r--r--calendar/gui/dialogs/alarm-list-dialog.c13
-rw-r--r--calendar/gui/dialogs/alarm-list-dialog.h5
-rw-r--r--calendar/gui/dialogs/calendar-setup.c717
-rw-r--r--calendar/gui/dialogs/calendar-setup.h44
-rw-r--r--calendar/gui/dialogs/comp-editor.c36
-rw-r--r--calendar/gui/dialogs/copy-source-dialog.c7
-rw-r--r--calendar/gui/dialogs/copy-source-dialog.h3
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.c11
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.h5
-rw-r--r--calendar/gui/dialogs/e-send-options-utils.c60
-rw-r--r--calendar/gui/dialogs/e-send-options-utils.h2
-rw-r--r--calendar/gui/dialogs/event-editor.c19
-rw-r--r--calendar/gui/dialogs/event-page.c147
-rw-r--r--calendar/gui/dialogs/event-page.ui2
-rw-r--r--calendar/gui/dialogs/memo-page.c148
-rw-r--r--calendar/gui/dialogs/memo-page.ui2
-rw-r--r--calendar/gui/dialogs/select-source-dialog.c52
-rw-r--r--calendar/gui/dialogs/select-source-dialog.h3
-rw-r--r--calendar/gui/dialogs/task-editor.c135
-rw-r--r--calendar/gui/dialogs/task-page.c146
-rw-r--r--calendar/gui/dialogs/task-page.ui4
-rw-r--r--calendar/gui/e-cal-event.c4
-rw-r--r--calendar/gui/e-cal-event.h4
-rw-r--r--calendar/gui/e-cal-model-calendar.c16
-rw-r--r--calendar/gui/e-cal-model-calendar.h2
-rw-r--r--calendar/gui/e-cal-model-memos.c9
-rw-r--r--calendar/gui/e-cal-model-memos.h2
-rw-r--r--calendar/gui/e-cal-model-tasks.c8
-rw-r--r--calendar/gui/e-cal-model-tasks.h2
-rw-r--r--calendar/gui/e-cal-model.c134
-rw-r--r--calendar/gui/e-cal-model.h8
-rw-r--r--calendar/gui/e-cal-source-config.c16
-rw-r--r--calendar/gui/e-calendar-selector.c31
-rw-r--r--calendar/gui/e-calendar-selector.h3
-rw-r--r--calendar/gui/e-calendar-view.c57
-rw-r--r--calendar/gui/e-day-view.c75
-rw-r--r--calendar/gui/e-meeting-list-view.c17
-rw-r--r--calendar/gui/e-meeting-store.c37
-rw-r--r--calendar/gui/e-memo-list-selector.c55
-rw-r--r--calendar/gui/e-memo-list-selector.h3
-rw-r--r--calendar/gui/e-task-list-selector.c52
-rw-r--r--calendar/gui/e-task-list-selector.h3
-rw-r--r--calendar/gui/e-week-view.c16
-rw-r--r--calendar/gui/gnome-cal.c62
-rw-r--r--calendar/gui/gnome-cal.h5
-rw-r--r--calendar/gui/itip-utils.c475
-rw-r--r--calendar/gui/itip-utils.h31
51 files changed, 1241 insertions, 1460 deletions
diff --git a/calendar/alarm-notify/config-data.h b/calendar/alarm-notify/config-data.h
index 421ced56cc..8eb0cf8b3e 100644
--- a/calendar/alarm-notify/config-data.h
+++ b/calendar/alarm-notify/config-data.h
@@ -28,7 +28,6 @@
#include <libical/ical.h>
#include <libecal/e-cal-client.h>
-#include <libedataserver/e-source-list.h>
icaltimezone * config_data_get_timezone (void);
gboolean config_data_get_24_hour_format (void);
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index b7235ede2a..02af20b87b 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 065d11b9b5..c8670d2500 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -53,6 +53,8 @@ typedef struct {
/* The client */
ECalClient *cal_client;
+ ESourceRegistry *registry;
+
/* Toplevel */
GtkWidget *toplevel;
@@ -911,7 +913,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);
@@ -1216,6 +1218,7 @@ init_widgets (Dialog *dialog)
gboolean
alarm_dialog_run (GtkWidget *parent,
+ ESourceRegistry *registry,
ECalClient *cal_client,
ECalComponentAlarm *alarm)
{
@@ -1223,10 +1226,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 42c72d685a..6e6d65827c 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 997f85a664..5c318c0a90 100644
--- a/calendar/gui/dialogs/alarm-list-dialog.c
+++ b/calendar/gui/dialogs/alarm-list-dialog.c
@@ -43,6 +43,7 @@
typedef struct {
GtkBuilder *builder;
+ ESourceRegistry *registry;
/* The client */
ECalClient *cal_client;
@@ -126,7 +127,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 {
@@ -159,7 +160,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);
}
@@ -265,6 +266,7 @@ init_widgets (Dialog *dialog)
gboolean
alarm_list_dialog_run (GtkWidget *parent,
+ ESourceRegistry *registry,
ECalClient *cal_client,
EAlarmList *list_store)
{
@@ -272,6 +274,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;
@@ -312,12 +317,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 5746664c1f..1717d12f22 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/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c
deleted file mode 100644
index 0d0da2244a..0000000000
--- a/calendar/gui/dialogs/calendar-setup.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * David Trowbridge <trowbrds@cs.colorado.edu>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <gtk/gtk.h>
-
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-list.h>
-#include <shell/e-shell.h>
-#include <glib/gi18n.h>
-#include <libecal/e-cal-client.h>
-#include "calendar-setup.h"
-#include "../e-cal-config.h"
-
-typedef struct _CalendarSourceDialog CalendarSourceDialog;
-
-struct _CalendarSourceDialog {
- ECalConfig *config; /* the config manager */
-
- GtkWidget *window;
-
- /* Source selection (creation only) */
- ESourceList *source_list;
- GSList *menu_source_groups;
- GtkWidget *group_optionmenu;
-
- /* ESource we're currently editing */
- ESource *source;
- /* The original source in edit mode. Also used to flag when we are in edit mode. */
- ESource *original_source;
-
- /* Source group we're creating/editing a source in */
- ESourceGroup *source_group;
- ECalClientSourceType source_type;
-};
-
-static gboolean
-eccp_check_complete (EConfig *ec,
- const gchar *pageid,
- gpointer data)
-{
- CalendarSourceDialog *sdialog = data;
- gboolean valid = TRUE;
- const gchar *tmp;
- ESource *source;
-
- tmp = e_source_get_display_name (sdialog->source);
- valid = tmp && tmp[0] && ((source = e_source_group_peek_source_by_name (sdialog->source_group, tmp)) == NULL || source == sdialog->original_source);
-
- return valid;
-}
-
-static void
-eccp_commit (EConfig *ec,
- CalendarSourceDialog *sdialog)
-{
- xmlNodePtr xml;
- GtkWindow *window;
-
- if (sdialog->original_source) {
- const gchar *color_spec;
-
- xml = xmlNewNode (NULL, (const guchar *)"dummy");
- e_source_dump_to_xml_node (sdialog->source, xml);
- e_source_update_from_xml_node (sdialog->original_source, xml->children, NULL);
- xmlFreeNode (xml);
-
- color_spec = e_source_peek_color_spec (sdialog->source);
- if (color_spec != NULL)
- e_source_set_color_spec (sdialog->original_source, color_spec);
- } else {
- e_source_group_add_source (sdialog->source_group, sdialog->source, -1);
- e_source_list_sync (sdialog->source_list, NULL);
- }
-
- window = e_shell_get_active_window (e_shell_get_default ());
- if (window)
- gtk_widget_queue_draw (GTK_WIDGET (window));
-}
-
-static void
-eccp_free (EConfig *ec,
- GSList *items,
- gpointer data)
-{
- CalendarSourceDialog *sdialog = data;
-
- g_slist_free (items);
-
- g_object_unref (sdialog->source);
- if (sdialog->original_source)
- g_object_unref (sdialog->original_source);
- if (sdialog->source_list)
- g_object_unref (sdialog->source_list);
- g_slist_free (sdialog->menu_source_groups);
- g_free (sdialog);
-}
-
-static void
-eccp_type_changed (GtkComboBox *dropdown,
- CalendarSourceDialog *sdialog)
-{
- gint id = gtk_combo_box_get_active (dropdown);
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- model = gtk_combo_box_get_model (dropdown);
- if (id == -1 || !gtk_tree_model_iter_nth_child (model, &iter, NULL, id))
- return;
-
- /* TODO: when we change the group type, we lose all of the pre-filled dialog info */
-
- gtk_tree_model_get (model, &iter, 1, &sdialog->source_group, -1);
- /* HACK: doesn't work if you don't do this */
- e_source_set_absolute_uri (sdialog->source, NULL);
- e_source_set_group (sdialog->source, sdialog->source_group);
-
- e_source_set_relative_uri (sdialog->source, "");
-
- e_config_target_changed ((EConfig *) sdialog->config, E_CONFIG_TARGET_CHANGED_REBUILD);
-}
-
-static GtkWidget *
-eccp_get_source_type (EConfig *ec,
- EConfigItem *item,
- GtkWidget *parent,
- GtkWidget *old,
- gint position,
- gpointer data)
-{
- static GtkWidget *label, *type;
- guint row;
- CalendarSourceDialog *sdialog = data;
- ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target;
- ESource *source = t->source;
- ESourceGroup *group = e_source_peek_group (source);
- gchar *markup;
-
- if (old)
- gtk_widget_destroy (label);
-
- g_object_get (parent, "n-rows", &row, NULL);
-
- if (sdialog->original_source) {
- label = gtk_label_new (_("Type:"));
-
- type = gtk_label_new ("");
- gtk_widget_show (type);
- markup = g_strdup_printf ("<span weight=\"bold\">%s</span>", e_source_group_peek_name (group));
- gtk_label_set_markup (GTK_LABEL (type), markup);
- gtk_misc_set_alignment (GTK_MISC (type), 0.0, 0.5);
- g_free (markup);
- gtk_table_attach (GTK_TABLE (parent), type, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- } else {
- GtkCellRenderer *cell;
- GtkListStore *store;
- GtkTreeIter iter;
- GSList *l;
- gint active = 0, i = 0;
-
- label = gtk_label_new_with_mnemonic(_("_Type:"));
-
- type = gtk_combo_box_new ();
- cell = gtk_cell_renderer_text_new ();
- store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
- for (l = sdialog->menu_source_groups; l; l = g_slist_next (l)) {
- /* Reuse previously defined *group here? */
- ESourceGroup *group = l->data;
- gchar *create_source = e_source_group_get_property (group, "create_source");
-
- if ( !(create_source && !strcmp (create_source, "no"))) {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, e_source_group_peek_name (group), 1, group, -1);
- if (!strcmp (e_source_group_peek_uid (sdialog->source_group), e_source_group_peek_uid (group)))
- active = i;
- i++;
- }
- g_free (create_source);
- }
-
- gtk_cell_layout_pack_start ((GtkCellLayout *) type, cell, TRUE);
- gtk_cell_layout_set_attributes ((GtkCellLayout *) type, cell, "text", 0, NULL);
- gtk_combo_box_set_model ((GtkComboBox *) type, (GtkTreeModel *) store);
- gtk_combo_box_set_active ((GtkComboBox *) type, active);
- g_signal_connect (
- type, "changed",
- G_CALLBACK (eccp_type_changed), sdialog);
- gtk_widget_show (type);
- gtk_table_attach (GTK_TABLE (parent), type, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), type);
- }
-
- gtk_widget_show (label);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
-
- return type;
-}
-
-static void
-name_changed (GtkEntry *entry,
- ECalConfigTargetSource *t)
-{
- ESource *source = t->source;
- ESourceGroup *group;
- gboolean is_birthdays = FALSE;
- gboolean changed;
- const gchar *name;
-
- name = gtk_entry_get_text (GTK_ENTRY (entry));
-
- changed = g_strcmp0 (name, e_source_get_display_name (source)) != 0;
- e_source_set_name (source, name);
-
- group = e_source_peek_group (source);
- is_birthdays = group && g_strcmp0 (e_source_group_peek_base_uri (group), "contacts://") == 0;
-
- if (changed && (g_strcmp0 ("system", e_source_peek_relative_uri (source)) == 0 || is_birthdays))
- e_source_set_property (source, "name-changed", "true");
-}
-
-static GtkWidget *
-eccp_get_source_name (EConfig *ec,
- EConfigItem *item,
- GtkWidget *parent,
- GtkWidget *old,
- gint position,
- gpointer data)
-{
- static GtkWidget *label, *entry;
- guint row;
- ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target;
- ESource *source = t->source;
-
- if (old)
- gtk_widget_destroy (label);
-
- g_object_get (parent, "n-rows", &row, NULL);
-
- label = gtk_label_new_with_mnemonic (_("_Name:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
-
- entry = gtk_entry_new ();
- gtk_widget_show (entry);
- gtk_table_attach (GTK_TABLE (parent), entry, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
- g_signal_connect (
- entry, "changed",
- G_CALLBACK (name_changed), (gpointer) t);
-
- if (source)
- gtk_entry_set_text (GTK_ENTRY (entry), e_source_get_display_name (source));
-
- return entry;
-}
-
-static void
-offline_status_changed_cb (GtkWidget *widget,
- CalendarSourceDialog *sdialog)
-{
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- e_source_set_property (sdialog->source, "offline_sync", "1");
- else
- e_source_set_property (sdialog->source, "offline_sync", "0");
-
-}
-
-static GtkWidget *
-eccp_general_offline (EConfig *ec,
- EConfigItem *item,
- GtkWidget *parent,
- GtkWidget *old,
- gint position,
- gpointer data)
-{
- CalendarSourceDialog *sdialog = data;
- GtkWidget *offline_setting = NULL;
- const gchar *offline_sync;
- guint row;
- const gchar *base_uri = e_source_group_peek_base_uri (sdialog->source_group);
- gboolean is_local = base_uri && (g_str_has_prefix (base_uri, "local:") || g_str_has_prefix (base_uri, "contacts://"));
- offline_sync = e_source_get_property (sdialog->source, "offline_sync");
- if (old)
- return old;
- else {
- g_object_get (parent, "n-rows", &row, NULL);
-
- if (sdialog->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
- offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y calendar contents locally for offline operation"));
- else if (sdialog->source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
- offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y task list contents locally for offline operation"));
- else if (sdialog->source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
- offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y memo list contents locally for offline operation"));
-
- gtk_widget_show (offline_setting);
- g_signal_connect (
- offline_setting, "toggled",
- G_CALLBACK (offline_status_changed_cb), sdialog);
- gtk_table_attach (GTK_TABLE (parent), offline_setting, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- }
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (offline_setting), (offline_sync && g_str_equal (offline_sync, "1")) ? TRUE : FALSE);
- if (is_local)
- gtk_widget_hide (offline_setting);
- return offline_setting;
-}
-
-static void
-alarm_status_changed_cb (GtkWidget *widget,
- CalendarSourceDialog *sdialog)
-{
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- e_source_set_property (sdialog->source, "alarm", "true");
- else
- e_source_set_property (sdialog->source, "alarm", "false");
-}
-
-static GtkWidget *
-eccp_notify_reminders (EConfig *ec,
- EConfigItem *item,
- GtkWidget *parent,
- GtkWidget *old,
- gint position,
- gpointer data)
-{
- CalendarSourceDialog *sdialog = data;
- GtkWidget *reminder_setting = NULL;
- guint row;
- const gchar *alarm;
-
- if (old)
- return old;
-
- alarm = e_source_get_property (sdialog->source, "alarm");
- if (alarm && !g_ascii_strcasecmp (alarm, "never"))
- return NULL;
-
- g_object_get (parent, "n-rows", &row, NULL);
-
- reminder_setting = gtk_check_button_new_with_mnemonic (_("Sh_ow reminder notifications"));
-
- gtk_widget_show (reminder_setting);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reminder_setting), alarm && g_str_equal (alarm, "true"));
- g_signal_connect (
- reminder_setting, "toggled",
- G_CALLBACK (alarm_status_changed_cb), sdialog);
- gtk_table_attach (GTK_TABLE (parent), reminder_setting, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- return reminder_setting;
-}
-
-static void
-color_changed (GtkColorButton *color_button,
- ECalConfigTargetSource *target)
-{
- ESource *source = target->source;
- gchar color_spec[16];
- GdkColor color;
-
- gtk_color_button_get_color (color_button, &color);
- g_snprintf (
- color_spec, sizeof (color_spec), "#%04x%04x%04x",
- color.red, color.green, color.blue);
- e_source_set_color_spec (source, color_spec);
-}
-
-static const gchar *
-choose_initial_color (void)
-{
- static const gchar *colors[] = {
- "#BECEDD", /* 190 206 221 Blue */
- "#E2F0EF", /* 226 240 239 Light Blue */
- "#C6E2B7", /* 198 226 183 Green */
- "#E2F0D3", /* 226 240 211 Light Green */
- "#E2D4B7", /* 226 212 183 Khaki */
- "#EAEAC1", /* 234 234 193 Light Khaki */
- "#F0B8B7", /* 240 184 183 Pink */
- "#FED4D3", /* 254 212 211 Light Pink */
- "#E2C6E1", /* 226 198 225 Purple */
- "#F0E2EF" /* 240 226 239 Light Purple */
- };
-
- return colors[g_random_int_range (0, G_N_ELEMENTS (colors))];
-}
-
-static GtkWidget *
-eccp_get_source_color (EConfig *ec,
- EConfigItem *item,
- GtkWidget *parent,
- GtkWidget *old,
- gint position,
- gpointer data)
-{
- CalendarSourceDialog *sdialog = data;
- static GtkWidget *label, *color_button;
- guint row;
- const gchar *color_spec = NULL;
- GdkColor color;
-
- g_object_get (parent, "n-rows", &row, NULL);
-
- if (old)
- gtk_widget_destroy (label);
-
- if (sdialog->original_source)
- color_spec = e_source_peek_color_spec (sdialog->original_source);
-
- if (color_spec == NULL) {
- color_spec = choose_initial_color ();
- e_source_set_color_spec (sdialog->source, color_spec);
- }
-
- if (!gdk_color_parse (color_spec, &color))
- g_warning ("Unknown color \"%s\" in calendar \"%s\"",
- color_spec, e_source_get_display_name (sdialog->source));
-
- label = gtk_label_new_with_mnemonic (_("Colo_r:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach (
- GTK_TABLE (parent), label,
- 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
- gtk_widget_show (label);
-
- color_button = gtk_color_button_new_with_color (&color);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), color_button);
- gtk_table_attach (
- GTK_TABLE (parent), color_button,
- 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_widget_show (color_button);
-
- g_signal_connect (
- G_OBJECT (color_button), "color-set",
- G_CALLBACK (color_changed), ec->target);
-
- return color_button;
-}
-
-static ECalConfigItem eccp_items[] = {
- { E_CONFIG_BOOK, (gchar *) "", NULL },
- { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) N_("General") },
- { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/00.source", (gchar *) N_("Calendar") },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/00.type", NULL, eccp_get_source_type },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/10.name", NULL, eccp_get_source_name },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/20.color", NULL, eccp_get_source_color },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/30.offline", NULL, eccp_general_offline },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/31.alarm", NULL, eccp_notify_reminders },
- { 0 },
-};
-
-static ECalConfigItem ectp_items[] = {
- { E_CONFIG_BOOK, (gchar *) "", NULL },
- { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) N_("General") },
- { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/00.source", (gchar *) N_("Task List") },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/00.type", NULL, eccp_get_source_type },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/10.name", NULL, eccp_get_source_name },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/20.color", NULL, eccp_get_source_color },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/30.offline", NULL, eccp_general_offline },
- { 0 },
-};
-
-static ECalConfigItem ecmp_items[] = {
- { E_CONFIG_BOOK, (gchar *) "", NULL },
- { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) N_("General") },
- { E_CONFIG_SECTION_TABLE, (gchar *) "00.general/00.source", (gchar *) N_("Memo List") },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/00.type", NULL, eccp_get_source_type },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/10.name", NULL, eccp_get_source_name },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/20.color", NULL, eccp_get_source_color },
- { E_CONFIG_ITEM_TABLE, (gchar *) "00.general/00.source/30.offline", NULL, eccp_general_offline },
- { 0 },
-};
-
-/**
- * cs_load_sources:
- * @sdialog: dialog where to load sources list
- * @conf_key: configuration key where to get sources' list
- * @group: can be NULL
- *
- * Loads list of sources from @conf_key.
- */
-
-static void
-cs_load_sources (CalendarSourceDialog *sdialog,
- const gchar *conf_key,
- ESourceGroup *group)
-{
- GConfClient *gconf;
-
- g_return_if_fail (sdialog != NULL && conf_key != NULL);
-
- sdialog->source = e_source_new ("", "");
- gconf = gconf_client_get_default ();
- sdialog->source_list = e_source_list_new_for_gconf (gconf, conf_key);
- sdialog->menu_source_groups = g_slist_copy (e_source_list_peek_groups (sdialog->source_list));
- sdialog->source_group = (ESourceGroup *) sdialog->menu_source_groups->data;
-
- g_object_unref (gconf);
-
- if (group)
- sdialog->source_group = (ESourceGroup *) group;
-}
-
-/**
- * calendar_setup_edit_calendar:
- * @parent: parent window for dialog (current unused)
- * @source: the ESource corresponding to the calendar
- *
- * Show calendar properties for @source.
- **/
-void
-calendar_setup_edit_calendar (GtkWindow *parent,
- ESource *source,
- ESourceGroup *group)
-{
- CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
- gchar *xml;
- ECalConfig *ec;
- gint i;
- GSList *items = NULL;
- ECalConfigTargetSource *target;
-
- if (source) {
- const gchar *color_spec;
-
- sdialog->original_source = source;
- g_object_ref (source);
- sdialog->source_group = e_source_peek_group (source);
- xml = e_source_to_standalone_xml (source);
- sdialog->source = e_source_new_from_standalone_xml (xml);
- g_free (xml);
-
- color_spec = e_source_peek_color_spec (source);
- if (color_spec != NULL)
- e_source_set_color_spec (sdialog->source, color_spec);
- } else {
- cs_load_sources (sdialog, "/apps/evolution/calendar/sources", group);
- }
-
- /* HACK: doesn't work if you don't do this */
- e_source_set_absolute_uri (sdialog->source, NULL);
- e_source_set_group (sdialog->source, sdialog->source_group);
-
- sdialog->source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
- sdialog->config = ec = e_cal_config_new (E_CONFIG_BOOK, "org.gnome.evolution.calendar.calendarProperties");
- for (i = 0; eccp_items[i].path; i++)
- items = g_slist_prepend (items, &eccp_items[i]);
- e_config_add_items ((EConfig *) ec, items, eccp_free, sdialog);
- e_config_add_page_check ((EConfig *) ec, NULL, eccp_check_complete, sdialog);
- g_signal_connect_after (
- ec, "commit",
- G_CALLBACK (eccp_commit), sdialog);
-
- target = e_cal_config_target_new_source (ec, sdialog->source);
- target->source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
- e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
-
- sdialog->window = e_config_create_window ((EConfig *)ec, NULL, source ? _("Calendar Properties") : _("New Calendar"));
-
- /* forces initial validation */
- if (!sdialog->original_source)
- e_config_target_changed ((EConfig *) ec, E_CONFIG_TARGET_CHANGED_STATE);
-
- return;
-}
-
-void
-calendar_setup_new_calendar (GtkWindow *parent)
-{
- calendar_setup_edit_calendar (parent, NULL, NULL);
-}
-
-void
-calendar_setup_edit_task_list (GtkWindow *parent,
- ESource *source)
-{
- CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
- gchar *xml;
- ECalConfig *ec;
- gint i;
- GSList *items = NULL;
- ECalConfigTargetSource *target;
-
- if (source) {
- const gchar *color_spec;
-
- sdialog->original_source = source;
- g_object_ref (source);
- sdialog->source_group = e_source_peek_group (source);
- xml = e_source_to_standalone_xml (source);
- sdialog->source = e_source_new_from_standalone_xml (xml);
- g_free (xml);
-
- color_spec = e_source_peek_color_spec (source);
- e_source_set_color_spec (sdialog->source, color_spec);
- } else {
- cs_load_sources (sdialog, "/apps/evolution/tasks/sources", NULL);
- }
-
- /* HACK: doesn't work if you don't do this */
- e_source_set_absolute_uri (sdialog->source, NULL);
- e_source_set_group (sdialog->source, sdialog->source_group);
-
- sdialog->source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
- sdialog->config = ec = e_cal_config_new (E_CONFIG_BOOK, "org.gnome.evolution.calendar.calendarProperties");
- for (i = 0; ectp_items[i].path; i++)
- items = g_slist_prepend (items, &ectp_items[i]);
- e_config_add_items ((EConfig *) ec, items, eccp_free, sdialog);
- e_config_add_page_check ((EConfig *) ec, NULL, eccp_check_complete, sdialog);
- g_signal_connect_after (
- ec, "commit",
- G_CALLBACK (eccp_commit), sdialog);
-
- target = e_cal_config_target_new_source (ec, sdialog->source);
- target->source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
- e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
-
- sdialog->window = e_config_create_window ((EConfig *)ec, NULL, source ? _("Task List Properties") : _("New Task List"));
-
- /* forces initial validation */
- if (!sdialog->original_source)
- e_config_target_changed ((EConfig *) ec, E_CONFIG_TARGET_CHANGED_STATE);
-
- return;
-}
-
-void
-calendar_setup_new_task_list (GtkWindow *parent)
-{
- calendar_setup_edit_task_list (parent, NULL);
-}
-
-void
-calendar_setup_edit_memo_list (GtkWindow *parent,
- ESource *source)
-{
- CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
- gchar *xml;
- ECalConfig *ec;
- gint i;
- GSList *items = NULL;
- ECalConfigTargetSource *target;
-
- if (source) {
- const gchar *color_spec;
-
- sdialog->original_source = source;
- g_object_ref (source);
- sdialog->source_group = e_source_peek_group (source);
- xml = e_source_to_standalone_xml (source);
- sdialog->source = e_source_new_from_standalone_xml (xml);
- g_free (xml);
-
- color_spec = e_source_peek_color_spec (source);
- e_source_set_color_spec (sdialog->source, color_spec);
- } else {
- cs_load_sources (sdialog, "/apps/evolution/memos/sources", NULL);
- }
-
- /* HACK: doesn't work if you don't do this */
- e_source_set_absolute_uri (sdialog->source, NULL);
- e_source_set_group (sdialog->source, sdialog->source_group);
-
- sdialog->source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
- sdialog->config = ec = e_cal_config_new (E_CONFIG_BOOK, "org.gnome.evolution.calendar.calendarProperties");
- for (i = 0; ecmp_items[i].path; i++)
- items = g_slist_prepend (items, &ecmp_items[i]);
- e_config_add_items ((EConfig *) ec, items, eccp_free, sdialog);
- e_config_add_page_check ((EConfig *) ec, NULL, eccp_check_complete, sdialog);
- g_signal_connect_after (
- ec, "commit",
- G_CALLBACK (eccp_commit), sdialog);
-
- target = e_cal_config_target_new_source (ec, sdialog->source);
- target->source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
- e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
-
- sdialog->window = e_config_create_window ((EConfig *)ec, NULL, source ? _("Memo List Properties") : _("New Memo List"));
-
- /* forces initial validation */
- if (!sdialog->original_source)
- e_config_target_changed ((EConfig *) ec, E_CONFIG_TARGET_CHANGED_STATE);
-
- return;
-}
-
-void
-calendar_setup_new_memo_list (GtkWindow *parent)
-{
- calendar_setup_edit_memo_list (parent, NULL);
-}
diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h
deleted file mode 100644
index 18dc042848..0000000000
--- a/calendar/gui/dialogs/calendar-setup.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * David Trowbridge <trowbrds@cs.colorado.edu>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __CALENDAR_SETUP_H__
-#define __CALENDAR_SETUP_H__
-
-#include <gtk/gtk.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
-
-G_BEGIN_DECLS
-
-void calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *group);
-void calendar_setup_new_calendar (GtkWindow *parent);
-
-void calendar_setup_edit_task_list (GtkWindow *parent, ESource *source);
-void calendar_setup_new_task_list (GtkWindow *parent);
-
-void calendar_setup_edit_memo_list (GtkWindow *parent, ESource *source);
-void calendar_setup_new_memo_list (GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* __CALENDAR_SETUP_H__ */
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 55a602c8dc..5e447e76c4 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -481,6 +481,8 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CompEditorFlags flags;
ECalComponent *clone;
+ ESourceRegistry *registry;
+ EShell *shell;
GList *l;
gboolean result;
GError *error = NULL;
@@ -495,6 +497,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) {
@@ -528,8 +533,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);
@@ -583,8 +588,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);
@@ -681,6 +686,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;
@@ -688,6 +695,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;
@@ -717,8 +728,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,
@@ -1359,6 +1370,7 @@ static void
comp_editor_set_shell (CompEditor *editor,
EShell *shell)
{
+ g_return_if_fail (E_IS_SHELL (shell));
g_return_if_fail (editor->priv->shell == NULL);
editor->priv->shell = shell;
@@ -3257,6 +3269,8 @@ real_send_comp (CompEditor *editor,
{
CompEditorPrivate *priv;
CompEditorFlags flags;
+ EShell *shell;
+ ESourceRegistry *registry;
ECalComponent *send_comp = NULL;
gchar *address = NULL;
GSList *users = NULL;
@@ -3266,6 +3280,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 */
@@ -3294,7 +3311,8 @@ real_send_comp (CompEditor *editor,
/* The user updates the delegated status to the Organizer,
* so remove all other attendees. */
if (flags & COMP_EDITOR_DELEGATE) {
- address = itip_get_comp_attendee (send_comp, priv->cal_client);
+ address = itip_get_comp_attendee (
+ registry, send_comp, priv->cal_client);
if (address)
set_attendees_for_delegation (send_comp, address, method);
@@ -3304,7 +3322,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);
@@ -3334,7 +3352,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 cfc8521927..21b86087fb 100644
--- a/calendar/gui/dialogs/copy-source-dialog.c
+++ b/calendar/gui/dialogs/copy-source-dialog.c
@@ -198,7 +198,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);
}
@@ -220,7 +219,6 @@ copy_source (const CopySourceDialogData *const_csdd)
e_client_utils_open_new (
csdd->orig_source, csdd->obj_type, FALSE, NULL,
- e_client_utils_authenticate_handler, csdd->parent,
orig_source_opened_cb, csdd);
}
@@ -232,11 +230,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 ||
@@ -250,7 +250,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 5ac51406de..01124d4a76 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 9b9d7b4bbd..ca253ca430 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.c
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -101,6 +101,7 @@ e_delegate_dialog_init (EDelegateDialog *edd)
EDelegateDialog *
e_delegate_dialog_construct (EDelegateDialog *edd,
+ ESourceRegistry *registry,
const gchar *name,
const gchar *address)
{
@@ -111,6 +112,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;
@@ -124,7 +126,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);
@@ -211,15 +213,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 5fb672bd5e..85a0613532 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 e42bbc73d4..d438f16473 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_get_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 c1a63a291a..3ec75426e4 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 7d679e6bbf..1460ff47db 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -609,6 +609,8 @@ event_editor_edit_comp (CompEditor *editor,
ECalComponentDateTime dtstart, dtend;
ECalClient *client;
GSList *attendees = NULL;
+ ESourceRegistry *registry;
+ EShell *shell;
priv = EVENT_EDITOR_GET_PRIVATE (editor);
@@ -628,8 +630,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);
@@ -639,7 +644,9 @@ event_editor_edit_comp (CompEditor *editor,
GSList *l;
gint row;
gchar *user_email;
- user_email = itip_get_comp_attendee (comp, client);
+
+ user_email = itip_get_comp_attendee (
+ registry, comp, client);
if (!priv->meeting_shown) {
GtkAction *action;
@@ -707,7 +714,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;
}
@@ -718,6 +726,8 @@ event_editor_send_comp (CompEditor *editor,
gboolean strip_alarms)
{
EventEditorPrivate *priv;
+ EShell *shell;
+ ESourceRegistry *registry;
ECalComponent *comp = NULL;
priv = EVENT_EDITOR_GET_PRIVATE (editor);
@@ -727,6 +737,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;
@@ -734,7 +747,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 2797bcd9ec..44e36c6e58 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -36,6 +36,8 @@
#include <gdk/gdkkeysyms.h>
#include <libecal/e-cal-time-util.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,8 +48,6 @@
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-util-private.h>
-#include <libemail-utils/e-account-utils.h>
-
#include <misc/e-dateedit.h>
#include <misc/e-send-options.h>
#include <misc/e-spell-entry.h>
@@ -112,7 +112,6 @@ struct _EventPagePrivate {
GtkWidget *info_hbox;
GtkWidget *info_icon;
GtkWidget *info_string;
- gchar *subscriber_info_text;
GtkWidget *summary;
GtkWidget *summary_label;
@@ -160,7 +159,7 @@ struct _EventPagePrivate {
GtkWidget *categories_btn;
GtkWidget *categories;
- GtkWidget *source_selector;
+ GtkWidget *source_combo_box;
/* Meeting related items */
GtkWidget *list_box;
@@ -224,9 +223,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;
@@ -236,28 +238,29 @@ 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;
- 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);
-<<<<<<< HEAD
-
- id_name = account->id->name;
- id_address = account->id->address;
+ extension = e_source_get_extension (source, extension_name);
-=======
+ 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;
+ if (id_name == NULL || id_address == NULL)
+ continue;
->>>>>>> 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);
@@ -267,11 +270,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_full (list, (GDestroyNotify) g_object_unref);
return match;
}
@@ -656,7 +657,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;
@@ -698,7 +699,7 @@ sensitize_widgets (EventPage *epage)
gtk_editable_set_editable (GTK_EDITABLE (priv->categories), !read_only);
if (delegate) {
- gtk_widget_set_sensitive (priv->source_selector, FALSE);
+ gtk_widget_set_sensitive (priv->source_combo_box, FALSE);
}
gtk_widget_set_sensitive (priv->organizer, !read_only);
@@ -724,7 +725,7 @@ sensitize_widgets (EventPage *epage)
gtk_widget_hide (priv->attendee_box);
gtk_widget_hide (priv->organizer);
gtk_label_set_text_with_mnemonic ((GtkLabel *) priv->org_cal_label, _("_Calendar:"));
- gtk_label_set_mnemonic_widget ((GtkLabel *) priv->org_cal_label, priv->source_selector);
+ gtk_label_set_mnemonic_widget ((GtkLabel *) priv->org_cal_label, priv->source_combo_box);
} else {
gtk_widget_show (priv->calendar_label);
gtk_widget_show (priv->list_box);
@@ -1106,6 +1107,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;
@@ -1118,6 +1121,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;
@@ -1178,7 +1184,8 @@ event_page_fill_widgets (CompEditorPage *page,
gchar *name = NULL;
gchar *mailto = NULL;
- priv->user_add = itip_get_comp_attendee (comp, client);
+ priv->user_add = itip_get_comp_attendee (
+ registry, comp, client);
/* Organizer strings */
event_page_select_organizer (epage, backend_addr);
@@ -1190,7 +1197,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))
@@ -1363,7 +1371,7 @@ event_page_fill_widgets (CompEditorPage *page,
/* Source */
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
+ E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (client)));
e_cal_component_get_uid (comp, &uid);
@@ -2510,6 +2518,7 @@ static gboolean
get_widgets (EventPage *epage)
{
EShell *shell;
+ ESourceRegistry *registry;
CompEditor *editor;
CompEditorPage *page = COMP_EDITOR_PAGE (epage);
GtkEntryCompletion *completion;
@@ -2526,6 +2535,7 @@ get_widgets (EventPage *epage)
editor = comp_editor_page_get_editor (page);
shell = comp_editor_get_shell (editor);
+ registry = e_shell_get_registry (shell);
priv->main = GW ("event-page");
if (!priv->main)
@@ -2618,9 +2628,9 @@ get_widgets (EventPage *epage)
priv->description = GW ("description");
- priv->source_selector = GW ("source");
-
- e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/calendar/sources");
+ priv->source_combo_box = GW ("source");
+ e_source_combo_box_set_registry (
+ E_SOURCE_COMBO_BOX (priv->source_combo_box), registry);
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
@@ -2934,7 +2944,7 @@ event_page_send_options_clicked_cb (EventPage *epage)
if (!priv->sod) {
priv->sod = e_send_options_dialog_new ();
source = e_source_combo_box_ref_active (
- E_SOURCE_COMBO_BOX (priv->source_selector));
+ E_SOURCE_COMBO_BOX (priv->source_combo_box));
e_send_options_utils_set_default_data (
priv->sod, source, "calendar");
priv->sod->data->initialized = TRUE;
@@ -2979,7 +2989,7 @@ epage_client_opened_cb (GObject *source_object,
old_client = comp_editor_get_client (editor);
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
+ E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (old_client)));
dialog = gtk_message_dialog_new (
@@ -3045,7 +3055,6 @@ source_changed_cb (ESourceComboBox *source_combo_box,
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);
g_object_unref (source);
@@ -3055,26 +3064,8 @@ 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
@@ -3219,7 +3210,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;
@@ -3231,8 +3224,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 (
@@ -3276,7 +3273,7 @@ init_widgets (EventPage *epage)
/* Source selector */
g_signal_connect (
- priv->source_selector, "changed",
+ priv->source_combo_box, "changed",
G_CALLBACK (source_changed_cb), epage);
/* Alarms */
@@ -3357,7 +3354,7 @@ init_widgets (EventPage *epage)
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);
+ 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);
@@ -3481,7 +3478,7 @@ init_widgets (EventPage *epage)
priv->categories, "changed",
G_CALLBACK (comp_editor_page_changed), epage);
g_signal_connect_swapped (
- priv->source_selector, "changed",
+ priv->source_combo_box, "changed",
G_CALLBACK (comp_editor_page_changed), epage);
g_signal_connect_swapped (
priv->start_timezone, "changed",
@@ -3504,32 +3501,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;
}
@@ -3542,7 +3525,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
@@ -3563,12 +3545,18 @@ event_page_construct (EventPage *epage,
EMeetingStore *meeting_store)
{
EventPagePrivate *priv;
+ EShell *shell;
+ CompEditor *editor;
+ ESourceRegistry *registry;
GtkComboBox *combo_box;
GtkListStore *list_store;
GtkTreeModel *model;
GtkTreeIter iter;
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);
@@ -3602,8 +3590,9 @@ event_page_construct (EventPage *epage,
model = gtk_combo_box_get_model (combo_box);
list_store = GTK_LIST_STORE (model);
- 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);
/* FIXME Could we just use a GtkComboBoxText? */
for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index c2e291f558..ee9c3e51b9 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -779,6 +779,8 @@
</child>
<child>
<object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
+ <property name="extension-name">Calendar</property>
+ <property name="show-colors">True</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 715681445c..4e054d2a5b 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -34,6 +34,8 @@
#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>
@@ -50,8 +52,6 @@
#include <misc/e-spell-entry.h>
#include <misc/e-buffer-tagger.h>
-#include <libemail-utils/e-account-utils.h>
-
#include "../calendar-config.h"
#include "comp-editor.h"
#include "comp-editor-util.h"
@@ -75,7 +75,6 @@ struct _MemoPagePrivate {
GtkWidget *info_hbox;
GtkWidget *info_icon;
GtkWidget *info_string;
- gchar *subscriber_info_text;
/* Organizer */
GtkWidget *org_label;
@@ -97,7 +96,7 @@ struct _MemoPagePrivate {
GtkWidget *categories_btn;
GtkWidget *categories;
- GtkWidget *source_selector;
+ GtkWidget *source_combo_box;
gchar **address_strings;
gchar *fallback_address;
@@ -120,32 +119,43 @@ 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 = 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;
+ if (id_name == NULL || id_address == NULL)
+ continue;
identity = g_strdup_printf ("%s <%s>", id_name, id_address);
match = (g_ascii_strcasecmp (text, identity) == 0);
@@ -156,11 +166,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_full (list, (GDestroyNotify) g_object_unref);
return match;
}
@@ -236,8 +244,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);
}
@@ -270,6 +276,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;
@@ -280,6 +288,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);
@@ -343,7 +354,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 {
GtkComboBox *combo_box;
@@ -370,7 +382,7 @@ memo_page_fill_widgets (CompEditorPage *page,
/* Source */
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
+ E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (client)));
if (priv->to_entry && (flags & COMP_EDITOR_IS_SHARED) && !(flags & COMP_EDITOR_NEW_ITEM))
@@ -421,12 +433,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;
@@ -466,7 +477,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
@@ -553,7 +564,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);
@@ -562,7 +573,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;
}
@@ -834,6 +849,9 @@ memo_page_set_info_string (MemoPage *mpage,
static gboolean
get_widgets (MemoPage *mpage)
{
+ EShell *shell;
+ ESourceRegistry *registry;
+ CompEditor *editor;
CompEditorPage *page = COMP_EDITOR_PAGE (mpage);
GtkEntryCompletion *completion;
MemoPagePrivate *priv;
@@ -845,6 +863,10 @@ get_widgets (MemoPage *mpage)
#define GW(name) e_builder_get_widget (priv->builder, name)
+ editor = comp_editor_page_get_editor (page);
+ shell = comp_editor_get_shell (editor);
+ registry = e_shell_get_registry (shell);
+
priv->main = GW ("memo-page");
if (!priv->main) {
g_warning("couldn't find memo-page!");
@@ -885,11 +907,11 @@ get_widgets (MemoPage *mpage)
priv->categories_btn = GW ("categories-button");
priv->categories = GW ("categories");
- priv->source_selector = GW ("source");
+ priv->source_combo_box = GW ("source");
+ e_source_combo_box_set_registry (
+ E_SOURCE_COMBO_BOX (priv->source_combo_box), registry);
#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);
@@ -958,7 +980,7 @@ mpage_client_opened_cb (GObject *source_object,
old_client = comp_editor_get_client (editor);
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
+ E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (old_client)));
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
@@ -1021,7 +1043,6 @@ source_changed_cb (ESourceComboBox *source_combo_box,
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);
g_object_unref (source);
@@ -1031,26 +1052,8 @@ 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
@@ -1117,7 +1120,7 @@ init_widgets (MemoPage *mpage)
/* Source selector */
g_signal_connect (
- priv->source_selector, "changed",
+ priv->source_combo_box, "changed",
G_CALLBACK (source_changed_cb), mpage);
/* Connect the default signal handler to use to make sure the "changed"
@@ -1137,7 +1140,7 @@ init_widgets (MemoPage *mpage)
G_CALLBACK (comp_editor_page_changed), mpage);
g_signal_connect_swapped (
- priv->source_selector, "changed",
+ priv->source_combo_box, "changed",
G_CALLBACK (comp_editor_page_changed), mpage);
g_signal_connect_swapped (
@@ -1184,36 +1187,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;
}
@@ -1223,7 +1214,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!");
@@ -1242,13 +1232,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);
/* Make sure our custom widget classes are registered with
* GType before we load the GtkBuilder definition file. */
@@ -1275,8 +1271,8 @@ memo_page_construct (MemoPage *mpage)
model = gtk_combo_box_get_model (combo_box);
list_store = GTK_LIST_STORE (model);
- 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);
/* FIXME Could we just use a GtkComboBoxText? */
for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
@@ -1291,7 +1287,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 d30aecf0d5..fe63f1e009 100644
--- a/calendar/gui/dialogs/memo-page.ui
+++ b/calendar/gui/dialogs/memo-page.ui
@@ -184,6 +184,8 @@
<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="show-colors">True</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 740428ae49..8ea35e2c00 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 <libedataserver/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)
+ } 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,16 +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 (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
- if (selected_source)
- g_object_ref (selected_source);
- } 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 2ef8e0e625..77864e8c97 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 378aea593a..0c81d3ea47 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -138,74 +138,6 @@ task_editor_model_changed_cb (TaskEditor *te)
}
}
-static GObject *
-task_editor_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GObject *object;
- CompEditor *editor;
- CompEditorFlags flags;
- TaskEditorPrivate *priv;
- GtkWidget *content_area;
- GtkActionGroup *action_group;
- ECalClient *client;
- gboolean is_assigned;
-
- /* Chain up to parent's constructor() method. */
- object = G_OBJECT_CLASS (task_editor_parent_class)->constructor (
- type, n_construct_properties, construct_properties);
-
- editor = COMP_EDITOR (object);
- priv = TASK_EDITOR_GET_PRIVATE (object);
-
- client = comp_editor_get_client (editor);
- flags = comp_editor_get_flags (editor);
-
- priv->task_page = task_page_new (priv->model, editor);
- comp_editor_append_page (
- editor, COMP_EDITOR_PAGE (priv->task_page),
- _("Task"), TRUE);
-
- priv->task_details_window = gtk_dialog_new_with_buttons (
- _("Task Details"), GTK_WINDOW (object), GTK_DIALOG_MODAL,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
- g_signal_connect (
- priv->task_details_window, "response",
- G_CALLBACK (gtk_widget_hide), NULL);
- g_signal_connect (
- priv->task_details_window, "delete-event",
- G_CALLBACK (gtk_widget_hide), NULL);
-
- priv->task_details_page = task_details_page_new (editor);
- content_area = gtk_dialog_get_content_area (
- GTK_DIALOG (priv->task_details_window));
- gtk_container_add (
- GTK_CONTAINER (content_area),
- comp_editor_page_get_widget (
- (CompEditorPage *) priv->task_details_page));
- gtk_widget_show_all (
- gtk_bin_get_child (GTK_BIN (priv->task_details_window)));
- comp_editor_append_page (
- editor, COMP_EDITOR_PAGE (priv->task_details_page), NULL, FALSE);
-
- is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
-
- action_group = comp_editor_get_action_group (editor, "coordinated");
- task_page_set_assignment (priv->task_page, is_assigned);
- gtk_action_group_set_visible (action_group, is_assigned);
-
- if (is_assigned) {
- if (e_client_check_capability (
- E_CLIENT (client),
- CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
- task_page_show_options (priv->task_page);
- comp_editor_set_group_item (editor, TRUE);
- }
-
- return object;
-}
-
static void
task_editor_dispose (GObject *object)
{
@@ -236,8 +168,37 @@ static void
task_editor_constructed (GObject *object)
{
TaskEditorPrivate *priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ GtkActionGroup *action_group;
+ gboolean is_assigned;
priv = TASK_EDITOR_GET_PRIVATE (object);
+ editor = COMP_EDITOR (object);
+
+ flags = comp_editor_get_flags (editor);
+ is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
+
+ priv->task_page = task_page_new (priv->model, editor);
+ task_page_set_assignment (priv->task_page, is_assigned);
+ comp_editor_append_page (
+ editor, COMP_EDITOR_PAGE (priv->task_page),
+ _("Task"), TRUE);
+
+ action_group = comp_editor_get_action_group (editor, "coordinated");
+ gtk_action_group_set_visible (action_group, is_assigned);
+
+ if (is_assigned) {
+ ECalClient *client;
+
+ client = comp_editor_get_client (editor);
+
+ if (e_client_check_capability (
+ E_CLIENT (client),
+ CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
+ task_page_show_options (priv->task_page);
+ comp_editor_set_group_item (editor, TRUE);
+ }
g_object_bind_property (
object, "client",
@@ -311,7 +272,6 @@ task_editor_class_init (TaskEditorClass *class)
g_type_class_add_private (class, sizeof (TaskEditorPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->constructor = task_editor_constructor;
object_class->dispose = task_editor_dispose;
object_class->constructed = task_editor_constructed;
@@ -333,6 +293,7 @@ task_editor_init (TaskEditor *te)
CompEditor *editor = COMP_EDITOR (te);
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
+ GtkWidget *content_area;
GtkAction *action;
const gchar *id;
GError *error = NULL;
@@ -342,6 +303,28 @@ task_editor_init (TaskEditor *te)
te->priv->assignment_shown = TRUE;
te->priv->updating = FALSE;
+ te->priv->task_details_window = gtk_dialog_new_with_buttons (
+ _("Task Details"), GTK_WINDOW (te), GTK_DIALOG_MODAL,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ g_signal_connect (
+ te->priv->task_details_window, "response",
+ G_CALLBACK (gtk_widget_hide), NULL);
+ g_signal_connect (
+ te->priv->task_details_window, "delete-event",
+ G_CALLBACK (gtk_widget_hide), NULL);
+
+ te->priv->task_details_page = task_details_page_new (editor);
+ content_area = gtk_dialog_get_content_area (
+ GTK_DIALOG (te->priv->task_details_window));
+ gtk_container_add (
+ GTK_CONTAINER (content_area),
+ comp_editor_page_get_widget (
+ (CompEditorPage *) te->priv->task_details_page));
+ gtk_widget_show_all (
+ gtk_bin_get_child (GTK_BIN (te->priv->task_details_window)));
+ comp_editor_append_page (
+ editor, COMP_EDITOR_PAGE (te->priv->task_details_page), NULL, FALSE);
+
action_group = comp_editor_get_action_group (editor, "individual");
gtk_action_group_add_actions (
action_group, task_entries,
@@ -386,6 +369,8 @@ task_editor_edit_comp (CompEditor *editor,
ECalComponentOrganizer organizer;
ECalClient *client;
GSList *attendees = NULL;
+ ESourceRegistry *registry;
+ EShell *shell;
priv = TASK_EDITOR_GET_PRIVATE (editor);
@@ -394,8 +379,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);
@@ -450,7 +438,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;
}
@@ -461,6 +449,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);
@@ -470,6 +460,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;
@@ -477,7 +470,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 8b2bd1f98c..665e03eb30 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -34,6 +34,8 @@
#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>
@@ -47,8 +49,6 @@
#include <e-util/e-util-private.h>
#include <e-util/e-util.h>
-#include <libemail-utils/e-account-utils.h>
-
#include "../e-meeting-attendee.h"
#include "../e-meeting-list-view.h"
#include "../e-meeting-store.h"
@@ -87,7 +87,6 @@ struct _TaskPagePrivate {
GtkWidget *info_hbox;
GtkWidget *info_icon;
GtkWidget *info_string;
- gchar *subscriber_info_text;
GtkWidget *summary;
GtkWidget *summary_label;
@@ -102,7 +101,7 @@ struct _TaskPagePrivate {
GtkWidget *categories_btn;
GtkWidget *categories;
- GtkWidget *source_selector;
+ GtkWidget *source_combo_box;
/* Meeting related items */
GtkWidget *list_box;
@@ -150,32 +149,43 @@ 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;
- 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 = 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;
+ if (id_name == NULL || id_address == NULL)
+ continue;
identity = g_strdup_printf ("%s <%s>", id_name, id_address);
match = (g_ascii_strcasecmp (text, identity) == 0);
@@ -186,11 +196,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_full (list, (GDestroyNotify) g_object_unref);
return match;
}
@@ -253,12 +261,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;
@@ -301,7 +308,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
@@ -341,7 +348,7 @@ sensitize_widgets (TaskPage *tpage)
gtk_widget_hide (priv->organizer);
gtk_widget_hide (priv->invite);
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->org_cal_label), _("_List:"));
- gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->source_selector);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->source_combo_box);
} else {
gtk_widget_show (priv->invite);
gtk_widget_show (priv->calendar_label);
@@ -487,10 +494,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;
@@ -504,6 +513,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)
@@ -521,7 +533,8 @@ task_page_fill_widgets (CompEditorPage *page,
/* Clean the screen */
clear_widgets (tpage);
- priv->user_add = itip_get_comp_attendee (comp, client);
+ priv->user_add = itip_get_comp_attendee (
+ registry, comp, client);
/* Summary, description(s) */
e_cal_component_get_summary (comp, &text);
@@ -628,7 +641,7 @@ task_page_fill_widgets (CompEditorPage *page,
/* Source */
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
+ E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (client)));
e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &backend_addr, NULL, NULL);
@@ -639,7 +652,8 @@ task_page_fill_widgets (CompEditorPage *page,
gchar *name = NULL;
gchar *mailto = NULL;
- priv->user_add = itip_get_comp_attendee (comp, client);
+ priv->user_add = itip_get_comp_attendee (
+ registry, comp, client);
/* Organizer strings */
task_page_select_organizer (tpage, backend_addr);
@@ -651,7 +665,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 {
@@ -1436,6 +1451,9 @@ task_page_set_info_string (TaskPage *tpage,
static gboolean
get_widgets (TaskPage *tpage)
{
+ EShell *shell;
+ ESourceRegistry *registry;
+ CompEditor *editor;
CompEditorPage *page = COMP_EDITOR_PAGE (tpage);
GtkEntryCompletion *completion;
TaskPagePrivate *priv;
@@ -1447,6 +1465,10 @@ get_widgets (TaskPage *tpage)
priv = tpage->priv;
+ editor = comp_editor_page_get_editor (page);
+ shell = comp_editor_get_shell (editor);
+ registry = e_shell_get_registry (shell);
+
priv->main = e_builder_get_widget (priv->builder, "task-page");
if (!priv->main)
return FALSE;
@@ -1508,10 +1530,11 @@ get_widgets (TaskPage *tpage)
gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (priv->list_view));
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");
+ priv->source_combo_box = e_builder_get_widget (priv->builder, "source");
+ e_source_combo_box_set_registry (
+ E_SOURCE_COMBO_BOX (priv->source_combo_box), registry);
- gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->source_selector);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->source_combo_box);
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
@@ -1785,7 +1808,7 @@ tpage_client_opened_cb (GObject *source_object,
old_client = comp_editor_get_client (editor);
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
+ E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (old_client)));
dialog = gtk_message_dialog_new (
@@ -1852,7 +1875,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);
g_object_unref (source);
@@ -1862,26 +1884,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
@@ -1900,7 +1904,7 @@ task_page_send_options_clicked_cb (TaskPage *tpage)
priv->sod = e_send_options_dialog_new ();
priv->sod->data->initialized = TRUE;
source = e_source_combo_box_ref_active (
- E_SOURCE_COMBO_BOX (priv->source_selector));
+ E_SOURCE_COMBO_BOX (priv->source_combo_box));
e_send_options_utils_set_default_data (
priv->sod, source, "task");
g_object_unref (source);
@@ -1977,7 +1981,7 @@ init_widgets (TaskPage *tpage)
/* Source selector */
g_signal_connect (
- priv->source_selector, "changed",
+ priv->source_combo_box, "changed",
G_CALLBACK (source_changed_cb), tpage);
/* Connect the default signal handler to use to make sure the "changed"
@@ -2084,45 +2088,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
@@ -2143,6 +2132,9 @@ task_page_construct (TaskPage *tpage,
EMeetingStore *meeting_store,
ECalClient *client)
{
+ EShell *shell;
+ CompEditor *editor;
+ ESourceRegistry *registry;
TaskPagePrivate *priv;
GtkComboBox *combo_box;
GtkListStore *list_store;
@@ -2150,6 +2142,9 @@ task_page_construct (TaskPage *tpage,
GtkTreeIter iter;
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;
@@ -2174,8 +2169,9 @@ task_page_construct (TaskPage *tpage,
model = gtk_combo_box_get_model (combo_box);
list_store = GTK_LIST_STORE (model);
- 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);
/* FIXME Could we just use a GtkComboBoxText? */
for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
diff --git a/calendar/gui/dialogs/task-page.ui b/calendar/gui/dialogs/task-page.ui
index f3f85f5177..0603f44de4 100644
--- a/calendar/gui/dialogs/task-page.ui
+++ b/calendar/gui/dialogs/task-page.ui
@@ -438,7 +438,9 @@
</packing>
</child>
<child>
- <object class="ESourceComboBox" id="source">
+ <object class="ESourceComboBox" type-func="e_source_combo_box_get_type" id="source">
+ <property name="extension-name">Task List</property>
+ <property name="show-colors">True</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/calendar/gui/e-cal-event.c b/calendar/gui/e-cal-event.c
index 9683ddefe1..d94a071c5b 100644
--- a/calendar/gui/e-cal-event.c
+++ b/calendar/gui/e-cal-event.c
@@ -37,8 +37,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; }
}
@@ -75,7 +73,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;
@@ -84,7 +81,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 d67342e190..447f1fd418 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 0c59a1212e..dc72e1c67b 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -274,12 +274,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;
@@ -318,7 +321,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;
@@ -339,7 +342,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);
@@ -522,7 +525,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 f29d7d413d..9dd9aeedce 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 e95cd15ed4..7ce31d2956 100644
--- a/calendar/gui/e-cal-model-memos.c
+++ b/calendar/gui/e-cal-model-memos.c
@@ -250,7 +250,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 2be1e4d97c..4490d0b0c7 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 feacc6d422..ca87150a7e 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -1224,9 +1224,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);
}
gboolean
diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h
index 54d31cbaaa..04c3f68a49 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);
gboolean e_cal_model_tasks_get_highlight_due_today
(ECalModelTasks *model);
void e_cal_model_tasks_set_highlight_due_today
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index d1ab22c989..9536a40064 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -32,14 +32,13 @@
#include <libebackend/e-extensible.h>
#include <libedataserver/e-flag.h>
#include <libedataserver/e-time-utils.h>
+#include <libedataserver/e-source-calendar.h>
#include <libecal/e-cal-client-view.h>
#include <libecal/e-cal-time-util.h>
#include <e-util/e-util.h>
#include <e-util/e-util-enumtypes.h>
-#include <libemail-utils/e-account-utils.h>
-
#include "comp-util.h"
#include "e-cal-model.h"
#include "itip-utils.h"
@@ -66,6 +65,8 @@ typedef struct {
} ECalModelClient;
struct _ECalModelPrivate {
+ ESourceRegistry *registry;
+
/* The list of clients we are managing. Each element is of type ECalModelClient */
GList *clients;
@@ -92,9 +93,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;
@@ -162,6 +160,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,
@@ -196,6 +195,16 @@ G_DEFINE_TYPE (
G_TYPE_OBJECT)
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,
@@ -232,6 +241,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),
@@ -326,6 +341,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,
@@ -402,6 +424,11 @@ cal_model_dispose (GObject *object)
priv = E_CAL_MODEL_GET_PRIVATE (object);
+ 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);
@@ -560,6 +587,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",
@@ -728,8 +766,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;
@@ -963,11 +999,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);
@@ -1011,7 +1050,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;
@@ -1022,7 +1061,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
@@ -1639,7 +1678,7 @@ ecm_value_to_string (ETableModel *etm,
typedef struct {
const gchar *color;
- GList *uris;
+ GList *uids;
} AssignedColorData;
static const gchar *
@@ -1647,7 +1686,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[] = {
@@ -1665,35 +1707,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;
}
@@ -1751,6 +1806,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)
{
@@ -2080,23 +2143,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;
}
@@ -3473,6 +3542,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;
@@ -3480,8 +3550,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 3b4089bb25..68a6235d0b 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 4710fa576e..4b462a7960 100644
--- a/calendar/gui/e-cal-source-config.c
+++ b/calendar/gui/e-cal-source-config.c
@@ -47,7 +47,7 @@ G_DEFINE_TYPE (
E_TYPE_SOURCE_CONFIG)
static ESource *
-cal_source_config_get_default (ESourceConfig *config)
+cal_source_config_ref_default (ESourceConfig *config)
{
ECalSourceConfigPrivate *priv;
ESourceRegistry *registry;
@@ -56,11 +56,11 @@ cal_source_config_get_default (ESourceConfig *config)
registry = e_source_config_get_registry (config);
if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
- return e_source_registry_get_default_calendar (registry);
+ return e_source_registry_ref_default_calendar (registry);
else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
- return e_source_registry_get_default_memo_list (registry);
+ return e_source_registry_ref_default_memo_list (registry);
else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
- return e_source_registry_get_default_task_list (registry);
+ return e_source_registry_ref_default_task_list (registry);
g_return_val_if_reached (NULL);
}
@@ -188,7 +188,7 @@ cal_source_config_constructed (GObject *object)
priv->default_button = g_object_ref_sink (widget);
gtk_widget_show (widget);
- default_source = cal_source_config_get_default (config);
+ default_source = cal_source_config_ref_default (config);
original_source = e_source_config_get_original_source (config);
if (original_source != NULL) {
@@ -198,6 +198,8 @@ cal_source_config_constructed (GObject *object)
g_object_set (priv->default_button, "active", active, NULL);
}
+ g_object_unref (default_source);
+
e_source_config_insert_widget (
config, NULL, _("Color:"), priv->color_button);
@@ -274,7 +276,7 @@ cal_source_config_commit_changes (ESourceConfig *config,
class = E_SOURCE_CONFIG_CLASS (e_cal_source_config_parent_class);
class->commit_changes (config, scratch_source);
- default_source = cal_source_config_get_default (config);
+ default_source = cal_source_config_ref_default (config);
/* The default setting is a little tricky to get right. If
* the toggle button is active, this ESource is now the default.
@@ -286,6 +288,8 @@ cal_source_config_commit_changes (ESourceConfig *config,
cal_source_config_set_default (config, scratch_source);
else if (e_source_equal (scratch_source, default_source))
cal_source_config_set_default (config, NULL);
+
+ g_object_unref (default_source);
}
static void
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index 158157e2a5..92f0ffdb34 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -23,6 +23,7 @@
#include "e-calendar-selector.h"
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-selection.h"
@@ -149,6 +150,24 @@ client_opened_cb (GObject *source_object,
icalcomponent_free (icalcomp);
}
+static void
+calendar_selector_constructed (GObject *object)
+{
+ ESourceSelector *selector;
+ ESourceRegistry *registry;
+ ESource *source;
+
+ selector = E_SOURCE_SELECTOR (object);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_ref_default_calendar (registry);
+ e_source_selector_set_primary_selection (selector, source);
+ g_object_unref (source);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_calendar_selector_parent_class)->
+ constructed (object);
+}
+
static gboolean
calendar_selector_data_dropped (ESourceSelector *selector,
GtkSelectionData *selection_data,
@@ -178,7 +197,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;
@@ -196,10 +214,14 @@ exit:
static void
e_calendar_selector_class_init (ECalendarSelectorClass *class)
{
+ GObjectClass *object_class;
ESourceSelectorClass *source_selector_class;
g_type_class_add_private (class, sizeof (ECalendarSelectorPrivate));
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = calendar_selector_constructed;
+
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
source_selector_class->data_dropped = calendar_selector_data_dropped;
}
@@ -217,11 +239,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 65d9a2fc81..d8aec73d2a 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 e05f949181..3ad69e300a 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -169,6 +169,7 @@ calendar_view_delete_event (ECalendarView *cal_view,
ECalModel *model;
ECalComponent *comp;
ECalComponentVType vtype;
+ ESourceRegistry *registry;
gboolean delete = TRUE;
GError *error = NULL;
@@ -176,6 +177,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));
@@ -223,13 +225,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);
@@ -694,13 +696,18 @@ clipboard_get_calendar_data (ECalendarView *cal_view,
static void
calendar_view_paste_clipboard (ESelectable *selectable)
{
+ ECalModel *model;
ECalendarView *cal_view;
ECalendarViewPrivate *priv;
+ ESourceRegistry *registry;
GtkClipboard *clipboard;
cal_view = E_CALENDAR_VIEW (selectable);
priv = cal_view->priv;
+ model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
+
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
/* Paste text into an event being edited. */
@@ -743,11 +750,12 @@ calendar_view_paste_clipboard (ESelectable *selectable)
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- if ((itip_organizer_is_user (comp, comp_data->client) ||
- itip_sentby_is_user (comp, comp_data->client))
+ if ((itip_organizer_is_user (registry, comp, comp_data->client) ||
+ itip_sentby_is_user (registry, comp, comp_data->client))
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
comp_data->client, comp, TRUE))
itip_send_comp (
+ registry,
E_CAL_COMPONENT_METHOD_CANCEL,
comp, comp_data->client,
NULL, NULL, NULL, TRUE, FALSE);
@@ -1007,7 +1015,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;
@@ -1018,6 +1028,9 @@ e_calendar_view_add_event (ECalendarView *cal_view,
gboolean ret = TRUE;
GError *error = NULL;
+ model = e_calendar_view_get_model (cal_view);
+ registry = e_cal_model_get_registry (model);
+
start_offset = 0;
end_offset = 0;
@@ -1113,14 +1126,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);
}
@@ -1326,10 +1339,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)
@@ -1401,8 +1416,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)) {
@@ -1419,7 +1434,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);
}
@@ -1718,19 +1733,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);
@@ -1747,18 +1767,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;
@@ -1782,7 +1807,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 be096b5e6b..0ea4e77845 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -296,7 +296,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);
@@ -715,9 +716,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;
@@ -741,7 +747,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);
@@ -2081,7 +2087,8 @@ e_day_view_remove_event_cb (EDayView *day_view,
/* Checks if the users participation status is NEEDS-ACTION and shows the summary as bold text */
static void
-set_text_as_bold (EDayViewEvent *event)
+set_text_as_bold (EDayViewEvent *event,
+ ESourceRegistry *registry)
{
ECalComponent *comp;
GSList *attendees = NULL, *l;
@@ -2093,7 +2100,8 @@ set_text_as_bold (EDayViewEvent *event)
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- address = itip_get_comp_attendee (comp, event->comp_data->client);
+ address = itip_get_comp_attendee (
+ registry, comp, event->comp_data->client);
e_cal_component_get_attendee_list (comp, &attendees);
for (l = attendees; l; l = l->next) {
ECalComponentAttendee *attendee = l->data;
@@ -2125,6 +2133,8 @@ e_day_view_update_event_label (EDayView *day_view,
{
EDayViewEvent *event;
ECalendarView *cal_view;
+ ESourceRegistry *registry;
+ ECalModel *model;
gboolean free_text = FALSE, editing_event = FALSE, short_event = FALSE;
const gchar *summary;
gchar *text;
@@ -2150,8 +2160,11 @@ e_day_view_update_event_label (EDayView *day_view,
interval = event->end_minute - event->start_minute;
cal_view = E_CALENDAR_VIEW (day_view);
+ 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);
+
if ((interval / time_divisions) >= 2)
short_event = FALSE;
else if ((interval % time_divisions) == 0) {
@@ -2181,7 +2194,7 @@ e_day_view_update_event_label (EDayView *day_view,
if (e_client_check_capability (E_CLIENT (event->comp_data->client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING)
&& e_cal_util_component_has_attendee (event->comp_data->icalcomp))
- set_text_as_bold (event);
+ set_text_as_bold (event, registry);
if (free_text)
g_free (text);
@@ -2192,9 +2205,17 @@ e_day_view_update_long_event_label (EDayView *day_view,
gint event_num)
{
EDayViewEvent *event;
+ ECalendarView *cal_view;
+ ECalModel *model;
+ ESourceRegistry *registry;
const gchar *summary;
gboolean free_text = FALSE;
+ cal_view = E_CALENDAR_VIEW (day_view);
+ model = e_calendar_view_get_model (cal_view);
+
+ registry = e_cal_model_get_registry (model);
+
if (!is_array_index_in_bounds (day_view->long_events, event_num))
return;
@@ -2216,7 +2237,7 @@ e_day_view_update_long_event_label (EDayView *day_view,
if (e_client_check_capability (E_CLIENT (event->comp_data->client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING)
&& e_cal_util_component_has_attendee (event->comp_data->icalcomp))
- set_text_as_bold (event);
+ set_text_as_bold (event, registry);
}
/* Finds the day and index of the event with the given canvas item.
@@ -4247,11 +4268,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))
@@ -4272,7 +4298,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;
@@ -4366,10 +4392,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;
@@ -4394,7 +4425,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;
@@ -4547,7 +4578,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)
@@ -4614,8 +4646,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;
@@ -5157,9 +5189,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 */
@@ -5210,7 +5244,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);
@@ -6525,13 +6559,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;
@@ -6550,7 +6589,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;
}
@@ -7968,6 +8007,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;
@@ -7989,6 +8029,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. */
@@ -8053,7 +8095,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;
}
@@ -8219,6 +8261,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;
@@ -8230,6 +8273,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);
@@ -8307,7 +8352,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 76d20d2f64..6368063fac 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -38,6 +38,7 @@
#include "e-meeting-list-view.h"
#include "itip-utils.h"
#include <libebook/e-destination.h>
+#include <shell/e-shell.h>
#include "e-select-names-renderer.h"
#define E_MEETING_LIST_VIEW_GET_PRIVATE(obj) \
@@ -146,13 +147,19 @@ static void
e_meeting_list_view_init (EMeetingListView *view)
{
ENameSelectorDialog *name_selector_dialog;
+ ESourceRegistry *registry;
+ EShell *shell;
gint i;
view->priv = E_MEETING_LIST_VIEW_GET_PRIVATE (view);
view->priv->renderers = g_hash_table_new (g_direct_hash, g_int_equal);
- view->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);
+
+ view->priv->name_selector = e_name_selector_new (registry);
for (i = 0; sections[i]; i++)
add_section (view->priv->name_selector, sections[i]);
@@ -875,7 +882,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);
@@ -884,7 +891,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 0fbf327236..3b2590cad6 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -35,12 +35,13 @@
#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-registry.h>
#include <libedataserverui/e-passwords.h>
+#include <shell/e-shell.h>
#include <e-util/e-util-enumtypes.h>
-#include <libemail-utils/e-account-utils.h>
-
#include "itip-utils.h"
#include "e-meeting-utils.h"
#include "e-meeting-attendee.h"
@@ -1145,31 +1146,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_full (list, (GDestroyNotify) g_object_unref);
return attendee;
}
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
index f88ccdffd5..119913cc3c 100644
--- a/calendar/gui/e-memo-list-selector.c
+++ b/calendar/gui/e-memo-list-selector.c
@@ -18,14 +18,14 @@
* Boston, MA 02110-1301, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
+#include <gconf/gconf-client.h>
#include "e-memo-list-selector.h"
#include <string.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-selection.h"
#include "calendar/gui/comp-util.h"
@@ -163,8 +163,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;
@@ -204,18 +204,17 @@ 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_ref_source (registry, source_uid);
- if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
- goto exit;
-
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
- client_opened_cb, g_strdup (old_uid));
+ if (source != NULL) {
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
+ client_opened_cb, g_strdup (old_uid));
+ g_object_unref (source);
+ }
- exit:
+exit:
g_free (old_uid);
return success;
@@ -288,6 +287,24 @@ exit:
g_free (dd);
}
+static void
+memo_list_selector_constructed (GObject *object)
+{
+ ESourceSelector *selector;
+ ESourceRegistry *registry;
+ ESource *source;
+
+ selector = E_SOURCE_SELECTOR (object);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_ref_default_memo_list (registry);
+ e_source_selector_set_primary_selection (selector, source);
+ g_object_unref (source);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_memo_list_selector_parent_class)->
+ constructed (object);
+}
+
static gboolean
memo_list_selector_data_dropped (ESourceSelector *selector,
GtkSelectionData *selection_data,
@@ -304,7 +321,6 @@ memo_list_selector_data_dropped (ESourceSelector *selector,
e_client_utils_open_new (
destination, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
client_opened_for_drop_cb, dd);
return TRUE;
@@ -313,10 +329,14 @@ memo_list_selector_data_dropped (ESourceSelector *selector,
static void
e_memo_list_selector_class_init (EMemoListSelectorClass *class)
{
+ GObjectClass *object_class;
ESourceSelectorClass *source_selector_class;
g_type_class_add_private (class, sizeof (EMemoListSelectorPrivate));
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = memo_list_selector_constructed;
+
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
source_selector_class->data_dropped = memo_list_selector_data_dropped;
}
@@ -334,11 +354,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 c10cff2a2e..62dc0e13cf 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 433bec9d25..0adae5b031 100644
--- a/calendar/gui/e-task-list-selector.c
+++ b/calendar/gui/e-task-list-selector.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-calendar.h>
#include <libedataserverui/e-client-utils.h>
#include "e-util/e-selection.h"
#include "calendar/gui/comp-util.h"
@@ -162,8 +163,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;
@@ -204,18 +205,17 @@ 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_ref_source (registry, source_uid);
- if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
- goto exit;
-
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
- client_opened_cb, g_strdup (old_uid));
+ if (source != NULL) {
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
+ client_opened_cb, g_strdup (old_uid));
+ g_object_unref (source);
+ }
- exit:
+exit:
g_free (old_uid);
return success;
@@ -288,6 +288,24 @@ exit:
g_free (dd);
}
+static void
+task_list_selector_constructed (GObject *object)
+{
+ ESourceSelector *selector;
+ ESourceRegistry *registry;
+ ESource *source;
+
+ selector = E_SOURCE_SELECTOR (object);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_ref_default_task_list (registry);
+ e_source_selector_set_primary_selection (selector, source);
+ g_object_unref (source);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_task_list_selector_parent_class)->
+ constructed (object);
+}
+
static gboolean
task_list_selector_data_dropped (ESourceSelector *selector,
GtkSelectionData *selection_data,
@@ -304,7 +322,6 @@ task_list_selector_data_dropped (ESourceSelector *selector,
e_client_utils_open_new (
destination, E_CLIENT_SOURCE_TYPE_TASKS, TRUE, NULL,
- e_client_utils_authenticate_handler, NULL,
client_opened_for_drop_cb, dd);
return TRUE;
@@ -313,10 +330,14 @@ task_list_selector_data_dropped (ESourceSelector *selector,
static void
e_task_list_selector_class_init (ETaskListSelectorClass *class)
{
+ GObjectClass *object_class;
ESourceSelectorClass *source_selector_class;
g_type_class_add_private (class, sizeof (ETaskListSelectorPrivate));
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = task_list_selector_constructed;
+
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
source_selector_class->data_dropped = task_list_selector_data_dropped;
}
@@ -334,11 +355,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 847a221ba4..735611acfc 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/e-week-view.c b/calendar/gui/e-week-view.c
index 4f6ec6812a..133ad48f86 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2124,7 +2124,8 @@ e_week_view_recalc_display_start_day (EWeekView *week_view)
/* Checks if the users participation status is NEEDS-ACTION and shows the summary as bold text */
static void
set_text_as_bold (EWeekViewEvent *event,
- EWeekViewEventSpan *span)
+ EWeekViewEventSpan *span,
+ ESourceRegistry *registry)
{
ECalComponent *comp;
GSList *attendees = NULL, *l;
@@ -2136,7 +2137,8 @@ set_text_as_bold (EWeekViewEvent *event,
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- address = itip_get_comp_attendee (comp, event->comp_data->client);
+ address = itip_get_comp_attendee (
+ registry, comp, event->comp_data->client);
e_cal_component_get_attendee_list (comp, &attendees);
for (l = attendees; l; l = l->next) {
ECalComponentAttendee *attendee = l->data;
@@ -3072,6 +3074,9 @@ e_week_view_reshape_event_span (EWeekView *week_view,
gint event_num,
gint span_num)
{
+ ECalendarView *cal_view;
+ ECalModel *model;
+ ESourceRegistry *registry;
EWeekViewEvent *event;
EWeekViewEventSpan *span;
gint span_x, span_y, span_w, num_icons, icons_width, time_width;
@@ -3087,6 +3092,11 @@ e_week_view_reshape_event_span (EWeekView *week_view,
PangoFontMetrics *font_metrics;
PangoLayout *layout;
+ cal_view = E_CALENDAR_VIEW (week_view);
+ model = e_calendar_view_get_model (cal_view);
+
+ registry = e_cal_model_get_registry (model);
+
if (!is_array_index_in_bounds (week_view->events, event_num))
return;
@@ -3198,7 +3208,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
if (e_client_check_capability (E_CLIENT (event->comp_data->client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING)
&& e_cal_util_component_has_attendee (event->comp_data->icalcomp)) {
- set_text_as_bold (event, span);
+ set_text_as_bold (event, span, registry);
}
g_object_set_data (G_OBJECT (span->text_item), "event-num", GINT_TO_POINTER (event_num));
g_signal_connect (
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 879f90fde2..f482e06039 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -75,6 +75,7 @@
/* Private part of the GnomeCalendar structure */
struct _GnomeCalendarPrivate {
+ ESourceRegistry *registry;
ECalModel *model;
/*
@@ -141,6 +142,7 @@ enum {
PROP_0,
PROP_DATE_NAVIGATOR,
PROP_MEMO_TABLE,
+ PROP_REGISTRY,
PROP_TASK_TABLE,
PROP_VIEW
};
@@ -331,6 +333,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,
@@ -349,6 +361,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),
@@ -384,6 +402,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 (
@@ -405,11 +429,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;
@@ -542,6 +569,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",
@@ -1487,6 +1526,11 @@ gnome_calendar_do_dispose (GObject *object)
priv = GNOME_CALENDAR_GET_PRIVATE (object);
+ 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, object);
@@ -1900,9 +1944,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 bc65fe2316..c8cb5e8f60 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 ba2c174528..2a676cdc23 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -32,11 +32,12 @@
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-util.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 <e-util/e-dialog-utils.h>
-#include <libemail-utils/e-account-utils.h>
-
#include <composer/e-msg-composer.h>
#include "itip-utils.h"
@@ -67,7 +68,61 @@ static icalproperty_method itip_methods_enum[] = {
};
/**
+ * itip_get_default_name_and_address:
+ * @registry: an #ESourceRegistry
+ * @name: return location for the user's real name, or %NULL
+ * @address: return location for the user's email address, or %NULL
+ *
+ * Returns the real name and email address of the default mail identity,
+ * if available. If no default mail identity is available, @name and
+ * @address are set to %NULL and the function returns %FALSE.
+ *
+ * Returns: %TRUE if @name and/or @address were set
+ **/
+gboolean
+itip_get_default_name_and_address (ESourceRegistry *registry,
+ gchar **name,
+ gchar **address)
+{
+ ESource *source;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+ gboolean success;
+
+ source = e_source_registry_ref_default_mail_identity (registry);
+
+ if (source != NULL) {
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ extension = e_source_get_extension (source, extension_name);
+
+ if (name != NULL)
+ *name = e_source_mail_identity_dup_name (
+ E_SOURCE_MAIL_IDENTITY (extension));
+
+ if (address != NULL)
+ *address = e_source_mail_identity_dup_address (
+ E_SOURCE_MAIL_IDENTITY (extension));
+
+ g_object_unref (source);
+
+ success = TRUE;
+
+ } else {
+ if (name != NULL)
+ *name = NULL;
+
+ if (address != NULL)
+ *address = NULL;
+
+ success = FALSE;
+ }
+
+ return success;
+}
+
+/**
* 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().
@@ -75,41 +130,45 @@ 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);
+
+ if (name == NULL || address == NULL)
+ continue;
+
+ identities[ii++] = g_strdup_printf ("%s <%s>", name, address);
}
- g_object_unref (iterator);
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
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
@@ -120,23 +179,44 @@ 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;
+ ESource *source;
+ ESourceMailIdentity *mail_identity;
+ const gchar *extension_name;
+ const gchar *address;
+ const gchar *name;
gchar *identity = NULL;
- account = e_get_default_account ();
- if (account != NULL && account->enabled)
- identity = g_strdup_printf (
- "%s <%s>",
- account->id->name,
- account->id->address);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ source = e_source_registry_ref_default_mail_identity (registry);
+
+ if (source == NULL)
+ return NULL;
+
+ if (!e_source_get_enabled (source)) {
+ g_object_unref (source);
+ return NULL;
+ }
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ mail_identity = e_source_get_extension (source, extension_name);
+
+ name = e_source_mail_identity_get_name (mail_identity);
+ address = e_source_mail_identity_get_address (mail_identity);
+
+ if (name != NULL && address != NULL)
+ identity = g_strdup_printf ("%s <%s>", name, address);
+
+ g_object_unref (source);
return identity;
}
/**
* itip_address_is_user:
+ * @registry: an #ESourceRegistry
* @address: an email address
*
* Looks for a registered mail identity with a matching email address.
@@ -144,31 +224,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;
- /* XXX EAccountList misuses const. */
- account = (EAccount *) e_account_list_find (
- account_list, E_ACCOUNT_FIND_ID_ADDRESS, address);
+ extension = e_source_get_extension (source, extension_name);
+ id_address = e_source_mail_identity_get_address (extension);
- return (account != NULL);
+ if (id_address == NULL)
+ continue;
+
+ if (g_ascii_strcasecmp (address, id_address) == 0) {
+ match = TRUE;
+ break;
+ }
+ }
+
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
+
+ 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)
{
@@ -176,6 +278,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)))
@@ -200,20 +304,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))
@@ -222,7 +329,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,18 +387,18 @@ html_new_lines_for (const gchar *string)
}
gchar *
-itip_get_comp_attendee (ECalComponent *comp,
+itip_get_comp_attendee (ESourceRegistry *registry,
+ ECalComponent *comp,
ECalClient *cal_client)
{
+ ESource *source;
GSList *attendees;
- EAccountList *al;
- EAccount *a;
- EIterator *it;
ECalComponentAttendee *attendee = NULL;
+ GList *list, *link;
+ const gchar *extension_name;
gchar *address = NULL;
e_cal_component_get_attendee_list (comp, &attendees);
- al = e_get_account_list ();
if (cal_client)
e_client_get_backend_property_sync (
@@ -299,28 +406,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;
}
@@ -328,42 +438,72 @@ itip_get_comp_attendee (ECalComponent *comp,
address = NULL;
}
- for (it = e_list_get_iterator ((EList *) al);
- e_iterator_is_valid (it);
- e_iterator_next (it)) {
- a = (EAccount *) e_iterator_get (it);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ list = e_source_registry_list_sources (registry, extension_name);
- if (!a->enabled)
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESourceExtension *extension;
+
+ source = E_SOURCE (link->data);
+
+ if (!e_source_get_enabled (source))
continue;
- attendee = get_attendee (attendees, a->id->address);
- if (attendee) {
- gchar *user_email = g_strdup (itip_strip_mailto (attendee->value));
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ extension = e_source_get_extension (source, extension_name);
+
+ address = e_source_mail_identity_dup_address (
+ E_SOURCE_MAIL_IDENTITY (extension));
+
+ if (address == NULL)
+ continue;
+
+ attendee = get_attendee (attendees, address);
+ if (attendee != NULL) {
+ gchar *user_email;
+ user_email = g_strdup (
+ itip_strip_mailto (attendee->value));
e_cal_component_free_attendee_list (attendees);
+
+ g_free (address);
+
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, 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);
+
+ g_free (address);
+
return user_email;
}
+
+ g_free (address);
}
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
+
/* We could not find the attendee in the component, so just give
* the default account address if the email address is not set in
* the backend. */
/* FIXME do we have a better way ? */
- a = e_get_default_account ();
- address = g_strdup ((a != NULL) ? a->id->address : "");
+ itip_get_default_name_and_address (registry, NULL, &address);
e_cal_component_free_attendee_list (attendees);
+
+ if (address == NULL)
+ address = g_strdup ("");
+
return address;
}
@@ -484,7 +624,8 @@ users_has_attendee (const GSList *users,
static gchar *
comp_from (ECalComponentItipMethod method,
- ECalComponent *comp)
+ ECalComponent *comp,
+ ESourceRegistry *registry)
{
ECalComponentOrganizer organizer;
ECalComponentAttendee *attendee;
@@ -497,10 +638,10 @@ comp_from (ECalComponentItipMethod method,
return NULL;
case E_CAL_COMPONENT_METHOD_REQUEST:
- return itip_get_comp_attendee (comp, NULL);
+ return itip_get_comp_attendee (registry, comp, NULL);
case E_CAL_COMPONENT_METHOD_REPLY:
- sender = itip_get_comp_attendee (comp, NULL);
+ sender = itip_get_comp_attendee (registry, comp, NULL);
if (sender != NULL)
return sender;
if (!e_cal_component_has_attendees (comp))
@@ -535,7 +676,8 @@ comp_from (ECalComponentItipMethod method,
}
static EDestination **
-comp_to_list (ECalComponentItipMethod method,
+comp_to_list (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *comp,
const GSList *users,
gboolean reply_all,
@@ -574,7 +716,7 @@ comp_to_list (ECalComponentItipMethod method,
array = g_ptr_array_new ();
- sender = itip_get_comp_attendee (comp, NULL);
+ sender = itip_get_comp_attendee (registry, comp, NULL);
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *att = l->data;
@@ -638,7 +780,7 @@ comp_to_list (ECalComponentItipMethod method,
array = g_ptr_array_new ();
e_cal_component_get_organizer (comp, &organizer);
- sender = itip_get_comp_attendee (comp, NULL);
+ sender = itip_get_comp_attendee (registry, comp, NULL);
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *att = l->data;
@@ -696,7 +838,7 @@ comp_to_list (ECalComponentItipMethod method,
/* send the status to delegatee to the delegate also*/
e_cal_component_get_attendee_list (comp, &attendees);
- sender = itip_get_comp_attendee (comp, NULL);
+ sender = itip_get_comp_attendee (registry, comp, NULL);
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *att = l->data;
@@ -751,7 +893,8 @@ comp_to_list (ECalComponentItipMethod method,
}
static gchar *
-comp_subject (ECalComponentItipMethod method,
+comp_subject (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *comp)
{
ECalComponentText caltext;
@@ -794,7 +937,7 @@ comp_subject (ECalComponentItipMethod method,
case E_CAL_COMPONENT_METHOD_REPLY:
e_cal_component_get_attendee_list (comp, &alist);
- sender = itip_get_comp_attendee (comp, NULL);
+ sender = itip_get_comp_attendee (registry, comp, NULL);
if (sender) {
for (l = alist; l != NULL; l = l->next) {
@@ -1010,7 +1153,8 @@ comp_server_send (ECalComponentItipMethod method,
}
static gboolean
-comp_limit_attendees (ECalComponent *comp)
+comp_limit_attendees (ESourceRegistry *registry,
+ ECalComponent *comp)
{
icalcomponent *icomp;
icalproperty *prop;
@@ -1042,7 +1186,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);
@@ -1054,7 +1198,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);
}
}
@@ -1078,29 +1222,34 @@ comp_limit_attendees (ECalComponent *comp)
static void
comp_sentby (ECalComponent *comp,
- ECalClient *cal_client)
+ ECalClient *cal_client,
+ ESourceRegistry *registry)
{
ECalComponentOrganizer organizer;
GSList * attendees, *l;
+ gchar *name;
+ gchar *address;
gchar *user = NULL;
- e_cal_component_get_organizer (comp, &organizer);
- if (!organizer.value) {
- EAccount *a = e_get_default_account ();
+ itip_get_default_name_and_address (registry, &name, &address);
- organizer.value = g_strdup_printf ("MAILTO:%s", a->id->address);
+ e_cal_component_get_organizer (comp, &organizer);
+ if (!organizer.value && name != NULL && address != NULL) {
+ organizer.value = g_strdup_printf ("MAILTO:%s", address);
organizer.sentby = NULL;
- organizer.cn = a->id->name;
+ organizer.cn = name;
organizer.language = NULL;
e_cal_component_set_organizer (comp, &organizer);
g_free ((gchar *) organizer.value);
+ g_free (name);
+ g_free (address);
return;
}
e_cal_component_get_attendee_list (comp, &attendees);
- user = itip_get_comp_attendee (comp, cal_client);
+ user = itip_get_comp_attendee (registry, comp, cal_client);
for (l = attendees; l; l = l->next) {
ECalComponentAttendee *a = l->data;
@@ -1109,15 +1258,18 @@ comp_sentby (ECalComponent *comp,
(a->sentby && !g_ascii_strcasecmp (
itip_strip_mailto (a->sentby), user))) {
g_free (user);
+
+ g_free (name);
+ g_free (address);
return;
}
}
- if (!itip_organizer_is_user (comp, cal_client) && !itip_sentby_is_user (comp, cal_client)) {
- EAccount *a = e_get_default_account ();
-
+ if (!itip_organizer_is_user (registry, comp, cal_client) &&
+ !itip_sentby_is_user (registry, comp, cal_client) &&
+ address != NULL) {
organizer.value = g_strdup (organizer.value);
- organizer.sentby = g_strdup_printf ("MAILTO:%s", a->id->address);
+ organizer.sentby = g_strdup_printf ("MAILTO:%s", address);
organizer.cn = g_strdup (organizer.cn);
organizer.language = g_strdup (organizer.language);
@@ -1128,9 +1280,14 @@ comp_sentby (ECalComponent *comp,
g_free ((gchar *) organizer.cn);
g_free ((gchar *) organizer.language);
}
+
+ g_free (name);
+ g_free (address);
}
+
static ECalComponent *
-comp_minimal (ECalComponent *comp,
+comp_minimal (ESourceRegistry *registry,
+ ECalComponent *comp,
gboolean attendee)
{
ECalComponent *clone;
@@ -1151,7 +1308,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;
@@ -1238,7 +1395,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,
@@ -1336,14 +1494,14 @@ comp_compliant (ECalComponentItipMethod method,
/* Comply with itip spec */
switch (method) {
case E_CAL_COMPONENT_METHOD_PUBLISH:
- comp_sentby (clone, client);
+ comp_sentby (clone, client, registry);
e_cal_component_set_attendee_list (clone, NULL);
break;
case E_CAL_COMPONENT_METHOD_REQUEST:
- comp_sentby (clone, client);
+ comp_sentby (clone, client, registry);
break;
case E_CAL_COMPONENT_METHOD_CANCEL:
- comp_sentby (clone, client);
+ comp_sentby (clone, client, registry);
break;
case E_CAL_COMPONENT_METHOD_REPLY:
break;
@@ -1351,7 +1509,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;
@@ -1359,7 +1517,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;
@@ -1416,34 +1574,43 @@ append_cal_attachments (EMsgComposer *composer,
g_slist_free (attach_list);
}
-static EAccount *
-find_enabled_account (EAccountList *accounts,
- const gchar *id_address)
+static ESource *
+find_enabled_identity (ESourceRegistry *registry,
+ const gchar *id_address)
{
- EIterator *it;
- EAccount *account = NULL;
+ GList *list, *link;
+ ESource *mail_identity = NULL;
+ const gchar *extension_name;
- g_return_val_if_fail (accounts != NULL, NULL);
-
- if (!id_address)
+ if (id_address == NULL)
return NULL;
- for (it = e_list_get_iterator ((EList *) accounts);
- e_iterator_is_valid (it);
- e_iterator_next (it)) {
- account = (EAccount *) e_iterator_get (it);
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ list = e_source_registry_list_sources (registry, extension_name);
- if (account
- && account->enabled
- && account->id
- && account->id->address
- && g_ascii_strcasecmp (account->id->address, id_address) == 0)
- break;
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceMailIdentity *extension;
+ const gchar *address;
- account = NULL;
+ if (!e_source_get_enabled (source))
+ continue;
+
+ extension = e_source_get_extension (source, extension_name);
+ address = e_source_mail_identity_get_address (extension);
+
+ if (address == NULL)
+ continue;
+
+ if (g_ascii_strcasecmp (address, id_address) == 0) {
+ mail_identity = g_object_ref (source);
+ break;
+ }
}
- return account;
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
+
+ return mail_identity;
}
static void
@@ -1452,40 +1619,44 @@ setup_from (ECalComponentItipMethod method,
ECalClient *cal_client,
EComposerHeaderTable *table)
{
- EAccountList *accounts;
+ ESourceRegistry *registry;
+ ESource *source = NULL;
- accounts = e_composer_header_table_get_account_list (table);
- if (accounts) {
- EAccount *account = NULL;
+ registry = e_composer_header_table_get_registry (table);
- /* always use organizer's email when user is an organizer */
- if (itip_organizer_is_user (comp, cal_client)) {
- ECalComponentOrganizer organizer = {0};
+ /* always use organizer's email when user is an organizer */
+ if (itip_organizer_is_user (registry, comp, cal_client)) {
+ ECalComponentOrganizer organizer = {0};
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value != NULL) {
- account = find_enabled_account (
- accounts,
- itip_strip_mailto (organizer.value));
- }
- }
+ e_cal_component_get_organizer (comp, &organizer);
+ if (organizer.value != NULL)
+ source = find_enabled_identity (
+ registry,
+ itip_strip_mailto (organizer.value));
+ }
- if (!account) {
- gchar *from = comp_from (method, comp);
+ if (source == NULL) {
+ gchar *from = comp_from (method, comp, registry);
- if (from)
- account = find_enabled_account (accounts, from);
+ if (from != NULL)
+ source = find_enabled_identity (registry, from);
- g_free (from);
- }
+ g_free (from);
+ }
+
+ if (source != NULL) {
+ const gchar *uid;
+
+ uid = e_source_get_uid (source);
+ e_composer_header_table_set_identity_uid (table, uid);
- if (account)
- e_composer_header_table_set_account (table, account);
+ g_object_unref (source);
}
}
gboolean
-itip_send_comp (ECalComponentItipMethod method,
+itip_send_comp (ESourceRegistry *registry,
+ ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
icalcomponent *zones,
@@ -1508,6 +1679,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);
@@ -1542,14 +1715,15 @@ 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;
/* Recipients */
destinations = comp_to_list (
- method, comp, users, FALSE,
+ registry, method, comp, users, FALSE,
only_new_attendees ? g_object_get_data (
G_OBJECT (send_comp), "new-attendees") : NULL);
if (method != E_CAL_COMPONENT_METHOD_PUBLISH) {
@@ -1561,7 +1735,7 @@ itip_send_comp (ECalComponentItipMethod method,
}
/* Subject information */
- subject = comp_subject (method, comp);
+ subject = comp_subject (registry, method, comp);
composer = e_msg_composer_new (shell);
table = e_msg_composer_get_header_table (composer);
@@ -1637,7 +1811,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,
@@ -1657,6 +1832,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);
@@ -1666,15 +1843,17 @@ 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;
/* Recipients */
- destinations = comp_to_list (method, comp, users, reply_all, NULL);
+ destinations = comp_to_list (
+ registry, method, comp, users, reply_all, NULL);
/* Subject information */
- subject = comp_subject (method, comp);
+ subject = comp_subject (registry, method, comp);
composer = e_msg_composer_new (shell);
table = e_msg_composer_get_header_table (composer);
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 6da2519d07..6408631dfa 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,30 @@ 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,
+gboolean itip_get_default_name_and_address
+ (ESourceRegistry *registry,
+ gchar **name,
+ gchar **address);
+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,
+gchar * itip_get_comp_attendee (ESourceRegistry *registry,
+ 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 +89,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,