[evolution-kolab/ek-wip-acl] EPlugin: split out updating the ACL add/edit dialog into separate functions



commit 6f9474eb6f43715e3e20d10e227c7512be2f3941
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Mon Oct 8 18:39:02 2012 +0200

    EPlugin: split out updating the ACL add/edit dialog into separate functions
    
    * have the ACL add/edit dialog updated from within
      separate functions, so we do not clutter the dialog
      creation code with updating stuff
    * since adding to and editing ACL introduce slight
      differences in the (mostly common) dialog, we do
      the updating in two separate functions

 src/eplugin/e-kolab-folder-permissions.c |   73 ++++++++++++++++++++----------
 1 files changed, 49 insertions(+), 24 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index c2e4e39..a7be0b8 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -68,6 +68,54 @@ kolab_folder_permissions_ui_edit_dialog_response_cb (GObject *dialog,
 }
 
 static void
+kolab_folder_permissions_ui_update_add_dialog (KolabFolderPermUIData *uidata)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != 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);
+}
+
+static void
+kolab_folder_permissions_ui_update_edit_dialog (KolabFolderPermUIData *uidata)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+
+	/* when editing an existing ACL entry, we use the
+	 * dropdown combo box for displaying the clicked
+	 * access_id only
+	 */
+	gtk_widget_set_sensitive (uidata->widgets->edit_entry_box,
+	                          FALSE);
+
+}
+
+static void
+kolab_folder_permissions_ui_update_add_edit_dialog (KolabFolderPermUIData *uidata)
+{
+	g_return_if_fail (uidata != NULL);
+	g_return_if_fail (uidata->widgets != NULL);
+
+	/* when the add/edit dialog opens, we will have the existing
+	 * access_id list read in already, so we can deactivate the
+	 * "Retrieve" button for now (could be used for an in-place
+	 * re-query later on or simply removed)
+	 */
+	gtk_widget_set_sensitive (uidata->widgets->edit_btn_retrieve,
+	                          FALSE);
+
+	if (uidata->editing)
+		kolab_folder_permissions_ui_update_edit_dialog (uidata);
+	else
+		kolab_folder_permissions_ui_update_add_dialog (uidata);
+}
+
+static void
 kolab_folder_permissions_ui_add_edit_dialog (KolabFolderPermUIData *uidata)
 {
 	GtkWidget *dialog = NULL;
@@ -188,23 +236,6 @@ kolab_folder_permissions_ui_add_edit_dialog (KolabFolderPermUIData *uidata)
 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
 	gtk_grid_attach (GTK_GRID (grid), widget, 1, row, 1, 1);
 
-	/* when the add/edit dialog opens, we will have the existing
-	 * access_id list read in already, so we can deactivate the
-	 * "Retrieve" button for now (could be used for an in-place
-	 * re-query later on or simply removed)
-	 */
-	gtk_widget_set_sensitive (uidata->widgets->edit_btn_retrieve,
-	                          FALSE);
-
-	/* when editing an existing ACL entry, we use the
-	 * dropdown combo box for displaying the clicked
-	 * access_id only
-	 */
-	if (uidata->editing) {
-		gtk_widget_set_sensitive (uidata->widgets->edit_entry_box,
-		                          FALSE);
-	}
-
 	/* FIXME connect signals */
 	g_warning ("%s: FIXME connect signals", __func__);
 
@@ -221,13 +252,7 @@ kolab_folder_permissions_ui_add_edit_dialog (KolabFolderPermUIData *uidata)
 
 	gtk_widget_show_all (content);
 
-	/* when editing an existing ACL entry, we show
-	 * the current rights string for the selected
-	 * access_id, otherwise we hide it
-	 */
-	if (! uidata->editing) {
-		gtk_widget_hide (uidata->widgets->access_rights);
-	}
+	kolab_folder_permissions_ui_update_add_edit_dialog (uidata);
 
 	gtk_widget_show (dialog);
 }



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