[evolution-kolab] EPlugin: skip trying to read/write permissions if in PIM context



commit 89ae848634ba87c8f61ac9e3a4ec8b5b841392eb
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Oct 19 19:12:42 2012 +0200

    EPlugin: skip trying to read/write permissions if in PIM context
    
    * if the "Kolab Folder Properties..." dialog is opened
      from within a PIM EShellView, we do not read permissions
      and do not write any back
    * this operation is limited to email view, where we have
      the CamelKolabIMAPXStore to commence the operation

 src/eplugin/e-kolab-folder-permissions.c |    9 ++++++++-
 src/eplugin/e-kolab-folder-permissions.h |    1 +
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index 7576221..3e97903 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -876,6 +876,7 @@ e_kolab_folder_permissions_ui_new (void)
 
 	/* documenting initial settings */
 	uidata->shell_view = NULL;
+	uidata->shell_context = KOLAB_FOLDER_CONTEXT_INVAL;
 	uidata->alert_bar = NULL;
 	uidata->dialog = NULL;
 	uidata->foldername = NULL;
@@ -1031,6 +1032,9 @@ e_kolab_folder_permissions_ui_query_store (KolabFolderPermUIData *uidata,
 	g_return_val_if_fail (uidata->permissions != NULL, FALSE);
 	g_return_val_if_fail (uidata->permissions->acl == NULL, FALSE);
 
+	if (uidata->shell_context != KOLAB_FOLDER_CONTEXT_EMAIL)
+		goto exit; /* ACL can be done from email view only */
+
 	/* If we cannot get the store here, it means
 	 * that the store associated with the selected
 	 * path is not a CamelKolabIMAPXStore. This
@@ -1085,7 +1089,7 @@ e_kolab_folder_permissions_ui_write_store (KolabFolderPermUIData *uidata,
 	CamelKolabIMAPXStore *kstore = NULL;
 	gchar *selected_path = NULL;
 	GError *tmp_err = NULL;
-	gboolean ok = FALSE;
+	gboolean ok = TRUE;
 
 	g_return_val_if_fail (uidata != NULL, FALSE);
 	/* cancellable may be NULL */
@@ -1094,6 +1098,9 @@ e_kolab_folder_permissions_ui_write_store (KolabFolderPermUIData *uidata,
 	g_return_val_if_fail (E_IS_SHELL_VIEW (uidata->shell_view), FALSE);
 	g_return_val_if_fail (uidata->permissions != NULL, FALSE);
 
+	if (uidata->shell_context != KOLAB_FOLDER_CONTEXT_EMAIL)
+		goto exit; /* ACL can be done from email view only */
+
 	if (! uidata->changed)
 		return TRUE;
 
diff --git a/src/eplugin/e-kolab-folder-permissions.h b/src/eplugin/e-kolab-folder-permissions.h
index 3af6c23..61d6c72 100644
--- a/src/eplugin/e-kolab-folder-permissions.h
+++ b/src/eplugin/e-kolab-folder-permissions.h
@@ -75,6 +75,7 @@ struct _KolabFolderPermUIWidgets {
 typedef struct _KolabFolderPermUIData KolabFolderPermUIData;
 struct _KolabFolderPermUIData {
 	EShellView *shell_view;
+	KolabFolderContextID shell_context;
 	EAlertBar *alert_bar;
 	GtkDialog *dialog;
 	KolabFolderPermUIWidgets *widgets;



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