[evolution-kolab] EPlugin: query store for folder permissions



commit 36d6ab17536184ce068054be086bb1839c1e919f
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Oct 2 16:47:12 2012 +0200

    EPlugin: query store for folder permissions
    
    * added querying the CamelKolabIMAPXStore for folder
      permission (ACL) data when creating the UI for ACL
      management
    * TBD: update the UI from the query response

 src/eplugin/e-kolab-folder-permissions.c |   52 ++++++++++++++++++++++++++++--
 1 files changed, 49 insertions(+), 3 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index 231ed9b..7abca84 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -33,6 +33,8 @@
 #include <e-util/e-config.h>
 #include <e-util/e-plugin.h>
 
+#include <libekolabutil/kolab-util-error.h>
+
 #include "e-kolab-plugin-util.h"
 #include "e-kolab-folder-permissions.h"
 
@@ -328,6 +330,7 @@ e_kolab_folder_permissions_ui_new (void)
 	GtkWidget *treeview = NULL;
 	gint row = 0;
 
+	uidata->permissions = kolab_data_folder_permissions_new ();
 	uidata->shell_view = NULL;
 	uidata->alert_bar = NULL;
 
@@ -396,7 +399,6 @@ e_kolab_folder_permissions_ui_new (void)
 	                          "clicked",
 	                          G_CALLBACK (kolab_folder_permissions_ui_edit_dialog_cb),
 	                          uidata);
-
 	return uidata;
 }
 
@@ -434,12 +436,56 @@ e_kolab_folder_permissions_ui_query_store (KolabFolderPermUIData *uidata,
                                            GCancellable *cancellable,
                                            GError **err)
 {
+	CamelKolabIMAPXStore *kstore = NULL;
+	gchar *selected_path = NULL;
+	GError *tmp_err = NULL;
+	gboolean ok = FALSE;
+
 	g_return_val_if_fail (uidata != NULL, FALSE);
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
-	g_warning ("%s: FIXME implement me", __func__);
-	return TRUE;
+	g_return_val_if_fail (E_IS_SHELL_VIEW (uidata->shell_view), FALSE);
+	g_return_val_if_fail (uidata->permissions != NULL, FALSE);
+	g_return_val_if_fail (uidata->permissions->acl == NULL, FALSE);
+
+	ok = e_kolab_plugin_util_ui_get_selected_store (uidata->shell_view,
+	                                                &kstore,
+	                                                &selected_path);
+	if (! ok) {
+		/* If we cannot get the store here, it means
+		 * that the store associated with the selected
+		 * path is not a CamelKolabIMAPXStore. This
+		 * should not happen at this point (if the store
+		 * in question is not a Kolab store, then no
+		 * Kolab folder options context menu entry should
+		 * have been shown).
+		 */
+		g_set_error (&tmp_err,
+		             KOLAB_CAMEL_KOLAB_ERROR,
+		             KOLAB_CAMEL_KOLAB_ERROR_GENERIC,
+		             _("Could not get the Kolab store from shell view!"));
+		goto exit;
+	}
+
+	uidata->permissions->acl =
+		camel_kolab_imapx_store_get_folder_permissions (kstore,
+		                                                selected_path,
+		                                                FALSE, /* general ACL (no myrights) */
+		                                                cancellable,
+		                                                &tmp_err);
+	g_free (selected_path);
+
+ exit:
+	if (tmp_err != NULL) {
+		g_propagate_error (err, tmp_err);
+		ok = FALSE;
+	}
+
+	if (kstore != NULL)
+		g_object_unref (kstore);
+
+	return ok;
 }
 
 gboolean



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