[evolution-kolab/ek-wip-acl] EPlugin: update the ACL add sub-dialog before displaying



commit 4637326d02d3c739630c64d286e5ad92ebce9aef
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Oct 9 12:30:45 2012 +0200

    EPlugin: update the ACL add sub-dialog before displaying
    
    * update the "add" variant of the ACL add/edit dialog with
      data previously read from the server
    * we fill the combo box with the access_id entries we have
      for the folder, but do not set a default
    * the combo box entry field is thus empty to clarify that
      we're adding a new entry, but the already-existing
      access_ids appear when the dropbox is opened so we can
      pick one and change it (should ease editing in some
      cases)
    * once we can query address books or directory services
      via the "Retrieve" button, more access_ids could be
      added to the combo box for easy selection

 src/eplugin/e-kolab-folder-permissions.c |   32 ++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index 17e39ac..955fe3d 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -70,14 +70,46 @@ kolab_folder_permissions_ui_edit_dialog_response_cb (GObject *dialog,
 static void
 kolab_folder_permissions_ui_update_add_dialog (KolabFolderPermUIData *uidata)
 {
+	GtkComboBoxText *entrybox = NULL;
+	CamelImapxAclEntry *entry = NULL;
+	GList *acl = NULL;
+	GList *acl_ptr = NULL;
+
 	g_return_if_fail (uidata != NULL);
 	g_return_if_fail (uidata->widgets != NULL);
+	g_return_if_fail (uidata->permissions != NULL);
 
 	/* when editing an existing ACL entry, we show
 	 * the current rights string for the selected
 	 * access_id, otherwise we hide it
 	 */
 	gtk_widget_hide (uidata->widgets->access_rights);
+
+	g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (uidata->widgets->edit_entry_box));
+	entrybox = GTK_COMBO_BOX_TEXT (uidata->widgets->edit_entry_box);
+
+	acl = uidata->permissions->acl;
+	acl_ptr = acl;
+	while (acl_ptr != NULL) {
+		entry = (CamelImapxAclEntry *) acl_ptr->data;
+		if (entry == NULL) {
+			g_warning ("%s[%u] got NULL CamelImapxAclEntry",
+			           __func__, __LINE__);
+			goto skip;
+		}
+
+		if (entry->access_id == NULL) {
+			g_warning ("%s[%u] got NULL CamelImapxAclEntry.access_id",
+			           __func__, __LINE__);
+			goto skip;
+		}
+
+		gtk_combo_box_text_append_text (entrybox,
+		                                entry->access_id);
+
+	skip:
+		acl_ptr = g_list_next (acl_ptr);
+	}
 }
 
 static void



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