[evolution-data-server] Bug #529331 - Be able to disallow selection of a certain ESource



commit c1f0d8ca12fe6c5d0e1ab3d9155c6ea5d7e4b8a2
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 25 13:30:34 2010 +0100

    Bug #529331 - Be able to disallow selection of a certain ESource

 libedataserverui/e-source-selector-dialog.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libedataserverui/e-source-selector-dialog.c b/libedataserverui/e-source-selector-dialog.c
index 29abf90..e301169 100644
--- a/libedataserverui/e-source-selector-dialog.c
+++ b/libedataserverui/e-source-selector-dialog.c
@@ -129,6 +129,22 @@ primary_selection_changed_cb (ESourceSelector *selector, gpointer user_data)
 	if (priv->selected_source)
 		g_object_unref (priv->selected_source);
 	priv->selected_source = e_source_selector_peek_primary_selection (selector);
+
+	/* FIXME: add an API to "except-source" or to get the ESourceSelector from outside */
+	if (priv->selected_source) {
+		ESource *except_source = g_object_get_data (G_OBJECT (dialog), "except-source");
+
+		if (except_source) {
+			const gchar *except_uid, *selected_uid;
+
+			except_uid = e_source_peek_uid (except_source);
+			selected_uid = e_source_peek_uid (priv->selected_source);
+
+			if (except_uid && selected_uid && g_str_equal (except_uid, selected_uid))
+				priv->selected_source = NULL;
+		}
+	}
+
 	if (priv->selected_source) {
 		g_object_ref (priv->selected_source);
 		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);



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