[evolution] Adapt to libedataserver[ui] changes.



commit 7950d6a0c6efd6c4d48afd99c138f38952bdd1bb
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Apr 21 14:52:23 2012 -0400

    Adapt to libedataserver[ui] changes.

 addressbook/gui/contact-editor/e-contact-editor.c  |   12 +++-
 .../gui/contact-editor/e-contact-quick-add.c       |   19 ++++--
 .../contact-list-editor/e-contact-list-editor.c    |   30 ++++++---
 addressbook/gui/widgets/e-addressbook-view.c       |    2 +-
 addressbook/gui/widgets/ea-minicard-view.c         |    2 +-
 addressbook/gui/widgets/eab-gui-util.c             |   27 ++++++--
 addressbook/importers/evolution-csv-importer.c     |   11 ++-
 addressbook/importers/evolution-ldif-importer.c    |   11 ++-
 addressbook/importers/evolution-vcard-importer.c   |   11 ++-
 .../evolution-addressbook-export-list-folders.c    |    4 +-
 calendar/alarm-notify/alarm-queue.c                |    2 +-
 calendar/gui/dialogs/calendar-setup.c              |    8 +-
 calendar/gui/dialogs/comp-editor.c                 |    8 +-
 calendar/gui/dialogs/e-send-options-utils.c        |    2 +-
 calendar/gui/dialogs/event-page.c                  |   24 +++++--
 calendar/gui/dialogs/memo-page.c                   |   15 +++--
 calendar/gui/dialogs/task-page.c                   |   13 +++-
 calendar/gui/e-cal-component-preview.c             |    2 +-
 calendar/gui/e-cal-model.c                         |    4 +-
 calendar/gui/e-calendar-view.c                     |    2 +-
 calendar/gui/e-day-view.c                          |    2 +-
 calendar/gui/e-task-table.c                        |    4 +-
 calendar/importers/icalendar-importer.c            |   54 +++++++++++++---
 capplet/settings/mail-account-view.c               |    4 +-
 e-util/e-util.c                                    |    2 +-
 libemail-engine/e-mail-utils.c                     |    4 +-
 mail/em-account-editor.c                           |    4 +-
 modules/addressbook/addressbook-config.c           |   12 ++--
 modules/addressbook/e-book-shell-sidebar.c         |    9 ++-
 modules/addressbook/e-book-shell-view-actions.c    |   17 ++++--
 modules/addressbook/e-book-shell-view-private.c    |    9 ++-
 modules/calendar/e-cal-attachment-handler.c        |   14 +++--
 modules/calendar/e-cal-shell-backend.c             |    6 +-
 modules/calendar/e-cal-shell-migrate.c             |    4 +-
 modules/calendar/e-cal-shell-sidebar.c             |   40 +++++++-----
 modules/calendar/e-cal-shell-view-actions.c        |   41 ++++++++----
 modules/calendar/e-memo-shell-backend.c            |    4 +-
 modules/calendar/e-memo-shell-content.c            |    2 +-
 modules/calendar/e-memo-shell-migrate.c            |    4 +-
 modules/calendar/e-memo-shell-sidebar.c            |   40 +++++++-----
 modules/calendar/e-memo-shell-view-actions.c       |   41 ++++++++----
 modules/calendar/e-task-shell-backend.c            |    4 +-
 modules/calendar/e-task-shell-content.c            |    2 +-
 modules/calendar/e-task-shell-migrate.c            |    4 +-
 modules/calendar/e-task-shell-sidebar.c            |   40 +++++++-----
 modules/calendar/e-task-shell-view-actions.c       |   41 ++++++++----
 .../online-accounts/evolution-online-accounts.c    |    2 +-
 plugins/addressbook-file/addressbook-file.c        |    2 +-
 plugins/bbdb/bbdb.c                                |   68 +++++++++++++-------
 plugins/calendar-file/calendar-file.c              |    2 +-
 plugins/default-source/default-source.c            |    2 +-
 plugins/itip-formatter/itip-formatter.c            |   28 ++++----
 plugins/itip-formatter/itip-view.c                 |   12 ++--
 plugins/pst-import/pst-importer.c                  |    4 +-
 plugins/publish-calendar/url-editor-dialog.c       |    2 +-
 plugins/save-calendar/csv-format.c                 |    4 +-
 plugins/save-calendar/ical-format.c                |    4 +-
 plugins/save-calendar/rdf-format.c                 |    9 ++-
 shell/e-shell-migrate.c                            |    6 +-
 59 files changed, 487 insertions(+), 275 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 7676d62..7ad3bcd 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -27,6 +27,7 @@
 #include "eab-editor.h"
 #include "e-contact-editor.h"
 
+#include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <gtk/gtk.h>
@@ -3094,7 +3095,9 @@ source_changed (ESourceComboBox *source_combo_box,
 	ESource *source;
 	GtkWindow *parent;
 
-	source = e_source_combo_box_get_active (source_combo_box);
+	source = e_source_combo_box_ref_active (source_combo_box);
+	g_return_if_fail (source != NULL);
+
 	parent = eab_editor_get_window (EAB_EDITOR (editor));
 
 	if (editor->cancellable != NULL) {
@@ -3107,13 +3110,13 @@ source_changed (ESourceComboBox *source_combo_box,
 	source_source = e_client_get_source (E_CLIENT (editor->source_client));
 
 	if (e_source_equal (target_source, source))
-		return;
+		goto exit;
 
 	if (e_source_equal (source_source, source)) {
 		g_object_set (
 			editor, "target_client",
 			editor->source_client, NULL);
-		return;
+		goto exit;
 	}
 
 	editor->cancellable = g_cancellable_new ();
@@ -3123,6 +3126,9 @@ source_changed (ESourceComboBox *source_combo_box,
 		FALSE, editor->cancellable,
 		e_client_utils_authenticate_handler, parent,
 		contact_editor_book_loaded_cb, g_object_ref (editor));
+
+exit:
+	g_object_unref (source);
 }
 
 static void
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 7c303e7..69b35b6 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -156,12 +156,13 @@ merge_cb (GObject *source_object,
 
 	if (!e_client_is_readonly (client))
 		eab_merging_book_add_contact (
-			E_BOOK_CLIENT (client), qa->contact, NULL, NULL);
+			E_BOOK_CLIENT (client),
+			qa->contact, NULL, NULL);
 	else
 		e_alert_run_dialog_for_args (
 			e_shell_get_active_window (NULL),
 			"addressbook:error-read-only",
-			e_source_peek_name (source),
+			e_source_get_display_name (source),
 			NULL);
 
 	if (qa->cb)
@@ -312,7 +313,8 @@ ce_have_book (GObject *source_object,
 	g_return_if_fail (E_IS_CLIENT (client));
 
 	eab_merging_book_find_contact (
-		E_BOOK_CLIENT (client), qa->contact, ce_have_contact, qa);
+		E_BOOK_CLIENT (client),
+		qa->contact, ce_have_contact, qa);
 }
 
 static void
@@ -389,13 +391,16 @@ clicked_cb (GtkWidget *w,
 static void
 sanitize_widgets (QuickAdd *qa)
 {
+	GtkComboBox *combo_box;
+	const gchar *active_id;
 	gboolean enabled = TRUE;
 
 	g_return_if_fail (qa != NULL);
 	g_return_if_fail (qa->dialog != NULL);
 
-	enabled = (e_source_combo_box_get_active_uid (
-		E_SOURCE_COMBO_BOX (qa->combo_box)) != NULL);
+	combo_box = GTK_COMBO_BOX (qa->combo_box);
+	active_id = gtk_combo_box_get_active_id (combo_box);
+	enabled = (active_id != NULL);
 
 	gtk_dialog_set_response_sensitive (
 		GTK_DIALOG (qa->dialog),
@@ -410,12 +415,12 @@ source_changed (ESourceComboBox *source_combo_box,
 {
 	ESource *source;
 
-	source = e_source_combo_box_get_active (source_combo_box);
+	source = e_source_combo_box_ref_active (source_combo_box);
 
 	if (source != NULL) {
 		if (qa->source != NULL)
 			g_object_unref (qa->source);
-		qa->source = g_object_ref (source);
+		qa->source = source;  /* takes reference */
 	}
 
 	sanitize_widgets (qa);
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 3db6c4c..385ce09 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -935,21 +935,31 @@ contact_list_editor_source_menu_changed_cb (GtkWidget *widget);
 void
 contact_list_editor_source_menu_changed_cb (GtkWidget *widget)
 {
+	ESourceComboBox *combo_box;
 	EContactListEditor *editor;
-	ESource *source;
+	ESource *active_source;
+	ESource *client_source;
+	EClient *client;
 
 	editor = contact_list_editor_extract (widget);
-	source = e_source_combo_box_get_active (E_SOURCE_COMBO_BOX (widget));
 
-	if (e_source_equal (e_client_get_source (E_CLIENT (editor->priv->book_client)), source))
-		return;
+	combo_box = E_SOURCE_COMBO_BOX (widget);
+	active_source = e_source_combo_box_ref_active (combo_box);
+	g_return_if_fail (active_source != NULL);
+
+	client = E_CLIENT (editor->priv->book_client);
+	client_source = e_client_get_source (client);
+
+	if (!e_source_equal (client_source, active_source))
+		e_client_utils_open_new (
+			client_source, E_CLIENT_SOURCE_TYPE_CONTACTS,
+			FALSE, NULL,
+			e_client_utils_authenticate_handler,
+			eab_editor_get_window (EAB_EDITOR (editor)),
+			contact_list_editor_book_loaded_cb,
+			g_object_ref (editor));
 
-	e_client_utils_open_new (
-		source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
-		e_client_utils_authenticate_handler,
-		eab_editor_get_window (EAB_EDITOR (editor)),
-		contact_list_editor_book_loaded_cb,
-		g_object_ref (editor));
+	g_object_unref (active_source);
 }
 
 gboolean
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 50f50c9..5dce1e2 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1099,7 +1099,7 @@ folder_bar_message (EAddressbookView *view,
 	if (view->priv->source == NULL)
 		return;
 
-	display_name = e_source_peek_name (view->priv->source);
+	display_name = e_source_get_display_name (view->priv->source);
 	e_shell_sidebar_set_primary_text (shell_sidebar, display_name);
 	e_shell_sidebar_set_secondary_text (shell_sidebar, message);
 }
diff --git a/addressbook/gui/widgets/ea-minicard-view.c b/addressbook/gui/widgets/ea-minicard-view.c
index 6772a0b..65b20fe 100644
--- a/addressbook/gui/widgets/ea-minicard-view.c
+++ b/addressbook/gui/widgets/ea-minicard-view.c
@@ -165,7 +165,7 @@ ea_minicard_view_get_name (AtkObject *accessible)
 	g_object_get (card_view->adapter, "client", &book_client, NULL);
 	g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), NULL);
 	source = e_client_get_source (E_CLIENT (book_client));
-	display_name = e_source_peek_name (source);
+	display_name = e_source_get_display_name (source);
 	if (display_name == NULL)
 		display_name = "";
 
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 535e1bd..3d9d819 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -134,7 +134,7 @@ eab_load_error_dialog (GtkWidget *parent,
 		source_dir = e_source_peek_relative_uri (source);
 
 		if (!source_dir || !g_str_equal (source_dir, "system"))
-			source_dir = e_source_peek_uid (source);
+			source_dir = e_source_get_uid (source);
 
 		/* Mangle the URI to not contain invalid characters. */
 		mangled_source_dir = g_strdelimit (g_strdup (source_dir), ":/", '_');
@@ -285,11 +285,16 @@ source_selection_changed_cb (ESourceSelector *selector,
                              GtkWidget *ok_button)
 {
 	ESource *except_source = NULL, *selected;
+	gboolean sensitive;
 
 	except_source = g_object_get_data (G_OBJECT (ok_button), "except-source");
-	selected = e_source_selector_get_primary_selection (selector);
+	selected = e_source_selector_ref_primary_selection (selector);
 
-	gtk_widget_set_sensitive (ok_button, selected && selected != except_source);
+	sensitive = (selected != NULL && selected != except_source);
+	gtk_widget_set_sensitive (ok_button, sensitive);
+
+	if (selected != NULL)
+		g_object_unref (selected);
 }
 
 ESource *
@@ -335,7 +340,7 @@ eab_select_source (ESource *except_source,
 		g_object_set_data (
 			G_OBJECT (ok_button), "except-source",
 			e_source_list_peek_source_by_uid (
-			source_list, e_source_peek_uid (except_source)));
+			source_list, e_source_get_uid (except_source)));
 
 	g_signal_connect (
 		selector, "primary_selection_changed",
@@ -343,7 +348,7 @@ eab_select_source (ESource *except_source,
 
 	if (select_uid) {
 		source = e_source_list_peek_source_by_uid (source_list, select_uid);
-		if (source)
+		if (source != NULL)
 			e_source_selector_set_primary_selection (
 				E_SOURCE_SELECTOR (selector), source);
 	}
@@ -359,11 +364,17 @@ eab_select_source (ESource *except_source,
 	response = gtk_dialog_run (GTK_DIALOG (dialog));
 
 	if (response == GTK_RESPONSE_ACCEPT)
-		source = e_source_selector_get_primary_selection (E_SOURCE_SELECTOR (selector));
+		source = e_source_selector_ref_primary_selection (
+			E_SOURCE_SELECTOR (selector));
 	else
 		source = NULL;
 
 	gtk_widget_destroy (dialog);
+
+	/* XXX Return a borrowed reference for backward-compatibility. */
+	if (source != NULL)
+		g_object_unref (source);
+
 	return source;
 }
 
@@ -590,9 +601,9 @@ eab_transfer_contacts (EBookClient *source_client,
 	if (!destination)
 		return;
 
-	if (strcmp (last_uid, e_source_peek_uid (destination)) != 0) {
+	if (strcmp (last_uid, e_source_get_uid (destination)) != 0) {
 		g_free (last_uid);
-		last_uid = g_strdup (e_source_peek_uid (destination));
+		last_uid = g_strdup (e_source_get_uid (destination));
 	}
 
 	process = g_new (ContactCopyProcess, 1);
diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c
index 66cc0a7..92290e8 100644
--- a/addressbook/importers/evolution-csv-importer.c
+++ b/addressbook/importers/evolution-csv-importer.c
@@ -755,10 +755,14 @@ static void
 primary_selection_changed_cb (ESourceSelector *selector,
                               EImportTarget *target)
 {
+	ESource *source;
+
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
+
 	g_datalist_set_data_full (
 		&target->data, "csv-source",
-		g_object_ref (e_source_selector_get_primary_selection (selector)),
-		g_object_unref);
+		source, (GDestroyNotify) g_object_unref);
 }
 
 static GtkWidget *
@@ -921,7 +925,8 @@ csv_import (EImport *ei,
 
 	source = g_datalist_get_data (&target->data, "csv-source");
 
-	e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
+	e_client_utils_open_new (
+		source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
 		e_client_utils_authenticate_handler, NULL,
 		book_loaded_cb, gci);
 }
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index 989bb80..1ba350a 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -553,10 +553,14 @@ static void
 primary_selection_changed_cb (ESourceSelector *selector,
                               EImportTarget *target)
 {
+	ESource *source;
+
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
+
 	g_datalist_set_data_full (
 		&target->data, "ldif-source",
-		g_object_ref (e_source_selector_get_primary_selection (selector)),
-		g_object_unref);
+		source, (GDestroyNotify) g_object_unref);
 }
 
 static GtkWidget *
@@ -711,7 +715,8 @@ ldif_import (EImport *ei,
 
 	source = g_datalist_get_data (&target->data, "ldif-source");
 
-	e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
+	e_client_utils_open_new (
+		source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
 		e_client_utils_authenticate_handler, NULL,
 		book_loaded_cb, gci);
 }
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index b355539..1dbbed0 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -391,10 +391,14 @@ static void
 primary_selection_changed_cb (ESourceSelector *selector,
                               EImportTarget *target)
 {
+	ESource *source;
+
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
+
 	g_datalist_set_data_full (
 		&target->data, "vcard-source",
-		g_object_ref (e_source_selector_get_primary_selection (selector)),
-		g_object_unref);
+		source, (GDestroyNotify) g_object_unref);
 }
 
 static GtkWidget *
@@ -569,7 +573,8 @@ vcard_import (EImport *ei,
 
 	source = g_datalist_get_data (&target->data, "vcard-source");
 
-	e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
+	e_client_utils_open_new (
+		source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
 		e_client_utils_authenticate_handler, NULL,
 		book_loaded_cb, gci);
 }
diff --git a/addressbook/tools/evolution-addressbook-export-list-folders.c b/addressbook/tools/evolution-addressbook-export-list-folders.c
index 2628c9c..14e7e20 100644
--- a/addressbook/tools/evolution-addressbook-export-list-folders.c
+++ b/addressbook/tools/evolution-addressbook-export-list-folders.c
@@ -76,7 +76,7 @@ action_list_folders_init (ActionContext *p_actctx)
 			book_client = e_book_client_new (s, &error);
 			if (!book_client
 			    || !e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) {
-				g_warning (_("Failed to open client '%s': %s"), e_source_peek_name (s), error ? error->message : _("Unknown error"));
+				g_warning (_("Failed to open client '%s': %s"), e_source_get_display_name (s), error ? error->message : _("Unknown error"));
 				if (error)
 					g_error_free (error);
 				continue;
@@ -86,7 +86,7 @@ action_list_folders_init (ActionContext *p_actctx)
 				contacts = NULL;
 
 			uri = e_source_get_uri (s);
-			name = e_source_peek_name (s);
+			name = e_source_get_display_name (s);
 
 			if (outputfile)
 				fprintf (
diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c
index 8cd0529..7d3a082 100644
--- a/calendar/alarm-notify/alarm-queue.c
+++ b/calendar/alarm-notify/alarm-queue.c
@@ -1022,7 +1022,7 @@ edit_component (ECalClient *cal_client,
 	 *     How are other apps expected to know this stuff? */
 
 	source = e_client_get_source (E_CLIENT (cal_client));
-	source_uid = e_source_peek_uid (source);
+	source_uid = e_source_get_uid (source);
 
 	e_cal_component_get_uid (comp, &comp_uid);
 
diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c
index bf77f8c..0d0da22 100644
--- a/calendar/gui/dialogs/calendar-setup.c
+++ b/calendar/gui/dialogs/calendar-setup.c
@@ -68,7 +68,7 @@ eccp_check_complete (EConfig *ec,
 	const gchar *tmp;
 	ESource *source;
 
-	tmp = e_source_peek_name (sdialog->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;
@@ -233,7 +233,7 @@ name_changed (GtkEntry *entry,
 
 	name = gtk_entry_get_text (GTK_ENTRY (entry));
 
-	changed = g_strcmp0 (name, e_source_peek_name (source)) != 0;
+	changed = g_strcmp0 (name, e_source_get_display_name (source)) != 0;
 	e_source_set_name (source, name);
 
 	group = e_source_peek_group (source);
@@ -275,7 +275,7 @@ eccp_get_source_name (EConfig *ec,
 		G_CALLBACK (name_changed), (gpointer) t);
 
 	if (source)
-		gtk_entry_set_text (GTK_ENTRY (entry), e_source_peek_name (source));
+		gtk_entry_set_text (GTK_ENTRY (entry), e_source_get_display_name (source));
 
 	return entry;
 }
@@ -440,7 +440,7 @@ eccp_get_source_color (EConfig *ec,
 
 	if (!gdk_color_parse (color_spec, &color))
 		g_warning ("Unknown color \"%s\" in calendar \"%s\"",
-			color_spec, e_source_peek_name (sdialog->source));
+			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);
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 641666b..033d80a 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -957,7 +957,7 @@ action_save_cb (GtkAction *action,
 		e_alert_submit (
 			E_ALERT_SINK (editor),
 			"calendar:prompt-read-only-cal-editor",
-			e_source_peek_name (
+			e_source_get_display_name (
 				e_client_get_source (E_CLIENT (priv->cal_client))),
 			NULL);
 		return;
@@ -969,7 +969,7 @@ action_save_cb (GtkAction *action,
 		e_alert_submit (
 			E_ALERT_SINK (editor),
 			"calendar:prompt-no-task-assignment-editor",
-			e_source_peek_name (
+			e_source_get_display_name (
 				e_client_get_source (E_CLIENT (priv->cal_client))),
 			NULL);
 		return;
@@ -2184,7 +2184,7 @@ prompt_and_save_changes (CompEditor *editor,
 			e_alert_submit (
 				E_ALERT_SINK (editor),
 				"calendar:prompt-read-only-cal-editor",
-				e_source_peek_name (
+				e_source_get_display_name (
 					e_client_get_source (E_CLIENT (priv->cal_client))),
 				NULL);
 			/* don't discard changes when selected readonly calendar */
@@ -2197,7 +2197,7 @@ prompt_and_save_changes (CompEditor *editor,
 			e_alert_submit (
 				E_ALERT_SINK (editor),
 				"calendar:prompt-no-task-assignment-editor",
-				e_source_peek_name (
+				e_source_get_display_name (
 					e_client_get_source (E_CLIENT (priv->cal_client))),
 				NULL);
 			return FALSE;
diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c
index 7805548..e42bbc7 100644
--- a/calendar/gui/dialogs/e-send-options-utils.c
+++ b/calendar/gui/dialogs/e-send-options-utils.c
@@ -51,7 +51,7 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
 	else
 		source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	source = e_source_list_peek_source_by_uid (source_list, uid);
 
 		/* priority */
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 086f3ef..a3c2b49 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -2889,10 +2889,12 @@ event_page_send_options_clicked_cb (EventPage *epage)
 
 	if (!priv->sod) {
 		priv->sod = e_send_options_dialog_new ();
-		source = e_source_combo_box_get_active (
+		source = e_source_combo_box_ref_active (
 			E_SOURCE_COMBO_BOX (priv->source_selector));
-		e_send_options_utils_set_default_data (priv->sod, source, "calendar");
+		e_send_options_utils_set_default_data (
+			priv->sod, source, "calendar");
 		priv->sod->data->initialized = TRUE;
+		g_object_unref (source);
 	}
 
 	if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) {
@@ -2939,7 +2941,7 @@ epage_client_opened_cb (GObject *source_object,
 			NULL, GTK_DIALOG_MODAL,
 			GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
 			_("Unable to open the calendar '%s': %s"),
-			e_source_peek_name (source),
+			e_source_get_display_name (source),
 			error->message);
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
@@ -2987,7 +2989,8 @@ source_changed_cb (ESourceComboBox *source_combo_box,
 	if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (epage)))
 		return;
 
-	source = e_source_combo_box_get_active (source_combo_box);
+	source = e_source_combo_box_ref_active (source_combo_box);
+	g_return_if_fail (source != NULL);
 
 	if (priv->open_cancellable) {
 		g_cancellable_cancel (priv->open_cancellable);
@@ -2995,9 +2998,13 @@ source_changed_cb (ESourceComboBox *source_combo_box,
 	}
 	priv->open_cancellable = g_cancellable_new ();
 
-	e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, priv->open_cancellable,
-				 e_client_utils_authenticate_handler, NULL,
-				 epage_client_opened_cb, epage);
+	e_client_utils_open_new (
+		source, E_CLIENT_SOURCE_TYPE_EVENTS,
+		FALSE, priv->open_cancellable,
+		e_client_utils_authenticate_handler, NULL,
+		epage_client_opened_cb, epage);
+
+	g_object_unref (source);
 }
 
 static void
@@ -3305,7 +3312,8 @@ init_widgets (EventPage *epage)
 	g_signal_connect (
 		priv->alarm_dialog, "delete-event",
 		G_CALLBACK (gtk_widget_hide), priv->alarm_dialog);
-	priv->alarm_list_dlg_widget = alarm_list_dialog_peek (client, priv->alarm_list_store);
+	priv->alarm_list_dlg_widget = alarm_list_dialog_peek (
+		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);
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 5348a19..58d3d3b 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -947,7 +947,7 @@ mpage_client_opened_cb (GObject *source_object,
 		dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
 						 GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
 						 _("Unable to open memos in '%s': %s"),
-						 e_source_peek_name (source),
+						 e_source_get_display_name (source),
 						 error ? error->message : _("Unknown error"));
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
@@ -993,7 +993,8 @@ source_changed_cb (ESourceComboBox *source_combo_box,
 	if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (mpage)))
 		return;
 
-	source = e_source_combo_box_get_active (source_combo_box);
+	source = e_source_combo_box_ref_active (source_combo_box);
+	g_return_if_fail (source != NULL);
 
 	if (priv->open_cancellable) {
 		g_cancellable_cancel (priv->open_cancellable);
@@ -1001,9 +1002,13 @@ source_changed_cb (ESourceComboBox *source_combo_box,
 	}
 	priv->open_cancellable = g_cancellable_new ();
 
-	e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, priv->open_cancellable,
-				 e_client_utils_authenticate_handler, NULL,
-				 mpage_client_opened_cb, mpage);
+	e_client_utils_open_new (
+		source, E_CLIENT_SOURCE_TYPE_MEMOS,
+		FALSE, priv->open_cancellable,
+		e_client_utils_authenticate_handler, NULL,
+		mpage_client_opened_cb, mpage);
+
+	g_object_unref (source);
 }
 
 static void
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 71a4945..9e051af 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -1775,7 +1775,7 @@ tpage_client_opened_cb (GObject *source_object,
 			NULL, GTK_DIALOG_MODAL,
 			GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
 			_("Unable to open tasks in '%s': %s"),
-			e_source_peek_name (source),
+			e_source_get_display_name (source),
 			error->message);
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
@@ -1824,7 +1824,8 @@ source_changed_cb (ESourceComboBox *source_combo_box,
 	if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage)))
 		return;
 
-	source = e_source_combo_box_get_active (source_combo_box);
+	source = e_source_combo_box_ref_active (source_combo_box);
+	g_return_if_fail (source != NULL);
 
 	if (priv->open_cancellable) {
 		g_cancellable_cancel (priv->open_cancellable);
@@ -1837,6 +1838,8 @@ source_changed_cb (ESourceComboBox *source_combo_box,
 		FALSE, priv->open_cancellable,
 		e_client_utils_authenticate_handler, NULL,
 		tpage_client_opened_cb, tpage);
+
+	g_object_unref (source);
 }
 
 static void
@@ -1880,9 +1883,11 @@ task_page_send_options_clicked_cb (TaskPage *tpage)
 	if (!priv->sod) {
 		priv->sod = e_send_options_dialog_new ();
 		priv->sod->data->initialized = TRUE;
-		source = e_source_combo_box_get_active (
+		source = e_source_combo_box_ref_active (
 			E_SOURCE_COMBO_BOX (priv->source_selector));
-		e_send_options_utils_set_default_data (priv->sod, source, "task");
+		e_send_options_utils_set_default_data (
+			priv->sod, source, "task");
+		g_object_unref (source);
 	}
 
 	if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) {
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index c96a9e0..4b727d4 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -109,7 +109,7 @@ update_comp_info (ECalComponentPreview *preview,
 		gint comp_sequence;
 
 		source = e_client_get_source (E_CLIENT (client));
-		cal_uid = g_strdup (e_source_peek_uid (source));
+		cal_uid = g_strdup (e_source_get_uid (source));
 		e_cal_component_get_uid (comp, &uid);
 		comp_uid = g_strdup (uid);
 		e_cal_component_get_last_modified (comp, &itm);
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 20dee7f..d56b758 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -2942,7 +2942,7 @@ client_opened_cb (GObject *source_object,
 		g_warning (
 			"%s: Failed to open '%s': %s",
 			G_STRFUNC,
-			e_source_peek_name (source),
+			e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 		e_cal_model_update_status_message (model, NULL, -1.0);
@@ -3017,7 +3017,7 @@ add_new_client (ECalModel *model,
 		gchar *msg;
 
 		source = e_client_get_source (E_CLIENT (client));
-		display_name = e_source_peek_name (source);
+		display_name = e_source_get_display_name (source);
 		msg = g_strdup_printf (_("Opening %s"), display_name);
 		e_cal_model_update_status_message (model, msg, -1.0);
 		g_free (msg);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 17d5a43..24ea98a 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1517,7 +1517,7 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view,
 
 		widget = e_alert_dialog_new_for_args (
 			parent, "calendar:prompt-read-only-cal",
-			e_source_peek_name (source),
+			e_source_get_display_name (source),
 			NULL);
 
 		g_signal_connect (
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 7b4fecf..ad7fd78 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -7909,7 +7909,7 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
 		gchar *tmp;
 
 		source = e_client_get_source (E_CLIENT (event->comp_data->client));
-		source_uid = e_source_peek_uid (source);
+		source_uid = e_source_get_uid (source);
 
 		tmp = g_strconcat (source_uid, "\n", comp_str, NULL);
 		target = gtk_selection_data_get_target (selection_data);
diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c
index b314766..651ef83 100644
--- a/calendar/gui/e-task-table.c
+++ b/calendar/gui/e-task-table.c
@@ -1692,7 +1692,7 @@ hide_completed_rows_ready (GObject *source_object,
 
 			g_debug ("%s: Could not get the objects from '%s': %s",
 				G_STRFUNC,
-				source ? e_source_peek_name (source) : "???",
+				source ? e_source_get_display_name (source) : "???",
 				error ? error->message : "Uknown error");
 		}
 		g_clear_error (&error);
@@ -1754,7 +1754,7 @@ show_completed_rows_ready (GObject *source_object,
 
 			g_debug ("%s: Could not get the objects from '%s': %s",
 				G_STRFUNC,
-				source ? e_source_peek_name (source) : "???",
+				source ? e_source_get_display_name (source) : "???",
 				error ? error->message : "Uknown error");
 		}
 		g_clear_error (&error);
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index 9432bc3..9723236 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -255,20 +255,37 @@ static void
 button_toggled_cb (GtkWidget *widget,
                    struct _selector_data *sd)
 {
-	g_datalist_set_data_full(&sd->target->data, "primary-source",
-				 g_object_ref (e_source_selector_get_primary_selection ((ESourceSelector *) sd->selector)),
-				 g_object_unref);
-	g_datalist_set_data(&sd->target->data, "primary-type", GINT_TO_POINTER(import_type_map[sd->page]));
-	gtk_notebook_set_current_page ((GtkNotebook *) sd->notebook, sd->page);
+	ESourceSelector *selector;
+	ESource *source;
+	GtkNotebook *notebook;
+
+	selector = E_SOURCE_SELECTOR (sd->selector);
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
+
+	g_datalist_set_data_full (
+		&sd->target->data, "primary-source",
+		source, (GDestroyNotify) g_object_unref);
+	g_datalist_set_data (
+		&sd->target->data, "primary-type",
+		GINT_TO_POINTER (import_type_map[sd->page]));
+
+	notebook = GTK_NOTEBOOK (sd->notebook);
+	gtk_notebook_set_current_page (notebook, sd->page);
 }
 
 static void
 primary_selection_changed_cb (ESourceSelector *selector,
                               EImportTarget *target)
 {
-	g_datalist_set_data_full(&target->data, "primary-source",
-				 g_object_ref (e_source_selector_get_primary_selection (selector)),
-				 g_object_unref);
+	ESource *source;
+
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
+
+	g_datalist_set_data_full (
+		&target->data, "primary-source",
+		source, (GDestroyNotify) g_object_unref);
 }
 
 static GtkWidget *
@@ -436,7 +453,9 @@ ivcal_import (EImport *ei,
 	ici->cancellable = g_cancellable_new ();
 	e_import_status (ei, target, _("Opening calendar"), 0);
 
-	e_client_utils_open_new (g_datalist_get_data(&target->data, "primary-source"), type, FALSE, ici->cancellable,
+	e_client_utils_open_new (
+		g_datalist_get_data (&target->data, "primary-source"),
+		type, FALSE, ici->cancellable,
 		e_client_utils_authenticate_handler, NULL,
 		ivcal_opened, ici);
 }
@@ -841,6 +860,7 @@ open_default_source (ICalIntelligentImporter *ici,
 	ESource *source;
 	ECalClient *cal_client;
 	GError *error = NULL;
+	EClientSourceType client_source_type;
 	struct OpenDefaultSourceData *odsd;
 
 	g_return_if_fail (ici != NULL);
@@ -863,6 +883,20 @@ open_default_source (ICalIntelligentImporter *ici,
 	source = g_object_ref (source);
 	g_object_unref (cal_client);
 
+	switch (source_type) {
+		case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+			client_source_type = E_CLIENT_SOURCE_TYPE_EVENTS;
+			break;
+		case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+			client_source_type = E_CLIENT_SOURCE_TYPE_TASKS;
+			break;
+		case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+			client_source_type = E_CLIENT_SOURCE_TYPE_MEMOS;
+			break;
+		default:
+			g_return_if_reached ();
+	}
+
 	odsd = g_new0 (struct OpenDefaultSourceData, 1);
 	odsd->ici = ici;
 	odsd->opened_cb = opened_cb;
@@ -870,7 +904,7 @@ open_default_source (ICalIntelligentImporter *ici,
 	e_import_status (ici->ei, ici->target, _("Opening calendar"), 0);
 
 	e_client_utils_open_new (
-		source, source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS : E_CLIENT_SOURCE_TYPE_TASKS, FALSE, ici->cancellable,
+		source, client_source_type, FALSE, ici->cancellable,
 		e_client_utils_authenticate_handler, NULL,
 		default_source_opened_cb, odsd);
 
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index 7ee0a86..677db7e 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -309,7 +309,7 @@ setup_yahoo_account (MailAccountView *mav)
 		e_source_group_add_source (sgrp, calendar, -1);
 		e_source_list_sync (slist, NULL);
 
-		add_selected_calendar (e_source_peek_uid (calendar));
+		add_selected_calendar (e_source_get_uid (calendar));
 
 		g_free (abs_uri);
 		g_free (rel_uri);
@@ -400,7 +400,7 @@ setup_google_accounts (MailAccountView *mav)
 
 		e_source_list_sync (slist, NULL);
 
-		add_selected_calendar (e_source_peek_uid (calendar));
+		add_selected_calendar (e_source_get_uid (calendar));
 
 		g_free (abs_uri);
 		g_free (rel_uri);
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 109ee1b..7157351 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -1456,7 +1456,7 @@ e_binding_transform_source_to_uid (GBinding *binding,
 
 	source = g_value_get_object (source_value);
 	if (E_IS_SOURCE (source)) {
-		string = e_source_peek_uid (source);
+		string = e_source_get_uid (source);
 		g_value_set_string (target_value, string);
 		success = TRUE;
 	}
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index fcf24a8..5390ae7 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -494,8 +494,8 @@ search_address_in_addressbooks (const gchar *address,
 		const gchar *uid;
 		GError *err = NULL;
 
-		uid = e_source_peek_uid (source);
-		display_name = e_source_peek_name (source);
+		uid = e_source_get_uid (source);
+		display_name = e_source_get_display_name (source);
 
 		/* failed to load this book last time, skip it now */
 		if (g_hash_table_lookup (emu_broken_books_hash, uid) != NULL) {
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 74a3d5b..a84691e 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -5411,7 +5411,7 @@ setup_google_calendar (EMAccountEditor *emae)
 	array = g_ptr_array_new ();
 	for (i = 0; ids[i] != NULL; i++)
 		g_ptr_array_add (array, ids[i]);
-	g_ptr_array_add (array, (gpointer) e_source_peek_uid (calendar));
+	g_ptr_array_add (array, (gpointer) e_source_get_uid (calendar));
 	g_ptr_array_add (array, NULL);
 	g_settings_set_strv (
 		settings, SELECTED_CALENDARS,
@@ -5483,7 +5483,7 @@ setup_yahoo_calendar (EMAccountEditor *emae)
 	array = g_ptr_array_new ();
 	for (i = 0; ids[i] != NULL; i++)
 		g_ptr_array_add (array, ids[i]);
-	g_ptr_array_add (array, (gpointer) e_source_peek_uid (calendar));
+	g_ptr_array_add (array, (gpointer) e_source_get_uid (calendar));
 	g_ptr_array_add (array, NULL);
 	g_settings_set_strv (
 		settings, SELECTED_CALENDARS,
diff --git a/modules/addressbook/addressbook-config.c b/modules/addressbook/addressbook-config.c
index beccf33..7e09c1b 100644
--- a/modules/addressbook/addressbook-config.c
+++ b/modules/addressbook/addressbook-config.c
@@ -482,7 +482,7 @@ eabc_type_changed (GtkComboBox *dropdown,
 		}
 
 		e_source_set_property(sdialog->source, "auth-domain", "Groupwise");
-		tmp = g_strconcat (";", e_source_peek_name(sdialog->source), NULL);
+		tmp = g_strconcat (";", e_source_get_display_name(sdialog->source), NULL);
 		e_source_set_relative_uri (sdialog->source, tmp);
 		g_free (tmp);
 #ifdef HAVE_LDAP
@@ -499,7 +499,7 @@ eabc_type_changed (GtkComboBox *dropdown,
 		e_source_set_property(sdialog->source, "limit", "100");
 #endif
 	} else {
-		e_source_set_relative_uri (sdialog->source, e_source_peek_uid (sdialog->source));
+		e_source_set_relative_uri (sdialog->source, e_source_get_uid (sdialog->source));
 	}
 
 	e_config_target_changed ((EConfig *) sdialog->config, E_CONFIG_TARGET_CHANGED_REBUILD);
@@ -573,7 +573,7 @@ name_changed_cb (GtkWidget *w,
 	text = gtk_entry_get_text (GTK_ENTRY (sdialog->display_name));
 
 	stripped_name = g_strstrip (g_strdup (text));
-	changed = g_strcmp0 (stripped_name, e_source_peek_name (sdialog->source)) != 0;
+	changed = g_strcmp0 (stripped_name, e_source_get_display_name (sdialog->source)) != 0;
 	e_source_set_name (sdialog->source, stripped_name);
 	g_free (stripped_name);
 
@@ -607,7 +607,7 @@ eabc_general_name (EConfig *ec,
 	g_signal_connect (
 		sdialog->display_name, "changed",
 		G_CALLBACK (name_changed_cb), sdialog);
-	gtk_entry_set_text ((GtkEntry *) sdialog->display_name, e_source_peek_name (sdialog->source));
+	gtk_entry_set_text ((GtkEntry *) sdialog->display_name, e_source_get_display_name (sdialog->source));
 
 	/* Hardcoded: groupwise can't edit the name (or anything else) */
 	if (sdialog->original_source) {
@@ -1204,7 +1204,7 @@ eabc_check_complete (EConfig *ec,
 
 	d(printf("check complete, pageid = '%s'\n", pageid?pageid:"<all>"));
 	/* have name, and unique */
-	tmp = e_source_peek_name (sdialog->source);
+	tmp = e_source_get_display_name (sdialog->source);
 	valid = tmp && tmp[0] != 0
 		&& ((source = e_source_group_peek_source_by_name (sdialog->source_group, tmp)) == NULL
 		    || source == sdialog->original_source);
@@ -1349,7 +1349,7 @@ addressbook_config_edit_source (GtkWidget *parent,
 
 	/* forces initial validation */
 	if (!sdialog->original_source) {
-		e_source_set_relative_uri (sdialog->source, e_source_peek_uid (sdialog->source));
+		e_source_set_relative_uri (sdialog->source, e_source_get_uid (sdialog->source));
 		e_config_target_changed ((EConfig *) ec, E_CONFIG_TARGET_CHANGED_STATE);
 	}
 
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index af28f8b..d47dbd7 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -151,25 +151,30 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	ESource *source;
 	gboolean can_delete = FALSE;
 	gboolean is_system = FALSE;
+	gboolean has_primary_source = FALSE;
 	guint32 state = 0;
 
 	book_shell_sidebar = E_BOOK_SHELL_SIDEBAR (shell_sidebar);
 	selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 
 	if (source != NULL) {
 		const gchar *uri;
 		const gchar *delete;
 
+		has_primary_source = TRUE;
+
 		uri = e_source_peek_relative_uri (source);
 		is_system = (uri == NULL || strcmp (uri, "system") == 0);
 
 		can_delete = !is_system;
 		delete = e_source_get_property (source, "delete");
 		can_delete &= (delete == NULL || strcmp (delete, "no") != 0);
+
+		g_object_unref (source);
 	}
 
-	if (source != NULL)
+	if (has_primary_source)
 		state |= E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
 	if (can_delete)
 		state |= E_BOOK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 33c382b..5083411 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -73,20 +73,23 @@ action_address_book_delete_cb (GtkAction *action,
 
 	book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
 	selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (source != NULL);
 
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"addressbook:ask-delete-addressbook",
-		e_source_peek_name (source), NULL);
+		e_source_get_display_name (source), NULL);
 
-	if (response != GTK_RESPONSE_YES)
+	if (response != GTK_RESPONSE_YES) {
+		g_object_unref (source);
 		return;
+	}
 
 	book = e_book_client_new (source, &error);
 	if (error != NULL) {
 		g_warning ("Error removing addressbook: %s", error->message);
+		g_object_unref (source);
 		g_error_free (error);
 		return;
 	}
@@ -95,6 +98,7 @@ action_address_book_delete_cb (GtkAction *action,
 		e_alert_run_dialog_for_args (
 			GTK_WINDOW (shell_window),
 			"addressbook:remove-addressbook", NULL);
+		g_object_unref (source);
 		g_object_unref (book);
 		return;
 	}
@@ -107,6 +111,7 @@ action_address_book_delete_cb (GtkAction *action,
 
 	e_source_list_sync (source_list, NULL);
 
+	g_object_unref (source);
 	g_object_unref (book);
 }
 
@@ -187,10 +192,10 @@ action_address_book_properties_cb (GtkAction *action,
 
 	book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
 	selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (source != NULL);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	uid_to_editor = book_shell_view->priv->uid_to_editor;
 
 	closure = g_hash_table_lookup (uid_to_editor, uid);
@@ -213,6 +218,8 @@ action_address_book_properties_cb (GtkAction *action,
 	}
 
 	gtk_window_present (GTK_WINDOW (closure->editor));
+
+	g_object_unref (source);
 }
 
 #ifdef WITH_CONTACT_MAPS
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 3c3b1a9..62793f3 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -271,12 +271,12 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
 	book_shell_content = book_shell_view->priv->book_shell_content;
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 
 	if (source == NULL)
 		return;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	hash_table = book_shell_view->priv->uid_to_view;
 	widget = g_hash_table_lookup (hash_table, uid);
 
@@ -339,7 +339,8 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
 		model = e_addressbook_view_get_model (view);
 
 		/* XXX No way to cancel this? */
-		e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
+		e_client_utils_open_new (
+			source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
 			e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
 			book_shell_view_loaded_cb, g_object_ref (view));
 
@@ -380,6 +381,8 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
 
 	e_addressbook_model_force_folder_bar_message (model);
 	selection_change (book_shell_view, view);
+
+	g_object_unref (source);
 }
 
 static gboolean
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index 3b18f42..403345d 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -183,7 +183,7 @@ attachment_handler_import_event (GObject *source_object,
 		g_warn_if_fail (client == NULL);
 		g_warning (
 			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_object_unref (attachment);
 		g_error_free (error);
@@ -239,7 +239,7 @@ attachment_handler_import_todo (GObject *source_object,
 		g_warn_if_fail (client == NULL);
 		g_warning (
 			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_object_unref (attachment);
 		g_error_free (error);
@@ -354,18 +354,20 @@ attachment_handler_run_dialog (GtkWindow *parent,
 	if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
 		goto exit;
 
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 	if (source == NULL)
 		goto exit;
 
 	switch (source_type) {
 	case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
-		e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
+		e_client_utils_open_new (
+			source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
 			e_client_utils_authenticate_handler, NULL,
 			attachment_handler_import_event, g_object_ref (attachment));
 		break;
 	case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
-		e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
+		e_client_utils_open_new (
+			source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, NULL,
 			e_client_utils_authenticate_handler, NULL,
 			attachment_handler_import_todo, g_object_ref (attachment));
 		break;
@@ -373,6 +375,8 @@ attachment_handler_run_dialog (GtkWindow *parent,
 		break;
 	}
 
+	g_object_unref (source);
+
  exit:
 	gtk_widget_destroy (dialog);
 }
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index d538e9b..e73eca5 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -163,7 +163,7 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
 		if (primary == NULL && selected == NULL) {
 			const gchar *uid;
 
-			uid = e_source_peek_uid (source);
+			uid = e_source_get_uid (source);
 			selected = g_slist_prepend (NULL, g_strdup (uid));
 
 			e_shell_settings_set_string (
@@ -260,7 +260,7 @@ cal_shell_backend_new_event (ESource *source,
 		g_warn_if_fail (client == NULL);
 		g_warning (
 			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 		return;
@@ -641,7 +641,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
 	if (error != NULL) {
 		g_warning (
 			"%s: Failed to create/open client '%s': %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_object_unref (source_list);
 		g_error_free (error);
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index dd76049..7eb69ed 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -176,9 +176,9 @@ create_calendar_sources (EShellBackend *shell_backend,
 
 			e_shell_settings_set_string (
 				shell_settings, "cal-primary-calendar",
-				e_source_peek_uid (source));
+				e_source_get_uid (source));
 
-			link.data = (gpointer) e_source_peek_uid (source);
+			link.data = (gpointer) e_source_get_uid (source);
 			link.next = NULL;
 
 			e_cal_shell_backend_set_selected_calendars (
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 633942d..468db23 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -131,7 +131,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 
 	g_object_ref (source);
 
@@ -167,7 +167,7 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
 		E_ALERT_SINK (shell_content),
 		"calendar:backend-error",
 		e_source_group_peek_name (source_group),
-		e_source_peek_name (source), message, NULL);
+		e_source_get_display_name (source), message, NULL);
 }
 
 static void
@@ -281,7 +281,7 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
 		case E_CLIENT_ERROR_BUSY:
 			g_warning (
 				"%s: Cannot open '%s', it's busy (%s)",
-				G_STRFUNC, e_source_peek_name (source),
+				G_STRFUNC, e_source_get_display_name (source),
 				error->message);
 			g_clear_error (&error);
 			return;
@@ -422,7 +422,7 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
 		priv->loading_default_client = NULL;
 	}
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (priv->client_table, uid);
 
 	/* If we already have an open connection for
@@ -456,20 +456,22 @@ cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar,
 	ESource *source;
 
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
-	source = e_source_selector_get_source_by_path (selector, tree_path);
+	source = e_source_selector_ref_source_by_path (selector, tree_path);
 
 	/* XXX This signal gets emitted a lot while the model is being
 	 *     rebuilt, during which time we won't get a valid ESource.
 	 *     ESourceSelector should probably block this signal while
 	 *     rebuilding the model, but we'll be forgiving and not
 	 *     emit a warning. */
-	if (!E_IS_SOURCE (source))
+	if (source == NULL)
 		return;
 
 	if (e_source_selector_source_is_selected (selector, source))
 		e_cal_shell_sidebar_add_source (cal_shell_sidebar, source);
 	else
 		e_cal_shell_sidebar_remove_source (cal_shell_sidebar, source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -494,7 +496,7 @@ cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
 	for (iter = list; iter != NULL; iter = iter->next) {
 		ESource *source = iter->data;
 
-		iter->data = (gpointer) e_source_peek_uid (source);
+		iter->data = (gpointer) e_source_get_uid (source);
 		g_object_unref (source);
 	}
 
@@ -510,11 +512,13 @@ cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_side
 {
 	ESource *source;
 
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 	if (source == NULL)
 		return;
 
 	cal_shell_sidebar_set_default (cal_shell_sidebar, source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -816,17 +820,20 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	gboolean can_delete = FALSE;
 	gboolean is_system = FALSE;
 	gboolean refresh_supported = FALSE;
+	gboolean has_primary_source = FALSE;
 	guint32 state = 0;
 
 	cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 
 	if (source != NULL) {
 		ECalClient *client;
 		const gchar *uri;
 		const gchar *delete;
 
+		has_primary_source = TRUE;
+
 		uri = e_source_peek_relative_uri (source);
 		is_system = (uri == NULL || strcmp (uri, "system") == 0);
 
@@ -836,12 +843,14 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 
 		client = g_hash_table_lookup (
 			cal_shell_sidebar->priv->client_table,
-			e_source_peek_uid (source));
+			e_source_get_uid (source));
 		refresh_supported =
 			client && e_client_check_refresh_supported (E_CLIENT (client));
+
+		g_object_unref (source);
 	}
 
-	if (source != NULL)
+	if (has_primary_source)
 		state |= E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
 	if (can_delete)
 		state |= E_CAL_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
@@ -870,8 +879,7 @@ cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar,
 		NULL, NULL, cal_shell_sidebar);
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
-	g_return_if_fail (uid != NULL);
+	uid = e_source_get_uid (source);
 
 	g_hash_table_remove (client_table, uid);
 	e_source_selector_unselect_source (selector, source);
@@ -1069,7 +1077,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
 	default_client = cal_shell_sidebar->priv->default_client;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client != NULL)
@@ -1080,7 +1088,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
 		const gchar *default_uid;
 
 		default_source = e_client_get_source (E_CLIENT (default_client));
-		default_uid = e_source_peek_uid (default_source);
+		default_uid = e_source_get_uid (default_source);
 
 		if (g_strcmp0 (uid, default_uid) == 0)
 			client = g_object_ref (default_client);
@@ -1146,7 +1154,7 @@ e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar,
 
 	client_table = cal_shell_sidebar->priv->client_table;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client == NULL)
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index d73feef..e5db338 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -46,12 +46,14 @@ action_calendar_copy_cb (GtkAction *action,
 
 	cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	copy_source_dialog (
 		GTK_WINDOW (shell_window),
 		source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS);
+
+	g_object_unref (source);
 }
 
 static void
@@ -88,16 +90,18 @@ action_calendar_delete_cb (GtkAction *action,
 
 	cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	/* Ask for confirmation. */
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"calendar:prompt-delete-calendar",
-		e_source_peek_name (source), NULL);
-	if (response != GTK_RESPONSE_YES)
+		e_source_get_display_name (source), NULL);
+	if (response != GTK_RESPONSE_YES) {
+		g_object_unref (source);
 		return;
+	}
 
 	uri = e_source_get_uri (source);
 	client = e_cal_model_get_client_for_uri (model, uri);
@@ -114,6 +118,7 @@ action_calendar_delete_cb (GtkAction *action,
 		g_warning (
 			"%s: Failed to remove client: %s",
 			G_STRFUNC, error->message);
+		g_object_unref (source);
 		g_error_free (error);
 		return;
 	}
@@ -138,6 +143,8 @@ action_calendar_delete_cb (GtkAction *action,
 			G_STRFUNC, error->message);
 		g_error_free (error);
 	}
+
+	g_object_unref (source);
 }
 
 static void
@@ -282,13 +289,15 @@ action_calendar_properties_cb (GtkAction *action,
 
 	cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	/* XXX Does this -really- need a source group parameter? */
 	calendar_setup_edit_calendar (
 		GTK_WINDOW (shell_window), source,
 		e_source_peek_group (source));
+
+	g_object_unref (source);
 }
 
 static void
@@ -384,15 +393,17 @@ action_calendar_refresh_cb (GtkAction *action,
 	model = e_cal_shell_content_get_model (cal_shell_content);
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	uri = e_source_get_uri (source);
 	client = e_cal_model_get_client_for_uri (model, uri);
 	g_free (uri);
 
-	if (client == NULL)
+	if (client == NULL) {
+		g_object_unref (source);
 		return;
+	}
 
 	g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
 
@@ -401,10 +412,12 @@ action_calendar_refresh_cb (GtkAction *action,
 	if (error != NULL) {
 		g_warning (
 			"%s: Failed to refresh '%s', %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 	}
+
+	g_object_unref (source);
 }
 
 static void
@@ -452,10 +465,12 @@ action_calendar_select_one_cb (GtkAction *action,
 	cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 
-	primary = e_source_selector_get_primary_selection (selector);
+	primary = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (primary != NULL);
 
 	e_source_selector_select_exclusive (selector, primary);
+
+	g_object_unref (primary);
 }
 
 static void
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 2bdd3ef..127473d 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -151,7 +151,7 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
 		if (primary == NULL && selected == NULL) {
 			const gchar *uid;
 
-			uid = e_source_peek_uid (source);
+			uid = e_source_get_uid (source);
 			selected = g_slist_prepend (NULL, g_strdup (uid));
 
 			e_shell_settings_set_string (
@@ -193,7 +193,7 @@ memo_shell_backend_new_memo (ESource *source,
 		g_warn_if_fail (client == NULL);
 		g_warning (
 			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 		return;
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index 528db09..24f7a68 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -124,7 +124,7 @@ memo_shell_content_table_foreach_cb (gint model_row,
 		const gchar *source_uid;
 
 		source = e_client_get_source (E_CLIENT (comp_data->client));
-		source_uid = e_source_peek_uid (source);
+		source_uid = e_source_get_uid (source);
 
 		foreach_data->list = g_slist_prepend (
 			foreach_data->list,
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index 64b5263..efa0716 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -134,9 +134,9 @@ create_memo_sources (EShellBackend *shell_backend,
 
 			e_shell_settings_set_string (
 				shell_settings, "cal-primary-memo-list",
-				e_source_peek_uid (source));
+				e_source_get_uid (source));
 
-			link.data = (gpointer) e_source_peek_uid (source);
+			link.data = (gpointer) e_source_get_uid (source);
 			link.next = NULL;
 
 			e_memo_shell_backend_set_selected_memo_lists (
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 4a012c7..7e209c5 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -127,7 +127,7 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 
 	g_object_ref (source);
 
@@ -163,7 +163,7 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
 		E_ALERT_SINK (shell_content),
 		"calendar:backend-error",
 		e_source_group_peek_name (source_group),
-		e_source_peek_name (source), message, NULL);
+		e_source_get_display_name (source), message, NULL);
 }
 
 static void
@@ -276,7 +276,7 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
 		case E_CLIENT_ERROR_BUSY:
 			g_warning (
 				"%s: Cannot open '%s', it's busy (%s)",
-				G_STRFUNC, e_source_peek_name (source),
+				G_STRFUNC, e_source_get_display_name (source),
 				error->message);
 			g_clear_error (&error);
 			return;
@@ -417,7 +417,7 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
 		priv->loading_default_client = NULL;
 	}
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (priv->client_table, uid);
 
 	/* If we already have an open connection for
@@ -451,20 +451,22 @@ memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
 	ESource *source;
 
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
-	source = e_source_selector_get_source_by_path (selector, tree_path);
+	source = e_source_selector_ref_source_by_path (selector, tree_path);
 
 	/* XXX This signal gets emitted a lot while the model is being
 	 *     rebuilt, during which time we won't get a valid ESource.
 	 *     ESourceSelector should probably block this signal while
 	 *     rebuilding the model, but we'll be forgiving and not
 	 *     emit a warning. */
-	if (!E_IS_SOURCE (source))
+	if (source == NULL)
 		return;
 
 	if (e_source_selector_source_is_selected (selector, source))
 		e_memo_shell_sidebar_add_source (memo_shell_sidebar, source);
 	else
 		e_memo_shell_sidebar_remove_source (memo_shell_sidebar, source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -489,7 +491,7 @@ memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
 	for (iter = list; iter != NULL; iter = iter->next) {
 		ESource *source = iter->data;
 
-		iter->data = (gpointer) e_source_peek_uid (source);
+		iter->data = (gpointer) e_source_get_uid (source);
 		g_object_unref (source);
 	}
 
@@ -505,11 +507,13 @@ memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_s
 {
 	ESource *source;
 
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 	if (source == NULL)
 		return;
 
 	memo_shell_sidebar_set_default (memo_shell_sidebar, source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -721,17 +725,20 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	gboolean can_delete = FALSE;
 	gboolean is_system = FALSE;
 	gboolean refresh_supported = FALSE;
+	gboolean has_primary_source = FALSE;
 	guint32 state = 0;
 
 	memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar);
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 
 	if (source != NULL) {
 		ECalClient *client;
 		const gchar *uri;
 		const gchar *delete;
 
+		has_primary_source = TRUE;
+
 		uri = e_source_peek_relative_uri (source);
 		is_system = (uri == NULL || strcmp (uri, "system") == 0);
 
@@ -741,12 +748,14 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 
 		client = g_hash_table_lookup (
 			memo_shell_sidebar->priv->client_table,
-			e_source_peek_uid (source));
+			e_source_get_uid (source));
 		refresh_supported =
 			client && e_client_check_refresh_supported (E_CLIENT (client));
+
+		g_object_unref (source);
 	}
 
-	if (source != NULL)
+	if (has_primary_source)
 		state |= E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
 	if (can_delete)
 		state |= E_MEMO_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
@@ -775,8 +784,7 @@ memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
 		NULL, NULL, memo_shell_sidebar);
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
-	g_return_if_fail (uid != NULL);
+	uid = e_source_get_uid (source);
 
 	g_hash_table_remove (client_table, uid);
 	e_source_selector_unselect_source (selector, source);
@@ -956,7 +964,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
 	default_client = memo_shell_sidebar->priv->default_client;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client != NULL)
@@ -967,7 +975,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
 		const gchar *default_uid;
 
 		default_source = e_client_get_source (E_CLIENT (default_client));
-		default_uid = e_source_peek_uid (default_source);
+		default_uid = e_source_get_uid (default_source);
 
 		if (g_strcmp0 (uid, default_uid) == 0)
 			client = g_object_ref (default_client);
@@ -1033,7 +1041,7 @@ e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar,
 
 	client_table = memo_shell_sidebar->priv->client_table;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client == NULL)
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 5a99624..4c20259 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -116,12 +116,14 @@ action_memo_list_copy_cb (GtkAction *action,
 
 	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	copy_source_dialog (
 		GTK_WINDOW (shell_window),
 		source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS);
+
+	g_object_unref (source);
 }
 
 static void
@@ -156,16 +158,18 @@ action_memo_list_delete_cb (GtkAction *action,
 
 	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	/* Ask for confirmation. */
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"calendar:prompt-delete-memo-list",
-		e_source_peek_name (source), NULL);
-	if (response != GTK_RESPONSE_YES)
+		e_source_get_display_name (source), NULL);
+	if (response != GTK_RESPONSE_YES) {
+		g_object_unref (source);
 		return;
+	}
 
 	uri = e_source_get_uri (source);
 	client = e_cal_model_get_client_for_uri (model, uri);
@@ -182,6 +186,7 @@ action_memo_list_delete_cb (GtkAction *action,
 		g_warning (
 			"%s: Failed to remove client: %s",
 			G_STRFUNC, error->message);
+		g_object_unref (source);
 		g_error_free (error);
 		return;
 	}
@@ -203,6 +208,8 @@ action_memo_list_delete_cb (GtkAction *action,
 			G_STRFUNC, error->message);
 		g_error_free (error);
 	}
+
+	g_object_unref (source);
 }
 
 static void
@@ -262,10 +269,12 @@ action_memo_list_properties_cb (GtkAction *action,
 
 	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -287,15 +296,17 @@ action_memo_list_refresh_cb (GtkAction *action,
 	model = e_memo_shell_content_get_memo_model (memo_shell_content);
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	uri = e_source_get_uri (source);
 	client = e_cal_model_get_client_for_uri (model, uri);
 	g_free (uri);
 
-	if (client == NULL)
+	if (client == NULL) {
+		g_object_unref (source);
 		return;
+	}
 
 	g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
 
@@ -304,10 +315,12 @@ action_memo_list_refresh_cb (GtkAction *action,
 	if (error != NULL) {
 		g_warning (
 			"%s: Failed to refresh '%s', %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 	}
+
+	g_object_unref (source);
 }
 
 static void
@@ -334,10 +347,12 @@ action_memo_list_select_one_cb (GtkAction *action,
 	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 
-	primary = e_source_selector_get_primary_selection (selector);
+	primary = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (primary != NULL);
 
 	e_source_selector_select_exclusive (selector, primary);
+
+	g_object_unref (primary);
 }
 
 static void
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 1bb7ca3..786e9c6 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -147,7 +147,7 @@ task_shell_backend_ensure_sources (EShellBackend *shell_backend)
 		if (primary == NULL && selected == NULL) {
 			const gchar *uid;
 
-			uid = e_source_peek_uid (source);
+			uid = e_source_get_uid (source);
 			selected = g_slist_prepend (NULL, g_strdup (uid));
 
 			e_shell_settings_set_string (
@@ -189,7 +189,7 @@ task_shell_backend_new_task (ESource *source,
 		g_warn_if_fail (client == NULL);
 		g_warning (
 			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 		return;
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 67b1e36..0ebff79 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -124,7 +124,7 @@ task_shell_content_table_foreach_cb (gint model_row,
 		const gchar *source_uid;
 
 		source = e_client_get_source (E_CLIENT (comp_data->client));
-		source_uid = e_source_peek_uid (source);
+		source_uid = e_source_get_uid (source);
 
 		foreach_data->list = g_slist_prepend (
 			foreach_data->list,
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index 60499d6..c24f52d 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -143,9 +143,9 @@ create_task_sources (EShellBackend *shell_backend,
 
 			e_shell_settings_set_string (
 				shell_settings, "cal-primary-task-list",
-				e_source_peek_uid (source));
+				e_source_get_uid (source));
 
-			link.data = (gpointer) e_source_peek_uid (source);
+			link.data = (gpointer) e_source_get_uid (source);
 			link.next = NULL;
 
 			e_task_shell_backend_set_selected_task_lists (
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index a2ceb77..4667ae4 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -127,7 +127,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 
 	g_object_ref (source);
 
@@ -163,7 +163,7 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
 		E_ALERT_SINK (shell_content),
 		"calendar:backend-error",
 		e_source_group_peek_name (source_group),
-		e_source_peek_name (source), message, NULL);
+		e_source_get_display_name (source), message, NULL);
 }
 
 static void
@@ -276,7 +276,7 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
 		case E_CLIENT_ERROR_BUSY:
 			g_warning (
 				"%s: Cannot open '%s', it's busy (%s)",
-				G_STRFUNC, e_source_peek_name (source),
+				G_STRFUNC, e_source_get_display_name (source),
 				error->message);
 			g_clear_error (&error);
 			return;
@@ -417,7 +417,7 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
 		priv->loading_default_client = NULL;
 	}
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (priv->client_table, uid);
 
 	/* If we already have an open connection for
@@ -451,20 +451,22 @@ task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar,
 	ESource *source;
 
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
-	source = e_source_selector_get_source_by_path (selector, tree_path);
+	source = e_source_selector_ref_source_by_path (selector, tree_path);
 
 	/* XXX This signal gets emitted a lot while the model is being
 	 *     rebuilt, during which time we won't get a valid ESource.
 	 *     ESourceSelector should probably block this signal while
 	 *     rebuilding the model, but we'll be forgiving and not
 	 *     emit a warning. */
-	if (!E_IS_SOURCE (source))
+	if (source == NULL)
 		return;
 
 	if (e_source_selector_source_is_selected (selector, source))
 		e_task_shell_sidebar_add_source (task_shell_sidebar, source);
 	else
 		e_task_shell_sidebar_remove_source (task_shell_sidebar, source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -489,7 +491,7 @@ task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
 	for (iter = list; iter != NULL; iter = iter->next) {
 		ESource *source = iter->data;
 
-		iter->data = (gpointer) e_source_peek_uid (source);
+		iter->data = (gpointer) e_source_get_uid (source);
 		g_object_unref (source);
 	}
 
@@ -505,11 +507,13 @@ task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_s
 {
 	ESource *source;
 
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 	if (source == NULL)
 		return;
 
 	task_shell_sidebar_set_default (task_shell_sidebar, source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -721,17 +725,20 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	gboolean can_delete = FALSE;
 	gboolean is_system = FALSE;
 	gboolean refresh_supported = FALSE;
+	gboolean has_primary_source = FALSE;
 	guint32 state = 0;
 
 	task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar);
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
+	source = e_source_selector_ref_primary_selection (selector);
 
 	if (source != NULL) {
 		ECalClient *client;
 		const gchar *uri;
 		const gchar *delete_prop;
 
+		has_primary_source = TRUE;
+
 		uri = e_source_peek_relative_uri (source);
 		is_system = (uri == NULL || strcmp (uri, "system") == 0);
 
@@ -742,12 +749,14 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 
 		client = g_hash_table_lookup (
 			task_shell_sidebar->priv->client_table,
-			e_source_peek_uid (source));
+			e_source_get_uid (source));
 		refresh_supported = client &&
 			e_client_check_refresh_supported (E_CLIENT (client));
+
+		g_object_unref (source);
 	}
 
-	if (source != NULL)
+	if (has_primary_source)
 		state |= E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
 	if (can_delete)
 		state |= E_TASK_SHELL_SIDEBAR_CAN_DELETE_PRIMARY_SOURCE;
@@ -776,8 +785,7 @@ task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar,
 		NULL, NULL, task_shell_sidebar);
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
-	g_return_if_fail (uid != NULL);
+	uid = e_source_get_uid (source);
 
 	g_hash_table_remove (client_table, uid);
 	e_source_selector_unselect_source (selector, source);
@@ -957,7 +965,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
 	default_client = task_shell_sidebar->priv->default_client;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client != NULL)
@@ -968,7 +976,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
 		const gchar *default_uid;
 
 		default_source = e_client_get_source (E_CLIENT (default_client));
-		default_uid = e_source_peek_uid (default_source);
+		default_uid = e_source_get_uid (default_source);
 
 		if (g_strcmp0 (uid, default_uid) == 0)
 			client = g_object_ref (default_client);
@@ -1034,7 +1042,7 @@ e_task_shell_sidebar_remove_source (ETaskShellSidebar *task_shell_sidebar,
 
 	client_table = task_shell_sidebar->priv->client_table;
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
 	if (client == NULL)
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 7f4fd08..badfbf0 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -139,12 +139,14 @@ action_task_list_copy_cb (GtkAction *action,
 
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	copy_source_dialog (
 		GTK_WINDOW (shell_window),
 		source, E_CAL_CLIENT_SOURCE_TYPE_TASKS);
+
+	g_object_unref (source);
 }
 
 static void
@@ -179,16 +181,18 @@ action_task_list_delete_cb (GtkAction *action,
 
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	/* Ask for confirmation. */
 	response = e_alert_run_dialog_for_args (
 		GTK_WINDOW (shell_window),
 		"calendar:prompt-delete-task-list",
-		e_source_peek_name (source), NULL);
-	if (response != GTK_RESPONSE_YES)
+		e_source_get_display_name (source), NULL);
+	if (response != GTK_RESPONSE_YES) {
+		g_object_unref (source);
 		return;
+	}
 
 	uri = e_source_get_uri (source);
 	client = e_cal_model_get_client_for_uri (model, uri);
@@ -205,6 +209,7 @@ action_task_list_delete_cb (GtkAction *action,
 		g_warning (
 			"%s: Failed to remove client: %s",
 			G_STRFUNC, error->message);
+		g_object_unref (source);
 		g_error_free (error);
 		return;
 	}
@@ -226,6 +231,8 @@ action_task_list_delete_cb (GtkAction *action,
 			G_STRFUNC, error->message);
 		g_error_free (error);
 	}
+
+	g_object_unref (source);
 }
 
 static void
@@ -285,10 +292,12 @@ action_task_list_properties_cb (GtkAction *action,
 
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
+
+	g_object_unref (source);
 }
 
 static void
@@ -310,15 +319,17 @@ action_task_list_refresh_cb (GtkAction *action,
 	model = e_task_shell_content_get_task_model (task_shell_content);
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 
-	source = e_source_selector_get_primary_selection (selector);
-	g_return_if_fail (E_IS_SOURCE (source));
+	source = e_source_selector_ref_primary_selection (selector);
+	g_return_if_fail (source != NULL);
 
 	uri = e_source_get_uri (source);
 	client = e_cal_model_get_client_for_uri (model, uri);
 	g_free (uri);
 
-	if (client == NULL)
+	if (client == NULL) {
+		g_object_unref (source);
 		return;
+	}
 
 	g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
 
@@ -327,10 +338,12 @@ action_task_list_refresh_cb (GtkAction *action,
 	if (error != NULL) {
 		g_warning (
 			"%s: Failed to refresh '%s', %s",
-			G_STRFUNC, e_source_peek_name (source),
+			G_STRFUNC, e_source_get_display_name (source),
 			error->message);
 		g_error_free (error);
 	}
+
+	g_object_unref (source);
 }
 
 static void
@@ -357,10 +370,12 @@ action_task_list_select_one_cb (GtkAction *action,
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 
-	primary = e_source_selector_get_primary_selection (selector);
+	primary = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (primary != NULL);
 
 	e_source_selector_select_exclusive (selector, primary);
+
+	g_object_unref (primary);
 }
 
 static void
diff --git a/modules/online-accounts/evolution-online-accounts.c b/modules/online-accounts/evolution-online-accounts.c
index 8abe522..3cdfc42 100644
--- a/modules/online-accounts/evolution-online-accounts.c
+++ b/modules/online-accounts/evolution-online-accounts.c
@@ -245,7 +245,7 @@ online_accounts_search_source_list (EOnlineAccounts *extension,
 			source = E_SOURCE (list_b->data);
 			list_b = g_slist_next (list_b);
 
-			uid = e_source_peek_uid (source);
+			uid = e_source_get_uid (source);
 			property = e_source_get_property (source, GOA_KEY);
 
 			if (property == NULL)
diff --git a/plugins/addressbook-file/addressbook-file.c b/plugins/addressbook-file/addressbook-file.c
index 37ed087..40d6458 100644
--- a/plugins/addressbook-file/addressbook-file.c
+++ b/plugins/addressbook-file/addressbook-file.c
@@ -63,7 +63,7 @@ e_book_file_dummy (EPlugin *epl,
 		return NULL;
 	}
 
-	e_source_set_relative_uri (source, e_source_peek_uid (source));
+	e_source_set_relative_uri (source, e_source_get_uid (source));
 
 	return NULL;
 }
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 1fa392b..69115dd 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -427,9 +427,11 @@ bbdb_create_book_client (gint type)
 
 	/* Open the appropriate addresbook. */
 	if (type == GAIM_ADDRESSBOOK)
-		uri = g_settings_get_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM);
+		uri = g_settings_get_string (
+			settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM);
 	else
-		uri = g_settings_get_string (settings, CONF_KEY_WHICH_ADDRESSBOOK);
+		uri = g_settings_get_string (
+			settings, CONF_KEY_WHICH_ADDRESSBOOK);
 	g_object_unref (G_OBJECT (settings));
 
 	if (uri == NULL)
@@ -520,12 +522,17 @@ enable_toggled_cb (GtkWidget *widget,
 	if (active && !addressbook) {
 		const gchar *uri = NULL;
 
-		selected_source = e_source_combo_box_get_active (
+		selected_source = e_source_combo_box_ref_active (
 			E_SOURCE_COMBO_BOX (stuff->combo_box));
-		if (selected_source != NULL)
+		if (selected_source != NULL) {
 			uri = e_source_get_uri (selected_source);
-
-		g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK, uri ? uri : "");
+			g_settings_set_string (
+				settings, CONF_KEY_WHICH_ADDRESSBOOK, uri);
+			g_object_unref (selected_source);
+		} else {
+			g_settings_set_string (
+				settings, CONF_KEY_WHICH_ADDRESSBOOK, "");
+		}
 	}
 
 	g_free (addressbook);
@@ -547,12 +554,23 @@ enable_gaim_toggled_cb (GtkWidget *widget,
 	/* Save the new setting to GSettings */
 	g_settings_set_boolean (settings, CONF_KEY_ENABLE_GAIM, active);
 
-	addressbook_gaim = g_settings_get_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM);
+	addressbook_gaim = g_settings_get_string (
+		settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM);
 	gtk_widget_set_sensitive (stuff->gaim_combo_box, active);
 	if (active && !addressbook_gaim) {
-		selected_source = e_source_combo_box_get_active (
+		const gchar *uri = NULL;
+
+		selected_source = e_source_combo_box_ref_active (
 			E_SOURCE_COMBO_BOX (stuff->gaim_combo_box));
-		g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, e_source_get_uri (selected_source));
+		if (selected_source != NULL) {
+			uri = e_source_get_uri (selected_source);
+			g_settings_set_string (
+				settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, uri);
+			g_object_unref (selected_source);
+		} else {
+			g_settings_set_string (
+				settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, "");
+		}
 	}
 
 	g_free (addressbook_gaim);
@@ -569,34 +587,38 @@ static void
 source_changed_cb (ESourceComboBox *source_combo_box,
                    struct bbdb_stuff *stuff)
 {
+	GSettings *settings;
 	ESource *source;
-	GSettings *settings = g_settings_new (CONF_SCHEMA);
-
-	source = e_source_combo_box_get_active (source_combo_box);
+	const gchar *uri;
 
-	g_settings_set_string (
-		settings,
-		CONF_KEY_WHICH_ADDRESSBOOK,
-		source ? e_source_get_uri (source) : "");
+	source = e_source_combo_box_ref_active (source_combo_box);
+	uri = (source != NULL) ? e_source_get_uri (source) : "";
 
+	settings = g_settings_new (CONF_SCHEMA);
+	g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK, uri);
 	g_object_unref (settings);
+
+	if (source != NULL)
+		g_object_unref (source);
 }
 
 static void
 gaim_source_changed_cb (ESourceComboBox *source_combo_box,
                         struct bbdb_stuff *stuff)
 {
+	GSettings *settings;
 	ESource *source;
-	GSettings *settings = g_settings_new (CONF_SCHEMA);
-
-	source = e_source_combo_box_get_active (source_combo_box);
+	const gchar *uri;
 
-	g_settings_set_string (
-		settings,
-		CONF_KEY_WHICH_ADDRESSBOOK_GAIM,
-		source ? e_source_get_uri (source) : "");
+	source = e_source_combo_box_ref_active (source_combo_box);
+	uri = (source != NULL) ? e_source_get_uri (source) : "";
 
+	settings = g_settings_new (CONF_SCHEMA);
+	g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, uri);
 	g_object_unref (settings);
+
+	if (source != NULL)
+		g_object_unref (source);
 }
 
 static GtkWidget *
diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c
index 0afb158..32ba96a 100644
--- a/plugins/calendar-file/calendar-file.c
+++ b/plugins/calendar-file/calendar-file.c
@@ -124,7 +124,7 @@ e_calendar_file_customs (EPlugin *epl,
 	if (relative_uri && g_str_equal (relative_uri, "system"))
 		return NULL;
 
-	e_source_set_relative_uri (source, e_source_peek_uid (source));
+	e_source_set_relative_uri (source, e_source_get_uid (source));
 
 	mainbox = gtk_vbox_new (FALSE, 2);
 	g_object_get (data->parent, "n-rows", &n_rows, NULL);
diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c
index c80aba3..0e4ce12 100644
--- a/plugins/default-source/default-source.c
+++ b/plugins/default-source/default-source.c
@@ -62,7 +62,7 @@ mark_default_source_in_list (ESourceList *source_list,
 	g_return_if_fail (source_list != NULL);
 	g_return_if_fail (source != NULL);
 
-	source = e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (source));
+	source = e_source_list_peek_source_by_uid (source_list, e_source_get_uid (source));
 
 	for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
 		ESourceGroup *group = g->data;
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index b8fd802..16f7a21 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -440,7 +440,7 @@ get_real_item (ItipPURI *pitip)
 
 	source = e_client_get_source (E_CLIENT (pitip->current_client));
 	if (source)
-		comp = g_hash_table_lookup (pitip->real_comps, e_source_peek_uid (source));
+		comp = g_hash_table_lookup (pitip->real_comps, e_source_get_uid (source));
 
 	if (!comp) {
 		return NULL;
@@ -502,7 +502,7 @@ add_failed_to_load_msg (ItipView *view,
 
 	/* Translators: The first '%s' is replaced with a calendar name,
 	 * the second '%s' with an error message */
-	msg = g_strdup_printf (_("Failed to load the calendar '%s' (%s)"), e_source_peek_name (source), error->message);
+	msg = g_strdup_printf (_("Failed to load the calendar '%s' (%s)"), e_source_get_display_name (source), error->message);
 
 	itip_view_add_lower_info_item (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, msg);
 
@@ -544,7 +544,7 @@ cal_opened_cb (GObject *source_object,
 	cal_client = E_CAL_CLIENT (client);
 	g_return_if_fail (cal_client != NULL);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	source_type = e_cal_client_get_source_type (cal_client);
 	g_hash_table_insert (
 		pitip->clients[source_type], g_strdup (uid), cal_client);
@@ -586,7 +586,7 @@ start_calendar_server (ItipPURI *pitip,
 
 	g_return_if_fail (source != NULL);
 
-	client = g_hash_table_lookup (pitip->clients[type], e_source_peek_uid (source));
+	client = g_hash_table_lookup (pitip->clients[type], e_source_get_uid (source));
 	if (client) {
 		pitip->current_client = client;
 
@@ -663,7 +663,7 @@ find_cal_update_ui (FormatItipFindData *fd,
 
 	if (cal_client && g_hash_table_lookup (fd->conflicts, cal_client)) {
 		itip_view_add_upper_info_item_printf (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
-						      _("An appointment in the calendar '%s' conflicts with this meeting"), e_source_peek_name (source));
+						      _("An appointment in the calendar '%s' conflicts with this meeting"), e_source_get_display_name (source));
 	}
 
 	/* search for a master object if the detached object doesn't exist in the calendar */
@@ -687,7 +687,7 @@ find_cal_update_ui (FormatItipFindData *fd,
 
 		/* FIXME Check read only state of calendar? */
 		itip_view_add_lower_info_item_printf (view, ITIP_VIEW_INFO_ITEM_TYPE_INFO,
-			_("Found the appointment in the calendar '%s'"), e_source_peek_name (source));
+			_("Found the appointment in the calendar '%s'"), e_source_get_display_name (source));
 
 		set_buttons_sensitive (pitip, view);
 	} else if (!pitip->current_client)
@@ -878,7 +878,7 @@ get_object_without_rid_ready_cb (GObject *source_object,
 		if (comp) {
 			ESource *source = e_client_get_source (E_CLIENT (cal_client));
 
-			g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_peek_uid (source)), comp);
+			g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_get_uid (source)), comp);
 		}
 
 		find_cal_update_ui (fd, cal_client);
@@ -929,7 +929,7 @@ get_object_with_rid_ready_cb (GObject *source_object,
 		if (comp) {
 			ESource *source = e_client_get_source (E_CLIENT (cal_client));
 
-			g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_peek_uid (source)), comp);
+			g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_get_uid (source)), comp);
 		}
 
 		find_cal_update_ui (fd, cal_client);
@@ -1037,7 +1037,7 @@ find_cal_opened_cb (GObject *source_object,
 	cal_client = E_CAL_CLIENT (client);
 	source_type = e_cal_client_get_source_type (cal_client);
 
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	g_hash_table_insert (
 		pitip->clients[source_type], g_strdup (uid), cal_client);
 
@@ -1500,7 +1500,7 @@ receive_objects_ready_cb (GObject *ecalclient,
 				itip_view_add_lower_info_item_printf (
 					view, ITIP_VIEW_INFO_ITEM_TYPE_INFO,
 					_("Unable to send item to calendar '%s'.  %s"),
-					e_source_peek_name (source), error ? error->message : _("Unknown error"));
+					e_source_get_display_name (source), error ? error->message : _("Unknown error"));
 		}
 		g_clear_error (&error);
 		return;
@@ -1514,24 +1514,24 @@ receive_objects_ready_cb (GObject *ecalclient,
 	case ITIP_VIEW_RESPONSE_ACCEPT:
 		itip_view_add_lower_info_item_printf (
 			view, ITIP_VIEW_INFO_ITEM_TYPE_INFO,
-			_("Sent to calendar '%s' as accepted"), e_source_peek_name (source));
+			_("Sent to calendar '%s' as accepted"), e_source_get_display_name (source));
 		break;
 	case ITIP_VIEW_RESPONSE_TENTATIVE:
 		itip_view_add_lower_info_item_printf (
 			view, ITIP_VIEW_INFO_ITEM_TYPE_INFO,
-			_("Sent to calendar '%s' as tentative"), e_source_peek_name (source));
+			_("Sent to calendar '%s' as tentative"), e_source_get_display_name (source));
 		break;
 	case ITIP_VIEW_RESPONSE_DECLINE:
 		/* FIXME some calendars just might not save it at all, is this accurate? */
 		itip_view_add_lower_info_item_printf (
 			view, ITIP_VIEW_INFO_ITEM_TYPE_INFO,
-			_("Sent to calendar '%s' as declined"), e_source_peek_name (source));
+			_("Sent to calendar '%s' as declined"), e_source_get_display_name (source));
 		break;
 	case ITIP_VIEW_RESPONSE_CANCEL:
 		/* FIXME some calendars just might not save it at all, is this accurate? */
 		itip_view_add_lower_info_item_printf (
 			view, ITIP_VIEW_INFO_ITEM_TYPE_INFO,
-			_("Sent to calendar '%s' as canceled"), e_source_peek_name (source));
+			_("Sent to calendar '%s' as canceled"), e_source_get_display_name (source));
 		break;
 	default:
 		g_assert_not_reached ();
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 018ae98..c92ac60 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -943,7 +943,7 @@ source_changed_cb (WebKitDOMElement *select,
 
 	source = itip_view_get_source (view);
 
-	d(printf("Source changed to '%s'\n", e_source_peek_name (source)));
+	d(printf("Source changed to '%s'\n", e_source_get_display_name (source)));
 	g_signal_emit (view, signals[SOURCE_SELECTED], 0, source);
 }
 
@@ -2207,13 +2207,13 @@ source_list_changed_cb (ESourceList *source_list,
 				view->priv->dom_document, "OPTION", NULL);
 			webkit_dom_html_option_element_set_value (
 				WEBKIT_DOM_HTML_OPTION_ELEMENT (option),
-				e_source_peek_uid (source));
+				e_source_get_uid (source));
 			webkit_dom_html_option_element_set_label (
 				WEBKIT_DOM_HTML_OPTION_ELEMENT (option),
-				e_source_peek_name (source));
+				e_source_get_display_name (source));
 			webkit_dom_html_element_set_inner_html (
 				WEBKIT_DOM_HTML_ELEMENT (option),
-				e_source_peek_name (source), NULL);
+				e_source_get_display_name (source), NULL);
 			webkit_dom_html_element_set_class_name (
 				WEBKIT_DOM_HTML_ELEMENT (option), "calendar");
 
@@ -2271,7 +2271,7 @@ itip_view_set_source (ItipView *view,
 
 	g_return_if_fail (ITIP_IS_VIEW (view));
 
-	d(printf("Settings default source '%s'\n", e_source_peek_name (source)));
+	d(printf("Settings default source '%s'\n", e_source_get_display_name (source)));
 
 	if (!view->priv->dom_document)
 		return;
@@ -2312,7 +2312,7 @@ itip_view_set_source (ItipView *view,
 		option = WEBKIT_DOM_HTML_OPTION_ELEMENT (node);
 
 		value = webkit_dom_html_option_element_get_value (option);
-		if (g_strcmp0 (value, e_source_peek_uid (source)) == 0) {
+		if (g_strcmp0 (value, e_source_get_uid (source)) == 0) {
 			webkit_dom_html_option_element_set_selected (
 				option, TRUE);
 
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index e86fa2a..abea9be 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -666,7 +666,7 @@ open_client (PstImporter *m,
 	combo = g_datalist_get_data (&m->target->data, get_source_combo_key (source_type));
 	g_return_if_fail (combo != NULL);
 
-	source = e_source_combo_box_get_active (combo);
+	source = e_source_combo_box_ref_active (combo);
 	g_return_if_fail (source != NULL);
 
 	m->waiting_open++;
@@ -675,6 +675,8 @@ open_client (PstImporter *m,
 		source, source_type, FALSE, m->cancellable,
 		e_client_utils_authenticate_handler, NULL,
 		client_opened_cb, m);
+
+	g_object_unref (source);
 }
 
 static void
diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c
index db3dd28..2d9efb6 100644
--- a/plugins/publish-calendar/url-editor-dialog.c
+++ b/plugins/publish-calendar/url-editor-dialog.c
@@ -589,7 +589,7 @@ url_editor_dialog_run (UrlEditorDialog *dialog)
 
 		l = e_source_selector_get_selection (E_SOURCE_SELECTOR (dialog->events_selector));
 		for (p = l; p; p = g_slist_next (p))
-			dialog->uri->events = g_slist_append (dialog->uri->events, g_strdup (e_source_peek_uid (p->data)));
+			dialog->uri->events = g_slist_append (dialog->uri->events, g_strdup (e_source_get_uid (p->data)));
 	}
 	gtk_widget_hide (GTK_WIDGET (dialog));
 
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index f9d97fc..021123d 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -337,14 +337,14 @@ do_save_calendar_csv (FormatHandler *handler,
 	if (!dest_uri)
 		return;
 
-	primary_source = e_source_selector_get_primary_selection (selector);
-
 	/* open source client */
+	primary_source = e_source_selector_ref_primary_selection (selector);
 	source_client = e_cal_client_new (primary_source, type, &error);
 	if (source_client)
 		g_signal_connect (
 			source_client, "authenticate",
 			G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+	g_object_unref (primary_source);
 
 	if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
 		display_error_message (
diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c
index 77e5558..47cc15f 100644
--- a/plugins/save-calendar/ical-format.c
+++ b/plugins/save-calendar/ical-format.c
@@ -97,17 +97,17 @@ do_save_calendar_ical (FormatHandler *handler,
 	GSList *objects = NULL;
 	icalcomponent *top_level = NULL;
 
-	primary_source = e_source_selector_get_primary_selection (selector);
-
 	if (!dest_uri)
 		return;
 
 	/* open source client */
+	primary_source = e_source_selector_ref_primary_selection (selector);
 	source_client = e_cal_client_new (primary_source, type, &error);
 	if (source_client)
 		g_signal_connect (
 			source_client, "authenticate",
 			G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+	g_object_unref (primary_source);
 
 	if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
 		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error->message);
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index 11c29fa..2e2e92e 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -26,6 +26,7 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
 #include <libedataserver/e-source.h>
 #include <libedataserverui/e-client-utils.h>
 #include <libedataserverui/e-source-selector.h>
@@ -201,14 +202,14 @@ do_save_calendar_rdf (FormatHandler *handler,
 	if (!dest_uri)
 		return;
 
-	primary_source = e_source_selector_get_primary_selection (selector);
-
 	/* open source client */
+	primary_source = e_source_selector_ref_primary_selection (selector);
 	source_client = e_cal_client_new (primary_source, type, &error);
 	if (source_client)
 		g_signal_connect (
 			source_client, "authenticate",
 			G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+	g_object_unref (primary_source);
 
 	if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
 		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error);
@@ -249,9 +250,9 @@ do_save_calendar_rdf (FormatHandler *handler,
 
 		xmlNewChild (fnode, NULL, (const guchar *)"method", (const guchar *)"PUBLISH");
 
-		xmlNewChild (fnode, NULL, (const guchar *)"x-wr:relcalid", (guchar *)e_source_peek_uid (primary_source));
+		xmlNewChild (fnode, NULL, (const guchar *)"x-wr:relcalid", (guchar *)e_source_get_uid (primary_source));
 
-		xmlNewChild (fnode, NULL, (const guchar *)"x-wr:calname", (guchar *)e_source_peek_name (primary_source));
+		xmlNewChild (fnode, NULL, (const guchar *)"x-wr:calname", (guchar *)e_source_get_display_name (primary_source));
 
 		/* Version of this RDF-format */
 		xmlNewChild (fnode, NULL, (const guchar *)"version", (const guchar *)"2.0");
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
index 468d873..69929a1 100644
--- a/shell/e-shell-migrate.c
+++ b/shell/e-shell-migrate.c
@@ -837,8 +837,8 @@ merge_duplicate_local_sources (GConfClient *client,
 					continue;
 
 				/* pretty unlikely, but just in case */
-				val1 = e_source_peek_uid (dupe_source);
-				val2 = e_source_peek_uid (my_source);
+				val1 = e_source_get_uid (dupe_source);
+				val2 = e_source_get_uid (my_source);
 				if (g_strcmp0 (val1, val2) == 0)
 					break;
 
@@ -876,7 +876,7 @@ merge_duplicate_local_sources (GConfClient *client,
 
 			relative_uri = e_source_peek_relative_uri (source);
 			if (!relative_uri || !*relative_uri)
-				e_source_set_relative_uri (source, e_source_peek_uid (source));
+				e_source_set_relative_uri (source, e_source_get_uid (source));
 		}
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]